my %db;
my %db2;
if ($options{update}) {
- copy($versions,$versions_new);
copy($versions_time,$versions_time_new);
}
tie %db, "MLDBM", $versions_new, O_CREAT|O_RDWR, 0664
$mode = '-|:encoding(UTF-8)';
push @opts,'gzip','-dc';
}
- if ($file =~ /^\.xz$/) {
+ if ($file =~ /\.xz$/) {
$mode = '-|:encoding(UTF-8)';
push @opts,'xz','-dc';
}
+ if ($file =~ /\.bz2$/) {
+ $mode = '-|:encoding(UTF-8)';
+ push @opts,'bzip2','-dc';
+ }
open($fh,$mode,@opts,$file);
return $fh;
}
update_package_version($db,$db2,$dist,$arch,$pkg,$ver,$time) unless
$extra_source_only;
}
+ close($PACKAGES) or
+ die "Error while closing ${packages}: $!";
}
my $suitedir = "$toplevel/$suite";
for my $component ('main', 'main/debian-installer',
- 'contrib', 'non-free') {
+ 'contrib', 'contrib/debian-installer',
+ 'non-free', 'non-free/debian-installer',
+ ) {
my $componentdir = "$suitedir/$component";
- next unless -d $componentdir;
+ if (not -d $componentdir) {
+ print STDERR "No directory $suitedir/$component\n" if $DEBUG;
+ next;
+ }
my $COMPONENT;
opendir $COMPONENT, $componentdir or die "opendir $componentdir: $!";
# debian-installer is really a section rather than a component
# (ugh).
- (my $viscomponent = $component) =~ s[/.*][];
+ my $viscomponent = $component;
+ $viscomponent =~ s[/.*][];
- my $sources = (grep { -f $_ } glob "$suitedir/$component/source/Sources.*")[0];
- next unless defined $sources;
+ my $sources = (grep { -f $_ } glob "$componentdir/source/Sources.*")[0];
+ if (not defined $sources) {
+ print STDERR "No sources matching $componentdir/source/Sources.*\n" if $DEBUG;
+ next;
+ }
read_packages($db,$db2,$sources, $viscomponent,'source',$suite);
for my $arch (readdir $COMPONENT) {
my $archdir = "$componentdir/binary-$arch";
my $packages = (grep { -f $_ } glob("$archdir/Packages.*"))[0];
- next unless defined $packages;
+ if (not defined $packages) {
+ print STDERR "No binary packages matching $archdir/Packages.*\n" if $DEBUG;
+ next;
+ }
read_packages($db,$db2,$packages, $viscomponent,$arch,$suite);
}
- closedir $COMPONENT;
+ closedir $COMPONENT or
+ die "Unable to closedir $componentdir: $!";
}
}
}