use strict;
use warnings;
+use DB_File;
+
use lib './lib';
-use Packages::Config qw( $TOPDIR );
-use Packages::DB;
+use Packages::Config qw( $TOPDIR $DBDIR );
use Packages::Search qw( :all );
&Packages::Config::init( './' );
my $suite = $ARGV[0] or die "No suite given";
my $start_time = time;
+tie my %packages, 'DB_File', "$DBDIR/packages_small.db",
+ O_RDONLY, 0666, $DB_BTREE
+ or die "couldn't tie DB $DBDIR/packages_small.db: $!\n";
+
sub get_iso_date {
my ($age) = @_;
my $newday = get_iso_date( $age );
my $oldday = get_iso_date( $age+1 );
open OLD, '<', "$TOPDIR/files/packages/package_names_$suite.$oldday"
- or die "Couldn't open OLD file $TOPDIR/files/packages/package_names_$suite.$oldday: $!";
+ or do {
+ warn"Couldn't open OLD file $TOPDIR/files/packages/package_names_$suite.$oldday: $!\n";
+ last;
+ };
while (<OLD>) {
chomp;
$old{$_} = 1;
}
close OLD;
open NEW, '<', "$TOPDIR/files/packages/package_names_$suite.$newday"
- or die "Couldn't open NEW file $TOPDIR/files/packages/package_names_$suite.$newday: $!";
+ or die "Couldn't open NEW file $TOPDIR/files/packages/package_names_$suite.$newday: $!\n";
while (<NEW>) {
chomp;
if ($old{$_}) {
my %archives = map { $_ => 1 } qw( us security non-US );
foreach (sort keys %changes) {
my $entry = read_entry_simple( \%packages, $_, \%archives, $suite)
- or die "Can't find entry for package $_";
+ or die "Can't find entry for package $_\n";
shift @$entry; # remove virtual pkg info
print CHANGES join(" ", $_, $age, @$entry)."\n";
print "Wrote entry: ".join(" ", $_, $age, @$entry)."\n";
}
}
-closes CHANGES;
+close CHANGES;
rename("$TOPDIR/files/packages/newpkg_info.new",
"$TOPDIR/files/packages/newpkg_info");