]> git.donarmstrong.com Git - debbugs.git/blobdiff - scripts/expire.in
[project @ 2003-06-10 01:18:59 by cjwatson]
[debbugs.git] / scripts / expire.in
index 70097cbd5b937bba293e8991aedd72f2753c40c8..d2284036212650886099c51a0793ac204c960734 100755 (executable)
@@ -1,10 +1,10 @@
 #!/usr/bin/perl
-# $Id: expire.in,v 1.11 2002/11/02 09:21:43 ajt Exp $
+# $Id: expire.in,v 1.16 2003/05/25 13:17:14 cjwatson Exp $
 
 # Load modules and set envirnment
 use File::Copy;
-$config_path = '/org/bugs.debian.org/etc';
-$lib_path = '/org/bugs.debian.org/scripts';
+$config_path = '/etc/debbugs';
+$lib_path = '/usr/lib/debbugs';
 
 require("$config_path/config");
 require("$config_path/text");
@@ -30,30 +30,32 @@ foreach my $dir (@dirs) {
 #process each bug (ie, status file)
 while (length($ref=shift(@list))) {
        print STDERR "$ref considering\n" if $debug;
-    $bfound= &lockreadbugmerge($ref);
+    ($bfound, $data)= &lockreadbugmerge($ref);
        print STDERR "$ref read $bfound\n" if $debug;
     $bfound || next;
-       print "$ref read ok (done $s_done)\n" if $debug;
-    (&unlockreadbugmerge($bfound), next) unless length($s_done);
+       print "$ref read ok (done $data->{done})\n" if $debug;
+    (&unlockreadbugmerge($bfound), next) unless length($data->{done});
        print "$ref read done\n" if $debug;
     @aref= ($ref);
-    if (length($s_mergedwith)) { push(@aref,split/ /,$s_mergedwith); }
+    if (length($data->{mergedwith})) { push(@aref,split / /,$data->{mergedwith}); }
        print "$ref aref @aref\n" if $debug;
     $oktoremove= 1;
     for $mref (@aref) {
        print "$ref $mref check\n" if $debug;
         if ($mref != $ref) {
                print "$ref $mref reading\n" if $debug;
-            &lockreadbug($mref) || die "huh ?";
+            $newdata = &lockreadbug($mref) || die "huh $mref ?";
                print "$ref $mref read ok\n" if $debug;
             $bfound++;
+        } else {
+            $newdata = $data;
         }
        print "$ref $mref read/not\n" if $debug;
         $expectmerge= join(' ',grep($_ != $mref, sort { $a <=> $b } @aref));
-        $s_mergedwith eq $expectmerge ||
-            die "$ref -> $mref: ($s_mergedwith) vs. ($expectmerge) (@aref)";
+        $newdata->{mergedwith} eq $expectmerge ||
+            die "$ref -> $mref: ($newdata->{mergedwith}) vs. ($expectmerge) (@aref)";
                print "$ref $mref merge-ok\n" if $debug;
-        length($s_done) || die "$ref -> $mref";
+        length($newdata->{done}) || die "$ref -> $mref";
                print "$ref $mref done-ok\n" if $debug;
         $days= -M "db-h/".get_hashname($mref)."/$mref.log";
                print "ref $mref days $days\n" if $debug;
@@ -70,18 +72,11 @@ while (length($ref=shift(@list))) {
                        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.report", "archive/$dir/$mref.report" ) || copy( "db-h/$dir/$mref.report", "archive/$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 archive/$dir (from $ref)\n") || &quit("output old: $!");
                }
                unlink("db-h/$dir/$mref.log", "db-h/$dir/$mref.status", "db-h/$dir/$mref.report");
                print("deleted $mref (from $ref)\n") || &quit("output old: $!");
-               &filelock("debbugs.trace.lock");
-               &appendfile("debbugs.trace","archive $mref\n");
-               &unfilelock;
+               bughook_archive($mref);
         }
     }
        print "$ref unlocking $bfound\n" if $debug;