X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FCGI%2FPkgreport.pm;h=01e661f30d987fff3cee189cab1803e6c1a4607d;hb=e09c4d3c9adb00e42d9af5daf9b1d5dd04264e6b;hp=beba95a89694f563b6085fccf20664d66ee9b800;hpb=f492418a6fe1653c67d9f26428da65f1b584cee6;p=debbugs.git diff --git a/Debbugs/CGI/Pkgreport.pm b/Debbugs/CGI/Pkgreport.pm index beba95a..01e661f 100644 --- a/Debbugs/CGI/Pkgreport.pm +++ b/Debbugs/CGI/Pkgreport.pm @@ -28,7 +28,7 @@ None known. use warnings; use strict; use vars qw($VERSION $DEBUG %EXPORT_TAGS @EXPORT_OK @EXPORT); -use base qw(Exporter); +use Exporter qw(import); use IO::Scalar; use Params::Validate qw(validate_with :types); @@ -41,6 +41,7 @@ use Debbugs::Bugs qw(bug_filter); use Debbugs::Packages qw(:mapping); use Debbugs::Text qw(:templates); +use Encode qw(decode_utf8); use POSIX qw(strftime); @@ -51,13 +52,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,12 +75,15 @@ sub generate_package_info{ spec => {binary => {type => BOOLEAN, default => 1, }, - package => {type => SCALAR|ARRAYREF, + package => {type => SCALAR,#|ARRAYREF, }, options => {type => HASHREF, }, bugs => {type => ARRAYREF, }, + schema => {type => OBJECT, + optional => 1, + }, }, ); @@ -94,23 +94,30 @@ sub generate_package_info{ my %pkgsrc = %{getpkgsrc()}; my $srcforpkg = $package; - if ($param{binary} and exists $pkgsrc{$package} - and defined $pkgsrc{$package}) { - $srcforpkg = $pkgsrc{$package}; + if ($param{binary}) { + $srcforpkg = + binary_to_source(source_only => 1, + scalar_only => 1, + binary => $package, + hash_slice(%param,qw(schema)), + ); } my $showpkg = html_escape($package); - my $maintainers = getmaintainers(); - my $maint = $maintainers->{$srcforpkg}; - if (defined $maint) { + my @maint = package_maintainer($param{binary}?'binary':'source', + $package + ); + if (@maint) { print {$output} '
'; - print {$output} (($maint =~ /,/)? "Maintainer for $showpkg is " + print {$output} (@maint > 1? "Maintainer for $showpkg is " : "Maintainers for $showpkg are ") . - package_links(maint => $maint); + package_links(maintainer => \@maint); print {$output} ".
\n"; } else { - print {$output} "No maintainer for $showpkg. Please do not report new bugs against this package.
\n"; + print {$output} "There is no maintainer for $showpkg. ". + "This means that this package no longer exists (or never existed). ". + "Please do not report new bugs against this package.
\n"; } my @pkgs = getsrcpkgs($srcforpkg); @pkgs = grep( !/^\Q$package\E$/, @pkgs ); @@ -129,18 +136,20 @@ sub generate_package_info{ my @references; my $pseudodesc = getpseudodesc(); if ($package and defined($pseudodesc) and exists($pseudodesc->{$package})) { - push @references, "to the ". + push @references, "to the ". "list of other pseudo-packages"; } else { if ($package and defined $config{package_pages} and length $config{package_pages}) { push @references, sprintf "to the %s package page", - html_escape("http://$config{package_pages}/$package"), html_escape("$package"); + html_escape("$config{package_pages}/$package"), html_escape("$package"); } - if (defined $config{subscription_domain} and - length $config{subscription_domain}) { + if (defined $config{package_tracking_domain} and + length $config{package_tracking_domain}) { my $ptslink = $param{binary} ? $srcforpkg : $package; - push @references, q(to the Package Tracking System); + # the pts only wants the source, and doesn't care about src: (#566089) + $ptslink =~ s/^src://; + push @references, q(to the Package Tracking System); } # Only output this if the source listing is non-trivial. if ($param{binary} and $srcforpkg) { @@ -155,17 +164,12 @@ sub generate_package_info{ $references[$#references] = "or $references[$#references]" if @references > 1; print {$output} "You might like to refer ", join(", ", @references), ".
\n"; } - if (defined $maint) { + if (@maint) { print {$output} "If you find a bug not listed here, please\n"; printf {$output} "report it.
\n", - html_escape("http://$config{web_domain}/Reporting$config{html_suffix}"); - } - if (not defined $maint and not @{$param{bugs}}) { - print {$output} "There is no record of the " . html_escape($package) . - ($param{binary} ? " package" : " source package") . - ", and no bugs have been filed against it.
"; + html_escape("$config{web_domain}/Reporting$config{html_suffix}"); } - return $output_scalar; + return decode_utf8($output_scalar); } @@ -222,7 +226,7 @@ sub short_bug_status_html { if (@blockedby && $status{"pending"} ne 'fixed' && ! length($status{done})) { for my $b (@blockedby) { 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{blockedby_array}},{bug_num => $b, subject => $s{subject}, status => \%s}; } } @@ -232,7 +236,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}; } } @@ -298,6 +302,9 @@ sub pkg_htmlizebugs { dist => {type => SCALAR, optional => 1, }, + schema => {type => OBJECT, + optional => 1, + }, } ); my @bugs = @{$param{bugs}}; @@ -307,8 +314,6 @@ sub pkg_htmlizebugs { my $header = ''; my $footer = "