# 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;
}
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 =~ /(..)$/;
# 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;