\n";
-$indexentry .= htmlpackagelinks($status{package}, 0) . ";\n";
+# the log should almost always be newer, but just in case
+my $log_mtime = +(stat $buglog)[9] || time;
+my $status_mtime = +(stat $bug_status)[9] || time;
+my $mtime = strftime '%a, %d %b %Y %T GMT', gmtime(max($status_mtime,$log_mtime));
-foreach my $pkg (@tpacks) {
- my $tmaint = defined($maintainer{$pkg}) ? $maintainer{$pkg} : '(unknown)';
- my $tsrc = defined($pkgsrc{$pkg}) ? $pkgsrc{$pkg} : '(unknown)';
-
- $indexentry .=
- htmlmaintlinks(sub { $_[0] == 1 ? "Maintainer for $pkg is\n"
- : "Maintainers for $pkg are\n" },
- $tmaint);
- $indexentry .= ";\nSource for $pkg is\n".
- '$tsrc" if ($tsrc ne "(unknown)");
- $indexentry .= ".\n";
-}
-
-$indexentry .= " ";
-$indexentry .= htmladdresslinks("Reported by: ", \&submitterurl,
- $status{originator}) . ";\n";
-$indexentry .= sprintf "Date: %s.\n",
- (strftime "%a, %e %b %Y %T UTC", localtime($status{date}));
-
-$indexentry .= " Owned by: " . htmlsanit($status{owner}) . ".\n"
- if length $status{owner};
-
-$indexentry .= "
\n";
-
-my @descstates;
-
-$indexentry .= "
$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 (@{$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 @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});
- }
+if ($q->request_method() eq 'HEAD' and not defined($att) and not $mbox) {
+ print $q->header(-type => "text/html",
+ -charset => 'utf-8',
+ (length $mtime)?(-last_modified => $mtime):(),
+ );
+ exit 0;
}
-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});
- }
+for my $user (map {split /[\s*,\s*]+/} make_list($param{users}||[])) {
+ next unless length($user);
+ add_user($user,\%ut,\%bugusertags,\%seen_users);
}
-if ($buglog !~ m#^\Q$gSpoolDir/db#) {
- push @descstates, "Bug is archived. No further changes may be made";
+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;
+ }
}
-$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);
+ @records = read_log_records(logfh => $buglogfh,inner_file => 1);
};
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;
- $parser->tmp_to_core(1);
- $parser->output_to_core(1);
- # $parser->output_under("/tmp");
- my $entity = $parser->parse_data( $email);
- # TODO: make local subdir, clean it ourselves
- # the following does NOT delete the msg dirs in /tmp
- END { if ( $entity ) { $entity->purge; } if ( $parser ) { $parser->filer->purge; } }
- 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;
- $output .= 'Full text and rfc822 format available.';
-
- $output = "