X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=migrate%2Fdebbugs-makeversions;h=fd70f2dcfb6262a3f810effa1334555bc0a41fb1;hb=1b1562614656acf70e9b69c8eb736673f370c816;hp=67f3e152b8e9237925ff4e79c42fffb2acf76365;hpb=501eb7602c119a3e46110e11a12d53702667914d;p=debbugs.git diff --git a/migrate/debbugs-makeversions b/migrate/debbugs-makeversions index 67f3e15..fd70f2d 100755 --- a/migrate/debbugs-makeversions +++ b/migrate/debbugs-makeversions @@ -3,6 +3,12 @@ # guesswork, based on Version: pseudo-headers and closing mails that look # like Debian changelogs. The latter in particular is somewhat heuristic. +# <@aj> Hackin' on the BTS, Feelin' like it'll take forever; Oh you better +# hold it's hand, when it dies on names so clever. These are the best +# bugs of our life. It's up to archive-slash-69, man we were killin' +# time, we were young and resltess, we needed to unwind. I guess +# nothin' can last forever - forever, no... + my $config_path = '/etc/debbugs'; my $lib_path = '/usr/lib/debbugs'; @@ -12,9 +18,9 @@ require "$lib_path/errorlib"; use Debbugs::Log; use Debbugs::MIME; -if (@ARGV != 2) { +if (@ARGV != 1) { print <= - # (stat "$gSpoolDir/$db/$dir/$file")[9]; print "Processing $bug ...\n" if $ENV{DEBBUGS_VERBOSE}; - my $status = readbug($bug, $db); - next unless defined $status; + my ($locks, $status) = lockreadbugmerge($bug, $db); + unless (defined $status) { + unlockreadbugmerge($locks); + next; + } + + if (@{$status->{found_versions}} or @{$status->{fixed_versions}}) { + unlockreadbugmerge($locks); + next; + } + + my @merges = (); + # Only process the lowest of each set of merged bugs. + if (length $status->{mergedwith}) { + @merges = sort { $a <=> $b } split ' ', $status->{mergedwith}; + if ($merges[0] < $bug) { + unlockreadbugmerge($locks); + next; + } + } - my ($found_versions, $fixed_versions) = - getbuginfo("$gSpoolDir/$db/$dir/$file"); + my ($found_versions, $fixed_versions) = getbuginfo("$db/$dir/$file"); if (length $status->{mergedwith}) { - for my $merge (split ' ', $status->{mergedwith}) { + for my $merge (@merges) { $merge =~ /(..)$/; my $mergehash = $1; my ($mfound, $mfixed) = - getbuginfo("$gSpoolDir/$db/$mergehash/$merge.log"); + getbuginfo("$db/$mergehash/$merge.log"); mergeinto($found_versions, $mfound); mergeinto($fixed_versions, $mfixed); } @@ -180,20 +197,20 @@ while (defined(my $dir = readdir DB)) { @$fixed_versions = () unless length $status->{done}; - for my $out ($bug, (split ' ', $status->{mergedwith})) { - $out =~ /(..)$/; - my $outhash = $1; - - unless (-d "$verdb/$outhash") { - mkdir "$verdb/$outhash" or die "Can't mkdir $verdb/$outhash: $!"; + for my $out ($bug, @merges) { + if ($out != $bug) { + filelock("lock/$out"); + } + my $outstatus = readbug($out, $db); + $outstatus->{found_versions} = [@$found_versions]; + $outstatus->{fixed_versions} = [@$fixed_versions]; + writebug($out, $outstatus, $db, 2, 'disable bughook'); + if ($out != $bug) { + unfilelock(); } - - open VERSIONS, "> $verdb/$outhash/$out.versions" - or die "Can't open $verdb/$outhash/$out.versions: $!"; - print VERSIONS "Found-in: @$found_versions\n"; - print VERSIONS "Fixed-in: @$fixed_versions\n"; - close VERSIONS; } + + unlockreadbugmerge($locks); } closedir HASH;