X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FCGI%2FPkgreport.pm;h=da937e5516f0b11d0c5e30892aaccf578afa2222;hb=038f696edadcbcf8b26f54f4b919702c59e1b1d6;hp=51ebe42266119cdb0cc5ae9dfb8c4bb133319ed5;hpb=46fa42780ecb746d7bec2fb01190b05584b9283e;p=debbugs.git diff --git a/Debbugs/CGI/Pkgreport.pm b/Debbugs/CGI/Pkgreport.pm index 51ebe42..da937e5 100644 --- a/Debbugs/CGI/Pkgreport.pm +++ b/Debbugs/CGI/Pkgreport.pm @@ -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,9 @@ sub generate_package_info{ 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,17 +127,27 @@ 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"; } + 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 $gPackagePages) { + if ($package and defined $config{package_pages} and length $config{package_pages}) { push @references, sprintf "to the %s package page", - 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 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) { @@ -154,15 +162,10 @@ sub generate_package_info{ $references[$#references] = "or $references[$#references]" if @references > 1; print {$output} "

You might like to refer ", join(", ", @references), ".

\n"; } - if (defined $param{maint} || defined $param{maintenc}) { + if (defined $maint) { print {$output} "

If you find a bug not listed here, please\n"; printf {$output} "report it.

\n", - html_escape("http://${debbugs::gWebDomain}/Reporting${debbugs::gHTMLSuffix}"); - } - if (not $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("http://$config{web_domain}/Reporting$config{html_suffix}"); } return $output_scalar; } @@ -221,7 +224,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}; } } @@ -231,12 +234,15 @@ 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}; } } - - + my $days = bug_archiveable(bug => $status{id}, + status => \%status, + days_until => 1, + ); + $status{archive_days} = $days; return fill_in_template(template => 'cgi/short_bug_status', variables => {status => \%status, isstrongseverity => \&Debbugs::Status::isstrongseverity, @@ -248,121 +254,9 @@ sub short_bug_status_html { '&version_url' => \&Debbugs::CGI::version_url, '&secs_to_english' => \&Debbugs::Common::secs_to_english, '&strftime' => \&POSIX::strftime, + '&maybelink' => \&Debbugs::CGI::maybelink, }, ); - - my $result = ""; - - my $showseverity; - if ($status{severity} eq 'normal') { - $showseverity = ''; - } - elsif (isstrongseverity($status{severity})) { - $showseverity = "Severity: $status{severity};\n"; - } - else { - $showseverity = "Severity: $status{severity};\n"; - } - - $result .= package_links(package => $status{package}, - options => $param{options}, - ); - - my $showversions = ''; - if (@{$status{found_versions}}) { - my @found = @{$status{found_versions}}; - $showversions .= join ', ', map {s{/}{ }; html_escape($_)} @found; - } - if (@{$status{fixed_versions}}) { - $showversions .= '; ' if length $showversions; - $showversions .= 'fixed: '; - my @fixed = @{$status{fixed_versions}}; - $showversions .= join ', ', map {s{/}{ }; html_escape($_)} @fixed; - } - $result .= ' ($showversions)} if length $showversions; - $result .= ";\n"; - - $result .= $showseverity; - $result .= "Reported by: ".package_links(submitter=>$status{originator}, - class => "submitter", - ); - $result .= ";\nOwned by: " . package_links(owner => $status{owner}, - class => "submitter", - ) - if length $status{owner}; - $result .= ";\nTags: " - . html_escape(join(", ", sort(split(/\s+/, $status{tags})))) - . "" - if (length($status{tags})); - - $result .= (length($status{mergedwith})?";\nMerged with ":"") . - bug_links(bug => [split(/ /,$status{mergedwith})], - class => "submitter", - ); - $result .= (length($status{blockedby})?";\nBlocked by ":"") . - bug_links(bug => [split(/ /,$status{blockedby})], - class => "submitter", - ); - $result .= (length($status{blocks})?";\nBlocks ":"") . - bug_links(bug => [split(/ /,$status{blocks})], - class => "submitter", - ); - - if (length($status{done})) { - $result .= "
Done: " . html_escape($status{done}); - my $days = bug_archiveable(bug => $status{id}, - status => \%status, - days_until => 1, - ); - if ($days >= 0 and defined $status{location} and $status{location} ne 'archive') { - $result .= ";\nCan be archived" . ( $days == 0 ? " today" : $days == 1 ? " in $days day" : " in $days days" ) . ""; - } - elsif (defined $status{location} and $status{location} eq 'archived') { - $result .= ";\nArchived."; - } - } - - unless (length($status{done})) { - if (length($status{forwarded})) { - $result .= ";\nForwarded to " - . join(', ', - map {maybelink($_)} - split /\,\s+/,$status{forwarded} - ); - } - # Check the age of the logfile - my ($days_last,$eng_last) = secs_to_english(time - $status{log_modified}); - my ($days,$eng) = secs_to_english(time - $status{date}); - - if ($days >= 7) { - my $font = ""; - my $efont = ""; - $font = "em" if ($days > 30); - $font = "strong" if ($days > 60); - $efont = "" if ($font); - $font = "<$font>" if ($font); - - $result .= ";\n ${font}$eng old$efont"; - } - if ($days_last > 7) { - my $font = ""; - my $efont = ""; - $font = "em" if ($days_last > 30); - $font = "strong" if ($days_last > 60); - $efont = "" if ($font); - $font = "<$font>" if ($font); - - $result .= ";\n ${font}Modified $eng_last ago$efont"; - } - } - - $result .= "."; - - return $result; } @@ -403,6 +297,9 @@ sub pkg_htmlizebugs { options => {type => HASHREF, default => {}, }, + dist => {type => SCALAR, + optional => 1, + }, } ); my @bugs = @{$param{bugs}}; @@ -412,8 +309,6 @@ sub pkg_htmlizebugs { my $header = ''; my $footer = "

Summary

\n"; - my @dummy = ($gRemoveAge); #, @gSeverityList, @gSeverityDisplay); #, $gHTMLExpireNote); - if (@bugs == 0) { return "

No reports found!

\n"; } @@ -563,74 +458,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('', $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 ''; - 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 ''; - 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; @@ -642,19 +469,30 @@ sub get_bug_order_index { for my $el (@${order}) { $pos++; - my $match = 1; - for my $item (split /[+]/, $el) { - my ($f, $v) = split /=/, $item, 2; - next unless (defined $f and defined $v); - my $isokay = 0; - $isokay = 1 if (defined $status->{$f} and $v eq $status->{$f}); - $isokay = 1 if ($f eq "tag" && defined $tags{$v}); - unless ($isokay) { - $match = 0; - last; - } - } - if ($match) { + my $match = 0; + my $first_field = 1; # true if no previous fields have been + # checked + while ($el =~ /(?^|\+|,)(?[^=]+)=(?[^=,\+])/g) { + my ($j,$f,$v) = @+{qw(joiner field value)}; + if (not defined $j) { + $j = '+'; + } + if ($j eq '+' and $first_field) { + $match = 1; + } + my $isokay = 0; + $isokay = 1 if (defined $status->{$f} and $v eq $status->{$f}); + $isokay = 1 if ($f eq "tag" && defined $tags{$v}); + if ($j eq ',') { + $match ||= $isokay; + } else { + $match &&= $isokay; + } + $first_field = 0; + } + # if there is a match, or if there were no fields to check, + # this usertag matched. + if ($match || $first_field) { return $pos; last; } @@ -662,13 +500,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 {