\n"; - } - - if ($newstate eq 'html') { - $this = ''; - } - - if ($newstate eq 'kill-end') { - - my $show = 1; - $show = $boring - if ($suppressnext && $normstate ne 'html'); - - $show = ($xmessage == $msg) if ($msg); - - push @mails, $mail if ( $mbox && $mail ); - if ($show) { - my $downloadHtml = ''; - if ($mail) { - my $parser = new MIME::Parser; - $parser->tmp_to_core(1); - $parser->output_to_core(1); -# $parser->output_under("/tmp"); - my $entity = $parser->parse_data($mail); - # TODO: make local subdir, clean it outselves - # the following does NOT delete the msg dirs in /tmp - END { $entity->purge; $parser->filer->purge; } - my @attachments = (); - if ( $entity->is_multipart ) { - my @parts = $entity->parts_DFS; -# $this .= htmlsanit($entity->head->stringify); - my @keep = (); - foreach ( @parts ) { - my $head = $_->head; -# $head->mime_attr("content-transfer-encoding" => "8bit") -# if !$head->mime_attr("content-transfer-encoding"); - my ($disposition,$type) = ( - $head->mime_attr("content-disposition"), - lc $head->mime_attr("content-type") - ); - -#print STDERR "'$type' '$disposition'\n"; - if ($disposition && ( $disposition eq "attachment" || $disposition eq "inline" ) && $_->head->recommended_filename ) { - push @attachments, $_; - my $file = $_->head->recommended_filename; - $downloadHtml .= "View Attachment: $file\n"; - if ($msg && $att eq $#attachments) { - my $head = $_->head; - my $type; - chomp($type = $head->mime_attr("content-type")); - my $body = $_->stringify_body; - print "Content-Type: $type; name=$file\n\n"; - my $decoder = new MIME::Decoder($head->mime_encoding); - $decoder->decode(new IO::Scalar(\$body), \*STDOUT); - exit(0); - } - if ($type eq 'text/plain') { -# push @keep, $_; - } -# $this .= htmlsanit($_->head->stringify); - } else { -# $this .= htmlsanit($_->head->stringify); -# push @keep, $_; - } -# $this .= "\n" . htmlsanit($_->stringify_body); - } -# $entity->parts(\@keep) if (!$msg); - } - $this .= htmlsanit($entity->stringify); - } - $this = "$downloadHtml\n$this$downloadHtml" if $downloadHtml; - $downloadHtml = ''; - $this = "\n$this\n" - if $normstate eq 'go' || $normstate eq 'go-nox'; - $this = "$thisheader$this" if $thisheader && !( $normstate eq 'html' );; - $thisheader = ''; - if ($normstate eq 'html') { - $this .= " Full text available."; - } - if ($reverse) { - $log = "$this\n
$log"; - } else { - $log .= "$this\n
\n"; - } - } - - $xmessage++ if ($normstate ne 'html'); - - $suppressnext = $normstate eq 'html'; - } - - $normstate = $newstate; - $mail = ''; - next; - } - - $_ = $line; - if ($normstate eq 'incoming-recv') { - my $pl= $_; - $pl =~ s/\n+$//; - m/^Received: \(at (\S+)\) by (\S+)\;/ - || &quit("bad line \`$pl' in state incoming-recv"); - $thisheader = "Message received at ".htmlsanit("$1\@$2") - . ":
\n"; - $this = ''; - $normstate= 'go'; - $mail .= $_; - } elsif ($normstate eq 'html') { - $this .= $_; - } elsif ($normstate eq 'go') { - if ($mail) { - $mail .= $_; - } else { - $this .= htmlsanit($_); - } - } elsif ($normstate eq 'go-nox') { - next if !s/^X//; - if ($mail) { - $mail .= $_; - } else { - $this .= htmlsanit($_); - } - } elsif ($normstate eq 'recips') { - if (m/^-t$/) { - $this = "Message sent:
\n"; - } else { - s/\04/, /g; s/\n$//; - $this = "Message sent to ".htmlsanit($_).":
\n"; - } - $normstate= 'kill-body'; - } elsif ($normstate eq 'autocheck') { - next if !m/^X-Debian-Bugs(-\w+)?: This is an autoforward from (\S+)/; - $normstate= 'autowait'; - $this = "Message received at $2:
\n"; - } elsif ($normstate eq 'autowait') { - next if !m/^$/; - $normstate= 'go-nox'; - $this .= "\n"; - } else { - &quit("$ref state $normstate line \`$_'"); - } + +my @blockedby= make_list($status{blockedby}); +$status{blockedby_array} = []; +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}; + push @{$status{blockedby_array}},{bug_num => $b, subject => $s{subject}, status => \%s}; + } } -&quit("$ref state $normstate at end") unless $normstate eq 'kill-end'; -close(L); -if ( $mbox ) { - print "Content-Type: text/plain\n\n"; - foreach ( @mails ) { - my @lines = split( "\n", $_, -1 ); - if ( $lines[ 1 ] =~ m/^From / ) { - my $tmp = $lines[ 0 ]; - $lines[ 0 ] = $lines[ 1 ]; - $lines[ 1 ] = $tmp; - $_ = join( "\n", @lines ) . "\n"; - } - if ( !( $lines[ 0 ] =~ m/^From / ) ) { - $ENV{ PATH } = "/bin:/usr/bin:/usr/local/bin"; - my $date = `date "+%a %b %d %T %Y"`; - chomp $date; - $_ = "From unknown $date\n" . $_; - } - } - print join("", @mails ); - exit 0; +my @blocks= make_list($status{blocks}); +$status{blocks_array} = []; +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}; + push @{$status{blocks_array}}, {bug_num => $b, subject => $s{subject}, status => \%s}; + } } -print "Content-Type: text/html\n\n"; - -print "\n"; -print "\n" . - "$debbugs::gProject $debbugs::gBug report logs - $short \n" . - "\n" . - '' . - "\n"; -print "" . "$debbugs::gProject $debbugs::gBug report logs - $short" . - "
\n"; - -print "$descriptivehead\n"; -printf "
" . htmlsanit($status{subject}) . "View this report as an mbox folder.
", mboxurl($ref); -print "
"; -print "$log"; -print $tail_html; - -print "\n"; - -exit 0; + +if ($buglog !~ m#^\Q$gSpoolDir/db#) { + $status{archived} = 1; +} + +my $descriptivehead = $indexentry; + +print $q->header(-type => "text/html", + -charset => 'utf-8', + (length $mtime)?(-last_modified => $mtime):(), + ); + +print fill_in_template(template => 'cgi/bugreport', + variables => {status => \%status, + package => $packages_affects{'package'}, + affects => $packages_affects{'affects'}, + log => $log, + bug_num => $ref, + version_graph => $version_graph, + msg => $msg, + isstrongseverity => \&Debbugs::Status::isstrongseverity, + html_escape => \&Debbugs::CGI::html_escape, + looks_like_number => \&Scalar::Util::looks_like_number, + make_list => \&Debbugs::Common::make_list, + }, + hole_var => {'&package_links' => \&Debbugs::CGI::package_links, + '&bug_links' => \&Debbugs::CGI::bug_links, + '&version_url' => \&Debbugs::CGI::version_url, + '&bug_url' => \&Debbugs::CGI::bug_url, + '&strftime' => \&POSIX::strftime, + '&maybelink' => \&Debbugs::CGI::maybelink, + }, + );