- if ($oktoremove)
- { print "$ref removing\n" if $debug;
- for $mref (@aref)
- { print "$ref removing $mref\n" if $debug;
- if ( $gSaveOldBugs )
- {
- my $dir;
- $dir = "archive/" . get_archivename $mref;
- `mkdir -p "$dir"`;
- copy( "db/$mref.log", "$dir/$mref.log" );
- copy( "db/$mref.status", "$dir/$mref.status" );
- copy( "db/$mref.report", "$dir/$mref.report" );
- if ( open( IDXFILE, ">>archive/index" ) )
- { printf IDXFILE "%s %d %s\n", $s_package, $mref, $s_subject;
- close IDXFILE;
- } else { print "Unable to write to index file\n"; }
-
- print("archived $mref to $dir (from $ref)\n") || &quit("output old: $!");
- }
- unlink("db/$mref.log", "db/$mref.status", "db/$mref.report");
- print("deleted $mref (from $ref)\n") || &quit("output old: $!");
+ if ($oktoremove) {
+ print "$ref removing\n" if $debug;
+ for $mref (@aref) {
+ print "$ref removing $mref\n" if $debug;
+ my $dir = get_hashname($mref);
+ if ( $gSaveOldBugs ) {
+ `mkdir -p "archive/$dir"`;
+ link( "db-h/$dir/$mref.log", "archive/$dir/$mref.log" ) || copy( "db-h/$dir/$mref.log", "archive/$dir/$mref.log" );
+ link( "db-h/$dir/$mref.status", "archive/$dir/$mref.status" ) || copy( "db-h/$dir/$mref.status", "archive/$dir/$mref.status" );
+ link( "db-h/$dir/$mref.summary", "archive/$dir/$mref.summary" ) || copy( "db-h/$dir/$mref.summary", "archive/$dir/$mref.summary" );
+ link( "db-h/$dir/$mref.report", "archive/$dir/$mref.report" ) || copy( "db-h/$dir/$mref.report", "archive/$dir/$mref.report" );
+ print("archived $mref to archive/$dir (from $ref)\n") || &quit("output old: $!");
+ }
+ unlink("db-h/$dir/$mref.log", "db-h/$dir/$mref.status", "db-h/$dir/$mref.summary", "db-h/$dir/$mref.report");
+ print("deleted $mref (from $ref)\n") || &quit("output old: $!");
+ bughook_archive($mref);