]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2005-07-24 16:11:22 by cjwatson]
authorcjwatson <>
Sun, 24 Jul 2005 23:11:22 +0000 (15:11 -0800)
committercjwatson <>
Sun, 24 Jul 2005 23:11:22 +0000 (15:11 -0800)
Move $gPackageSource fallback from binarytosource() to
makesourceversions(), so that it's possible for applications to detect the
"nothing known about this version" condition.

Debbugs/Packages.pm
cgi/common.pl

index f4b209ecbf7a91e7f6b2c59d7b82a5b518140659..5dabd9558c98b07abb998040148ef711df6f6b4e 100644 (file)
@@ -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
index c57bcf97d20eafed0b9d14f81fc5a7b2c46abdd9..b02bed43d1c79bc4272561c98df47d238542327c 100644 (file)
@@ -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;
         }
     }