From: Frank Lichtenheld Date: Thu, 23 Feb 2006 12:30:30 +0000 (+0000) Subject: It was late X-Git-Tag: switch-to-templates~53 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=8404c87d60bb7911d78a17dd5fd319460ff5fba7;p=deb%2Fpackages.git It was late --- diff --git a/bin/newpkg_info b/bin/newpkg_info index cdfac5f..175119a 100755 --- a/bin/newpkg_info +++ b/bin/newpkg_info @@ -3,16 +3,21 @@ 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) = @_; @@ -29,14 +34,17 @@ for (my $age = 0; $age < 7; $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 () { 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 () { chomp; if ($old{$_}) { @@ -54,13 +62,13 @@ for (my $age = 0; $age < 7; $age++) { 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");