]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2005-07-17 17:07:59 by cjwatson]
authorcjwatson <>
Mon, 18 Jul 2005 00:07:59 +0000 (16:07 -0800)
committercjwatson <>
Mon, 18 Jul 2005 00:07:59 +0000 (16:07 -0800)
Use readbug() interface to read from .summary files rather than .status
files.

migrate/debbugs-makeversions

index 234d0fdb6c3f47ad5c4819df106dea28e49a8de9..84b6943b45f8b280b23d905286d0246744c70df2 100755 (executable)
@@ -3,13 +3,18 @@
 # guesswork, based on Version: pseudo-headers and closing mails that look
 # like Debian changelogs. The latter in particular is somewhat heuristic.
 
-use strict;
+my $config_path = '/etc/debbugs';
+my $lib_path = '/usr/lib/debbugs';
+
+require "$config_path/config";
+require "$lib_path/errorlib";
+
 use Debbugs::Log;
 use Debbugs::MIME;
 
 if (@ARGV != 2) {
     print <<EOF;
-Usage: $0 db-directory versions-directory
+Usage: $0 db-type versions-directory
 
 EOF
     exit 0;
@@ -130,18 +135,19 @@ sub mergeinto ($$)
 }
 
 my ($db, $verdb) = @ARGV[0, 1];
-opendir DB, $db or die "Can't opendir $db: $!";
+opendir DB, "$gSpoolDir/$db" or die "Can't opendir $db: $!";
 unless (-d $verdb) {
     mkdir $verdb or die "Can't mkdir $verdb: $!";
 }
 
 while (defined(my $dir = readdir DB)) {
-    next if $dir =~ /^\.\.?$/ or not -d "$db/$dir";
-    opendir HASH, "$db/$dir" or die "Can't opendir $db/$dir: $!";
+    next if $dir =~ /^\.\.?$/ or not -d "$gSpoolDir/$db/$dir";
+    opendir HASH, "$gSpoolDir/$db/$dir"
+       or die "Can't opendir $gSpoolDir/$db/$dir: $!";
 
     while (defined(my $file = readdir HASH)) {
        next unless $file =~ /\.log$/;
-       next if -z "$db/$dir/$file";
+       next if -z "$gSpoolDir/$db/$dir/$file";
        (my $bug = $file) =~ s/\..*//;
 
        $bug =~ /(..)$/;
@@ -149,33 +155,30 @@ while (defined(my $dir = readdir DB)) {
        # For incremental updates.
        #next if -e "$verdb/$bughash/$bug.versions" and
        #       (stat "$verdb/$bughash/$bug.versions")[9] >=
-       #           (stat "$db/$dir/$file")[9];
+       #           (stat "$gSpoolDir/$db/$dir/$file")[9];
 
        print "Processing $bug ...\n" if $ENV{DEBBUGS_VERBOSE};
 
-       open STATUS, "$db/$dir/$bug.status" or next;
-       <STATUS> for 1 .. 6;    # done is field 7
-       chomp (my $done = <STATUS>);
-       <STATUS>;               # mergedwith is field 9
-       chomp (my $mergedwith = <STATUS>);
-       close STATUS;
+       my $status = readbug($bug, $db);
+       next unless defined $status;
 
-       my ($found_versions, $fixed_versions) = getbuginfo("$db/$dir/$file");
+       my ($found_versions, $fixed_versions) =
+           getbuginfo("$gSpoolDir/$db/$dir/$file");
 
-       if (length $mergedwith) {
-           for my $merge (split ' ', $mergedwith) {
+       if (length $status->{mergedwith}) {
+           for my $merge (split ' ', $status->{mergedwith}) {
                $merge =~ /(..)$/;
                my $mergehash = $1;
                my ($mfound, $mfixed) =
-                   getbuginfo("$db/$mergehash/$merge.log");
+                   getbuginfo("$gSpoolDir/$db/$mergehash/$merge.log");
                mergeinto($found_versions, $mfound);
                mergeinto($fixed_versions, $mfixed);
            }
        }
 
-       @$fixed_versions = () unless length $done;
+       @$fixed_versions = () unless length $status->{done};
 
-       for my $out ($bug, (split ' ', $mergedwith)) {
+       for my $out ($bug, (split ' ', $status->{mergedwith})) {
            $out =~ /(..)$/;
            my $outhash = $1;