From: cjwatson <> Date: Sun, 24 Jul 2005 23:11:22 +0000 (-0800) Subject: [project @ 2005-07-24 16:11:22 by cjwatson] X-Git-Tag: release/2.6.0~688 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=75b133aa2ed28461048b6414fd1344f62bb1c2eb;p=debbugs.git [project @ 2005-07-24 16:11:22 by cjwatson] Move $gPackageSource fallback from binarytosource() to makesourceversions(), so that it's possible for applications to detect the "nothing known about this version" condition. --- diff --git a/Debbugs/Packages.pm b/Debbugs/Packages.pm index f4b209e..5dabd95 100644 --- a/Debbugs/Packages.pm +++ b/Debbugs/Packages.pm @@ -150,13 +150,8 @@ sub binarytosource { } # No $gBinarySourceMap, or it didn't have an entry for this name and - # version. Try $gPackageSource (unversioned) instead. - my $pkgsrc = getpkgsrc(); - if (exists $pkgsrc->{$binname}) { - return [$pkgsrc->{$binname}, $binver]; - } else { - return (); - } + # version. + return (); } =item sourcetobinary diff --git a/cgi/common.pl b/cgi/common.pl index c57bcf9..b02bed4 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -833,7 +833,20 @@ sub makesourceversions { $sourceversions{$version} = 1; } else { my @srcinfo = binarytosource($pkg, $version, $arch); - next unless @srcinfo; + unless (@srcinfo) { + # We don't have explicit information about the + # binary-to-source mapping for this version (yet). Since + # this is a CGI script and our output is transient, we can + # get away with just looking in the unversioned map; if it's + # wrong (as it will be when binary and source package + # versions differ), too bad. + my $pkgsrc = getpkgsrc(); + if (exists $pkgsrc->{$pkg}) { + @srcinfo = ([$pkgsrc->{$pkg}, $version]); + } else { + next; + } + } $sourceversions{"$_->[0]/$_->[1]"} = 1 foreach @srcinfo; } }