$showseverity";
-$indexentry .= sprintf "Tags: %s;\n",
- htmlsanit(join(", ", sort(split(/\s+/, $status{tags}))))
- if length($status{tags});
-$indexentry .= " " if (length($showseverity) or length($status{tags}));
-
-my @merged= split(/ /,$status{mergedwith});
-if (@merged) {
- my $descmerged = 'Merged with ';
- my $mseparator = '';
- for my $m (@merged) {
- $descmerged .= $mseparator."#$m";
- $mseparator= ",\n";
- }
- push @descstates, $descmerged;
+if (defined $param{usertag}) {
+ for my $usertag (make_list($param{usertag})) {
+ my %select_ut = ();
+ my ($u, $t) = split /:/, $usertag, 2;
+ Debbugs::User::read_usertags(\%select_ut, $u);
+ unless (defined $t && $t ne "") {
+ $t = join(",", keys(%select_ut));
+ }
+ add_user($u,\%ut,\%bugusertags,\%seen_users);
+ push @{$param{tag}}, split /,/, $t;
+ }
}
-if (@{$status{found_versions}}) {
- my $foundtext = 'Found in ';
- $foundtext .= (@{$status{found_versions}} == 1) ? 'version ' : 'versions ';
- $foundtext .= join ', ', map htmlsanit($_), @{$status{found_versions}};
- push @descstates, $foundtext;
-}
-if (@{$status{fixed_versions}}) {
- my $fixedtext = 'Fixed in ';
- $fixedtext .= (@{$status{fixed_versions}} == 1) ? 'version ' : 'versions ';
- $fixedtext .= join ', ', map htmlsanit($_), @{$status{fixed_versions}};
- if (length($status{done})) {
- $fixedtext .= ' by ' . htmlsanit(decode_rfc1522($status{done}));
- }
- push @descstates, $fixedtext;
-} elsif (length($status{done})) {
- push @descstates, "Done: ".htmlsanit(decode_rfc1522($status{done}));
-} elsif (length($status{forwarded})) {
- push @descstates, "Forwarded to ".maybelink($status{forwarded});
-}
+my $trim_headers = ($param{trim} || ((defined $msg and $msg)?'no':'yes')) eq 'yes';
+my $mbox_status_message = $param{mboxstat} eq 'yes';
+my $mbox_maint = $param{mboxmaint} eq 'yes';
+$mbox = 1 if $mbox_status_message or $mbox_maint;
-my @blockedby= split(/ /, $status{blockedby});
-if (@blockedby && $status{"pending"} ne 'fixed' && ! length($status{done})) {
- for my $b (@blockedby) {
- my %s = %{getbugstatus($b)};
- next if $s{"pending"} eq 'fixed' || length $s{done};
- push @descstates, "Fix blocked by #$b: ".htmlsanit($s{subject});
- }
-}
-my @blocks= split(/ /, $status{blocks});
-if (@blocks && $status{"pending"} ne 'fixed' && ! length($status{done})) {
- for my $b (@blocks) {
- my %s = %{getbugstatus($b)};
- next if $s{"pending"} eq 'fixed' || length $s{done};
- push @descstates, "Blocking fix for #$b: ".htmlsanit($s{subject});
- }
-}
-
-if ($buglog !~ m#^\Q$gSpoolDir/db#) {
- push @descstates, "Bug is archived. No further changes may be made";
-}
+# Not used by this script directly, but fetch these so that pkgurl() and
+# friends can propagate them correctly.
+my $archive = $param{'archive'} eq 'yes';
+my $repeatmerged = $param{'repeatmerged'} eq 'yes';
-$indexentry .= join(";\n ", @descstates) . ".\n" if @descstates;
-$indexentry .= "
\n";
-my $descriptivehead = $indexentry;
my $buglogfh;
if ($buglog =~ m/\.gz$/) {
my $oldpath = $ENV{'PATH'};
$ENV{'PATH'} = '/bin:/usr/bin';
- $buglogfh = new IO::File "zcat $buglog |" or &quitcgi("open log for $ref: $!");
+ $buglogfh = IO::File->new("zcat $buglog |") or quitcgi("open log for $ref: $!");
$ENV{'PATH'} = $oldpath;
} else {
- $buglogfh = new IO::File "<$buglog" or &quitcgi("open log for $ref: $!");
+ $buglogfh = IO::File->new($buglog,'r') or quitcgi("open log for $ref: $!");
}
+my %status =
+ %{split_status_fields(get_bug_status(bug=>$ref,
+ bugusertags => \%bugusertags,
+ ))};
+
my @records;
eval{
@records = read_log_records($buglogfh);
};
if ($@) {
- quitcgi("Bad bug log for $debbugs::gBug $ref. Unable to read records: $@");
+ quitcgi("Bad bug log for $gBug $ref. Unable to read records: $@");
}
undef $buglogfh;
-=head2 handle_email_message
-
- handle_email_message($record->{text},
- ref => $bug_number,
- msg_number => $msg_number,
- );
-
-Returns a decoded e-mail message and displays entities/attachments as
-appropriate.
-
-
-=cut
-
-sub handle_email_message{
- my ($email,%options) = @_;
-
- my $output = '';
- my $parser = new MIME::Parser;
- # Because we are using memory, not tempfiles, there's no need to
- # clean up here like in Debbugs::MIME
- $parser->tmp_to_core(1);
- $parser->output_to_core(1);
- my $entity = $parser->parse_data( $email);
- my @attachments = ();
- display_entity($entity, $options{ref}, 1, $options{msg_number}, $output, @attachments);
- return $output;
-
-}
-
-=head2 bug_links
-
- bug_links($one_bug);
- bug_links($starting_bug,$stoping_bugs,);
-
-Creates a set of links to bugs, starting with bug number
-$starting_bug, and finishing with $stoping_bug; if only one bug is
-passed, makes a link to only a single bug.
-
-The content of the link is the bug number.
-
-=cut
-
-sub bug_links{
- my ($start,$stop,$query_arguments) = @_;
- $stop = $stop || $start;
- $query_arguments ||= '';
- my @output;
- for my $bug ($start..$stop) {
- push @output,'$bug);
- }
- return join(', ',@output);
-}
-
-=head2 handle_record
-
- push @log, handle_record($record,$ref,$msg_num);
-
-Deals with a record in a bug log as returned by
-L; returns the log information that
-should be output to the browser.
-
-=cut
-
-sub handle_record{
- my ($record,$bug_number,$msg_number,$seen_msg_ids) = @_;
-
- my $output = '';
- local $_ = $record->{type};
- if (/html/) {
- $output .= decode_rfc1522($record->{text});
- # Link to forwarded http:// urls in the midst of the report
- # (even though these links already exist at the top)
- $output =~ s,((?:ftp|http|https)://[\S~-]+?/?)([\)\'\:\.\,]?(?:\s|\.<|$)),$1$2,go;
- # Add links to the cloned bugs
- $output =~ s{(Bug )(\d+)( cloned as bugs? )(\d+)(?:\-(\d+)|)}{$1.bug_links($2).$3.bug_links($4,$5)}eo;
- # Add links to merged bugs
- $output =~ s{(?<=Merged )([\d\s]+)(?=\.)}{join(' ',map {bug_links($_)} (split /\s+/, $1))}eo;
- # Add links to blocked bugs
- $output =~ s{(?<=Blocking bugs)(?:(of )(\d+))?( (?:added|set to|removed):\s+)([\d\s]+)}
- {(defined $2?$1.bug_links($2):'').$3.
- join(' ',map {bug_links($_)} (split /\s+/, $4))}eo;
- # Add links to reassigned packages
- $output =~ s{(Bug reassigned from package \`)([^\']+)(' to \`)([^\']+)(')}
- {$1.q($2).$3.q($4).$5}eo;
- $output .= 'Full text and rfc822 format available.';
-
- $output = qq(