10 use Packages::Config qw( $TOPDIR $DBDIR );
11 use Packages::Search qw( :all );
12 &Packages::Config::init( './' );
14 my $suite = $ARGV[0] or die "Fatal Error: No suite given";
15 my $start_time = time;
18 tie my %packages, 'DB_File', "$DBDIR/packages_small.db",
19 O_RDONLY, 0666, $DB_BTREE
20 or die "Fatal Error: Couldn't tie DB $DBDIR/packages_small.db: $!\n";
25 my ($day, $month, $year) = (gmtime($start_time - ($age*86_400)))[3..5];
28 return sprintf( "%04s-%02s-%02s", $year, $month, $day );
31 my $packagesdir = "$TOPDIR/files/packages";
32 open CHANGES, '>', "$packagesdir/newpkg_info_$suite.new"
33 or die "Fatal Error: Couldn't open CHANGES file: $!";
36 for (my $age = 7; $age >= 0; $age--) {
38 my $newday = get_iso_date( $age );
39 my $oldday = get_iso_date( $age+1 );
40 -d "$packagesdir/$oldday" or do {
41 warn "Warning: No information available for $oldday\n";
45 -d "$packagesdir/$newday" or do {
46 warn "Warning: No information available for $newday\n";
50 warn "Process: age=$age oldday=$oldday newday=$newday\n" if $debug;
51 open OLD, '<', "$packagesdir/$oldday/package_names_$suite"
52 or die "Error: Couldn't open OLD file $packagesdir/$oldday/package_names_$suite: $!\n";
53 open NEW, '<', "$packagesdir/$newday/package_names_$suite"
54 or die "Error: Couldn't open NEW file $packagesdir/$newday/package_names_$suite: $!\n";
63 # we assume here that the input contains no dupes!
66 if (exists $del{$_}) {
68 warn "Re-Added: $_\n" if $debug;
71 warn "Added: $_ (age $age)\n" if $debug;
77 if (exists $add{$_}) {
79 warn "Deleted again: $_\n" if $debug;
82 warn "Deleted: $_ (age $age)\n" if $debug;
87 my %archives = map { $_ => 1 } qw( us security );
88 foreach (sort (keys %add, keys %del)) {
91 if (exists $add{$_}) {
92 $entry = read_entry_simple( \%packages, $_, \%archives, $suite);
93 die "Fatal Error: Can't find entry for package $_\n"
95 shift @$entry; # remove virtual pkg info
100 print CHANGES join(" ", $_, $age, @$entry)."\n";
101 print "Wrote entry: ".join(" ", $_, $age, @$entry)."\n";
105 rename("$packagesdir/newpkg_info_$suite.new",
106 "$packagesdir/newpkg_info_$suite");