X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=migrate%2Fdebbugs-makeversions;h=fd70f2dcfb6262a3f810effa1334555bc0a41fb1;hb=867420593c939cf9585bd42f558778ad598076b9;hp=234d0fdb6c3f47ad5c4819df106dea28e49a8de9;hpb=d6adb0abe1288c3950bc7db8b92c816de4b77431;p=debbugs.git diff --git a/migrate/debbugs-makeversions b/migrate/debbugs-makeversions index 234d0fd..fd70f2d 100755 --- a/migrate/debbugs-makeversions +++ b/migrate/debbugs-makeversions @@ -3,13 +3,24 @@ # guesswork, based on Version: pseudo-headers and closing mails that look # like Debian changelogs. The latter in particular is somewhat heuristic. -use strict; +# <@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'; + +require "$config_path/config"; +require "$lib_path/errorlib"; + use Debbugs::Log; use Debbugs::MIME; -if (@ARGV != 2) { +if (@ARGV != 1) { print <= - # (stat "$db/$dir/$file")[9]; print "Processing $bug ...\n" if $ENV{DEBBUGS_VERBOSE}; - open STATUS, "$db/$dir/$bug.status" or next; - for 1 .. 6; # done is field 7 - chomp (my $done = ); - ; # mergedwith is field 9 - chomp (my $mergedwith = ); - close 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("$db/$dir/$file"); - if (length $mergedwith) { - for my $merge (split ' ', $mergedwith) { + if (length $status->{mergedwith}) { + for my $merge (@merges) { $merge =~ /(..)$/; my $mergehash = $1; my ($mfound, $mfixed) = @@ -173,22 +195,22 @@ while (defined(my $dir = readdir DB)) { } } - @$fixed_versions = () unless length $done; + @$fixed_versions = () unless length $status->{done}; - for my $out ($bug, (split ' ', $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;