]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Packages.pm
* check for source definedness to forestall warning
[debbugs.git] / Debbugs / Packages.pm
index 482938da9310a672ddf36dc37fce57768789f64f..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};
@@ -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}} :