From 166247271de11620df79c961a50b12c35a3ffcad Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 11 Apr 2018 16:30:20 -0700 Subject: [PATCH] use binary_to_source, package_maintainer instead of manual calls --- Debbugs/CGI/Pkgreport.pm | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Debbugs/CGI/Pkgreport.pm b/Debbugs/CGI/Pkgreport.pm index 060e980..20d0a79 100644 --- a/Debbugs/CGI/Pkgreport.pm +++ b/Debbugs/CGI/Pkgreport.pm @@ -81,6 +81,9 @@ sub generate_package_info{ }, bugs => {type => ARRAYREF, }, + schema => {type => OBJECT, + optional => 1, + }, }, ); @@ -91,19 +94,24 @@ 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, + exists $param{schema}?(schema => $param{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(maintainer => $maint); + package_links(maintainer => \@maint); print {$output} ".

\n"; } else { @@ -131,13 +139,6 @@ sub generate_package_info{ push @references, "to the ". "list of other pseudo-packages"; } - elsif (not defined $maint and not @{$param{bugs}}) { - # don't bother printing out this information, because it's - # already present above. - # print {$output} "

There is no record of the " . html_escape($package) . - # ($param{binary} ? " package" : " source package") . - # ", and no bugs have been filed against it.

"; - } else { if ($package and defined $config{package_pages} and length $config{package_pages}) { push @references, sprintf "to the %s package page", @@ -163,7 +164,7 @@ 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("$config{web_domain}/Reporting$config{html_suffix}"); -- 2.39.2