]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Packages.pm
* check for source definedness to forestall warning
[debbugs.git] / Debbugs / Packages.pm
index 0a16c04084dc0ca9125b994e7beda5545539023b..b4b5ef7411fa18e821a4c5244a2a246506e1249d 100644 (file)
@@ -223,8 +223,8 @@ sub binary_to_source{
        }
        # avoid autovivification
        my $bin = $_binarytosource{$binary};
+       next unless defined $bin;
        if (not @versions) {
-           next unless defined $bin;
            for my $ver (keys %{$bin}) {
                for my $ar (keys %{$bin->{$ver}}) {
                    my $src = $bin->{$ver}{$ar};
@@ -269,7 +269,7 @@ sub binary_to_source{
            tie %_sourcetobinary, MLDBM => $config{source_binary_map}, O_RDONLY or
                die "Unable top open $gSourceBinaryMap for reading";
        }
-       for my $maybe_sourcepkg (@binary) {
+       for my $maybe_sourcepkg (@binaries) {
            if (exists $_sourcetobinary{$maybe_sourcepkg}) {
                push @source,[$maybe_sourcepkg,$_] for keys %{$_sourcetobinary{$maybe_sourcepkg}};
            }
@@ -283,6 +283,9 @@ sub binary_to_source{
     if ($param{source_only}) {
        my %uniq;
        for my $s (@source) {
+           # we shouldn't need to do this, but do this temporarily to
+           # stop the warning.
+           next unless defined $s->[0];
            $uniq{$s->[0]} = 1;
        }
        @result = sort keys %uniq;
@@ -444,6 +447,10 @@ sub get_versions{
      }
      my %versions;
      for my $package (make_list($param{package})) {
+         my $source_only = 0;
+         if ($package =~ s/^src://) {
+              $source_only = 1;
+         }
          my $version = $versions->{$package};
          next unless defined $version;
          for my $dist (make_list($param{dist})) {
@@ -451,7 +458,7 @@ sub get_versions{
                             make_list($param{arch}):
                             (grep {not $param{no_source_arch} or
                                        $_ ne 'source'
-                                   } keys %{$version->{$dist}})) {
+                                   } $source_only?'source':keys %{$version->{$dist}})) {
                    next unless defined $version->{$dist}{$arch};
                    for my $ver (ref $version->{$dist}{$arch} ?
                                 keys %{$version->{$dist}{$arch}} :
@@ -611,7 +618,7 @@ sub make_source_versions {
                    }
                    my @srcinfo = binary_to_source(binary => $pkg,
                                                   version => $version,
-                                                  arch    => $arch);
+                                                  length($arch)?(arch    => $arch):());
                    if (not @srcinfo) {
                        # We don't have explicit information about the
                        # binary-to-source mapping for this version