]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/CGI/Pkgreport.pm
Fix links to PTS pages for src packages (closes: #566089). Thanks to
[debbugs.git] / Debbugs / CGI / Pkgreport.pm
index 085b31ea321ee8d7397f78154b55cbcd3fc4e393..d047affb1d262827d204552b3fc4c52ece4e9b63 100644 (file)
@@ -51,13 +51,9 @@ BEGIN{
 
      @EXPORT = ();
      %EXPORT_TAGS = (html => [qw(short_bug_status_html pkg_htmlizebugs),
-                             qw(pkg_javascript),
-                             qw(pkg_htmlselectyesno pkg_htmlselectsuite),
-                             qw(buglinklist pkg_htmlselectarch)
                             ],
-                    misc => [qw(generate_package_info make_order_list),
-                             qw(myurl),
-                             qw(get_bug_order_index determine_ordering),
+                    misc => [qw(generate_package_info),
+                             qw(determine_ordering),
                             ],
                    );
      @EXPORT_OK = (qw());
@@ -78,7 +74,7 @@ sub generate_package_info{
                               spec  => {binary => {type => BOOLEAN,
                                                    default => 1,
                                                   },
-                                        package => {type => SCALAR|ARRAYREF,
+                                        package => {type => SCALAR,#|ARRAYREF,
                                                    },
                                         options => {type => HASHREF,
                                                    },
@@ -110,7 +106,8 @@ sub generate_package_info{
          print {$output} ".</p>\n";
      }
      else {
-         print {$output} "<p>No maintainer for $showpkg. Please do not report new bugs against this package.</p>\n";
+         print {$output} "<p>There is no maintainer for $showpkg. ".
+              "Please do not report new bugs against this package.</p>\n";
      }
      my @pkgs = getsrcpkgs($srcforpkg);
      @pkgs = grep( !/^\Q$package\E$/, @pkgs );
@@ -129,17 +126,25 @@ sub generate_package_info{
      my @references;
      my $pseudodesc = getpseudodesc();
      if ($package and defined($pseudodesc) and exists($pseudodesc->{$package})) {
-         push @references, "to the <a href=\"http://${debbugs::gWebDomain}/pseudo-packages${debbugs::gHTMLSuffix}\">".
+         push @references, "to the <a href=\"http://$config{web_domain}/pseudo-packages$config{html_suffix}\">".
               "list of other pseudo-packages</a>";
      }
+     elsif (not defined $maint and not @{$param{bugs}}) {
+         print {$output} "<p>There is no record of the " . html_escape($package) .
+              ($param{binary} ? " package" : " source package") .
+                   ", and no bugs have been filed against it.</p>";
+     }
      else {
-         if ($package and defined $gPackagePages) {
+         if ($package and defined $config{package_pages} and length $config{package_pages}) {
               push @references, sprintf "to the <a href=\"%s\">%s package page</a>",
-                   html_escape("http://${gPackagePages}/$package"), html_escape("$package");
+                   html_escape("http://$config{package_pages}/$package"), html_escape("$package");
          }
-         if (defined $gSubscriptionDomain) {
+         if (defined $config{subscription_domain} and
+             length $config{subscription_domain}) {
               my $ptslink = $param{binary} ? $srcforpkg : $package;
-              push @references, q(to the <a href="http://).html_escape("$gSubscriptionDomain/$ptslink").q(">Package Tracking System</a>);
+              # the pts only wants the source, and doesn't care about src: (#566089)
+              $ptslink =~ s/^src://;
+              push @references, q(to the <a href="http://).html_escape("$config{subscription_domain}/$ptslink").q(">Package Tracking System</a>);
          }
          # Only output this if the source listing is non-trivial.
          if ($param{binary} and $srcforpkg) {
@@ -154,15 +159,10 @@ sub generate_package_info{
          $references[$#references] = "or $references[$#references]" if @references > 1;
          print {$output} "<p>You might like to refer ", join(", ", @references), ".</p>\n";
      }
-     if (defined $param{maint} || defined $param{maintenc}) {
+     if (defined $maint) {
          print {$output} "<p>If you find a bug not listed here, please\n";
          printf {$output} "<a href=\"%s\">report it</a>.</p>\n",
-              html_escape("http://${debbugs::gWebDomain}/Reporting${debbugs::gHTMLSuffix}");
-     }
-     if (not $maint and not @{$param{bugs}}) {
-         print {$output} "<p>There is no record of the " . html_escape($package) .
-              ($param{binary} ? " package" : " source package") .
-                   ", and no bugs have been filed against it.</p>";
+              html_escape("http://$config{web_domain}/Reporting$config{html_suffix}");
      }
      return $output_scalar;
 }
@@ -231,7 +231,7 @@ sub short_bug_status_html {
      if (@blocks && $status{"pending"} ne 'fixed' && ! length($status{done})) {
          for my $b (@blocks) {
               my %s = %{get_bug_status($b)};
-              next if $s{"pending"} eq 'fixed' || length $s{done};
+              next if (defined $s{pending} and $s{pending} eq 'fixed') or (defined $s{done} and length $s{done});
               push @{$status{blocks_array}}, {bug_num => $b, subject => $s{subject}, status => \%s};
          }
      }
@@ -306,8 +306,6 @@ sub pkg_htmlizebugs {
      my $header = '';
      my $footer = "<h2 class=\"outstanding\">Summary</h2>\n";
 
-     my @dummy = ($gRemoveAge); #, @gSeverityList, @gSeverityDisplay);  #, $gHTMLExpireNote);
-
      if (@bugs == 0) {
          return "<HR><H2>No reports found!</H2></HR>\n";
      }
@@ -457,74 +455,6 @@ sub pkg_htmlizebugs {
      return $result;
 }
 
-sub pkg_javascript {
-     return fill_in_template(template=>'cgi/pkgreport_javascript',
-                           );
-}
-
-sub pkg_htmlselectyesno {
-     my ($name, $n, $y, $default) = @_;
-     return sprintf('<select name="%s"><option value=no%s>%s</option><option value=yes%s>%s</option></select>', $name, ($default ? "" : " selected"), $n, ($default ? " selected" : ""), $y);
-}
-
-sub pkg_htmlselectsuite {
-     my $id = sprintf "b_%d_%d_%d", $_[0], $_[1], $_[2];
-     my @suites = ("stable", "testing", "unstable", "experimental");
-     my %suiteaka = ("stable", "etch", "testing", "lenny", "unstable", "sid");
-     my $defaultsuite = "unstable";
-
-     my $result = sprintf '<select name=dist id="%s">', $id;
-     for my $s (@suites) {
-         $result .= sprintf '<option value="%s"%s>%s%s</option>',
-              $s, ($defaultsuite eq $s ? " selected" : ""),
-                   $s, (defined $suiteaka{$s} ? " (" . $suiteaka{$s} . ")" : "");
-     }
-     $result .= '</select>';
-     return $result;
-}
-
-sub pkg_htmlselectarch {
-     my $id = sprintf "b_%d_%d_%d", $_[0], $_[1], $_[2];
-     my @arches = qw(alpha amd64 arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc);
-
-     my $result = sprintf '<select name=arch id="%s">', $id;
-     $result .= '<option value="any">any architecture</option>';
-     for my $a (@arches) {
-         $result .= sprintf '<option value="%s">%s</option>', $a, $a;
-     }
-     $result .= '</select>';
-     return $result;
-}
-
-sub myurl {
-     my %param = @_;
-     return html_escape(pkg_url(map {exists $param{$_}?($_,$param{$_}):()}
-                               qw(archive repeatmerged mindays maxdays),
-                               qw(version dist arch package src tag maint submitter)
-                              )
-                      );
-}
-
-sub make_order_list {
-     my $vfull = shift;
-     my @x = ();
-
-     if ($vfull =~ m/^([^:]+):(.*)$/) {
-         my $v = $1;
-         for my $vv (split /,/, $2) {
-              push @x, "$v=$vv";
-         }
-     }
-     else {
-         for my $v (split /,/, $vfull) {
-              next unless $v =~ m/.=./;
-              push @x, $v;
-         }
-     }
-     push @x, "";              # catch all
-     return @x;
-}
-
 sub get_bug_order_index {
      my $order = shift;
      my $status = shift;
@@ -556,13 +486,6 @@ sub get_bug_order_index {
      return $pos + 1;
 }
 
-sub buglinklist {
-     my ($prefix, $infix, @els) = @_;
-     return '' if not @els;
-     return $prefix . bug_linklist($infix,'submitter',@els);
-}
-
-
 # sets: my @names; my @prior; my @title; my @order;
 
 sub determine_ordering {