From: Don Armstrong Date: Sat, 20 May 2006 06:13:37 +0000 (-0700) Subject: * Add X-Debbugs-PR-Source: message X-Git-Tag: release/2.6.0~610^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2ec7c74e6c36c4be112f3411632145e59d09ded4;p=debbugs.git * Add X-Debbugs-PR-Source: message * General code cleanup in process.in (more lexicals, on the way to use warnings; use strict;) * Remove useless reverse in service.in (use -1 instead of (reverse @array)[0]) --- diff --git a/debian/changelog b/debian/changelog index 82343c59..30164c27 100644 --- a/debian/changelog +++ b/debian/changelog @@ -112,6 +112,8 @@ debbugs (2.4.2) UNRELEASED; urgency=low - Use create_mime_message to send all of the mails which may contain UTF8 material. (closes: #364026) - Add links to Closes: text for closed bugs. (closes: #320986) + - Add X-$gProject-PR-Source: line (closes: #219230) + -- Colin Watson Fri, 20 Jun 2003 18:57:25 +0100 diff --git a/scripts/process.in b/scripts/process.in index aed34230..c6a58d74 100755 --- a/scripts/process.in +++ b/scripts/process.in @@ -11,9 +11,14 @@ tzset(); use MIME::Parser; use Debbugs::MIME qw(decode_rfc1522 create_mime_message); use Debbugs::Mail qw(send_mail_message encode_headers); +use Debbugs::Packages qw(getpkgsrc); -$config_path = '/etc/debbugs'; -$lib_path = '/usr/lib/debbugs'; +my $config_path = '/etc/debbugs'; +my $lib_path = '/usr/lib/debbugs'; + +# TODO DLA; needs config reworking and errorlib reworking +# use warnings; +# use strict; require "$config_path/config"; require "$lib_path/errorlib"; @@ -25,13 +30,13 @@ chdir( "$gSpoolDir" ) || die "chdir spool: $!\n"; umask(002); open DEBUG, ">/dev/null"; -defined( $intdate= time ) || &quit( "failed to get time: $!" ); +my $intdate = time or quit("failed to get time: $!"); $_=shift; -m/^([BMQFDUL])(\d*)\.\d+$/ || &quit("bad argument"); -$codeletter= $1; -$tryref= length($2) ? $2+0 : -1; -$nn= $_; +m/^([BMQFDUL])(\d*)\.\d+$/ or quit("bad argument: $_"); +my $codeletter= $1; +my $tryref= length($2) ? $2 : -1; +my $nn= $_; if (!rename("incoming/G$nn","incoming/P$nn")) { @@ -39,7 +44,7 @@ if (!rename("incoming/G$nn","incoming/P$nn")) &quit("renaming to lock: $!"); } -$baddress= 'submit' if $codeletter eq 'B'; +my $baddress= 'submit' if $codeletter eq 'B'; $baddress= 'maintonly' if $codeletter eq 'M'; $baddress= 'quiet' if $codeletter eq 'Q'; $baddress= 'forwarded' if $codeletter eq 'F'; @@ -47,20 +52,20 @@ $baddress= 'done' if $codeletter eq 'D'; $baddress= 'submitter' if $codeletter eq 'U'; bug_list_forward($nn) if $codeletter eq 'L'; $baddress || &quit("bad codeletter $codeletter"); -$baddressroot= $baddress; +my $baddressroot= $baddress; $baddress= "$tryref-$baddress" if $tryref>=0; open(M,"incoming/P$nn"); -@log=; +my @log=; close(M); -@msg=@log; +my @msg = @log; chomp @msg; print DEBUG "###\n",join("##\n",@msg),"\n###\n"; -$tdate = strftime "%a, %d %h %Y %T UTC", localtime; -$fwd= <output_under("$gSpoolDir/mime.tmp"); my $entity = eval { $parser->parse_data(join('',@log)) }; +my $i; if ($entity and $entity->head->tags) { @headerlines = @{$entity->head->header}; chomp @headerlines; @@ -163,7 +169,7 @@ if (defined $header{'resent-from'} && !defined $header{'from'}) { } defined($header{'from'}) || &quit("no From header"); -$replyto = $header{'reply-to'}; +my $replyto = $header{'reply-to'}; $replyto = '' unless defined $replyto; $replyto =~ s/^ +//; $replyto =~ s/ +$//; @@ -171,11 +177,7 @@ unless (length $replyto) { $replyto = $header{'from'}; } -$_= $replyto; -$_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/; -$replytocompare= $_; -print DEBUG "replytocompare >$replytocompare<\n"; - +my $subject = '(no subject)'; if (!defined($header{'subject'})) { $brokenness.= <{package}) { + my $pkg_src = getpkgsrc(); + $source_package = $pkg_src->{$data->{package}}; +} +$source_pr_header = "X-$gProject-Pr-Source: $source_package\n" + if length $source_package; + +# Done and Forwarded Bugs if ($codeletter eq 'D' || $codeletter eq 'F') { if ($replyto =~ m/$gBounceFroms/o || @@ -263,7 +276,7 @@ if ($codeletter eq 'D' || $codeletter eq 'F') $markedby= $header{'from'} eq $replyto ? $replyto : "$header{'from'} (reply to $replyto)"; my @generalcc; - if ($codeletter eq 'F') { + if ($codeletter eq 'F') { # Forwarded (&appendlog,&finish) if length($data->{forwarded}); $receivedat= "forwarded\@$gEmailDomain"; $markaswhat= 'forwarded'; @@ -274,7 +287,7 @@ if ($codeletter eq 'D' || $codeletter eq 'F') } else { $generalcc=''; } - } else { + } else { # Done if (length($data->{done}) and not defined $pheader{'source-version'} and not defined $pheader{'version'}) { @@ -346,7 +359,6 @@ END $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs)); $noticeccval =~ s/\s+\n\s+/ /g; $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//; - if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; } @process= ($ref,split(/ /,$data->{mergedwith})); $orgref= $ref; @@ -395,7 +407,9 @@ END Precedence => 'bulk', "X-$gProject-PR-Message" => "forwarded $ref", "X-$gProject-PR-Package" => $data->{package}, - "X-$gProject-PR-Keywords" => $data->{keywords} + "X-$gProject-PR-Keywords" => $data->{keywords}, + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), ],< 'bulk', "X-$gProject-PR-Message" => "closed $ref", "X-$gProject-PR-Package" => $data->{package}, - "X-$gProject-PR-Keywords" => $data->{keywords} + "X-$gProject-PR-Keywords" => $data->{keywords}, + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), ],< "they-closed $ref", "X-$gProject-PR-Package" => "$data->{package}", "X-$gProject-PR-Keywords" => "$data->{keywords}", + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), "Reply-To" => "$ref\@$gEmailDomain", "Content-Type" => 'text/plain; charset="utf-8"', ],<{package} X-$gProject-PR-Keywords: $data->{keywords} -$fwd +${source_pr_header}$fwd END -} elsif ($codeletter eq 'B') { +} elsif ($codeletter eq 'B') { # Sent to submit &htmllog($newref ? "Report" : "Information", "forwarded", join(', ',"$gSubmitList\@$gListDomain",@resentccs), "$gBug#$ref". @@ -735,9 +753,9 @@ Resent-Sender: $gMaintainerEmail X-$gProject-PR-Message: report $ref X-$gProject-PR-Package: $data->{package} X-$gProject-PR-Keywords: $data->{keywords} -$fwd +${source_pr_header}$fwd END -} elsif (@resentccs or @bccs) { +} elsif (@resentccs or @bccs) { # Quiet or Maintainer # D and F done far earlier; B just done - so this must be M or Q # We preserve whichever it was in the Reply-To (possibly adding # the $gBug#). @@ -765,7 +783,7 @@ Resent-Sender: $gMaintainerEmail X-$gProject-PR-Message: report $ref X-$gProject-PR-Package: $data->{package} X-$gProject-PR-Keywords: $data->{keywords} -$fwd +${source_pr_header}$fwd END } @@ -794,6 +812,8 @@ unless (exists $header{'x-debbugs-no-ack'}) { "X-$gProject-PR-Message" => "ack-quiet $ref", "X-$gProject-PR-Package" => $data->{package}, "X-$gProject-PR-Keywords" => $data->{keywords}, + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), "Reply-To" => "$ref-quiet\@$gEmailDomain", ],< "$gMaintainerEmail", From => "$gMaintainerEmail ($gProject $gBug Tracking System)", @@ -827,6 +847,8 @@ END "X-$gProject-PR-Message" => "ack-maintonly $ref", "X-$gProject-PR-Package" => $data->{package}, "X-$gProject-PR-Keywords" => $data->{keywords}, + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), "Reply-To" => "$ref-maintonly\@$gEmailDomain", ],< "ack $ref", "X-$gProject-PR-Package" => $data->{package}, "X-$gProject-PR-Keywords" => $data->{keywords}, + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), "Reply-To" => "$ref\@$gEmailDomain", ],< "ack-info-quiet $ref", "X-$gProject-PR-Package" => $data->{package}, "X-$gProject-PR-Keywords" => $data->{keywords}, + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), "Reply-To" => "$ref-maintonly\@$gEmailDomain", ],< "ack-info $ref", "X-$gProject-PR-Package" => $data->{package}, "X-$gProject-PR-Keywords" => $data->{keywords}, + # Only have a X-$gProject-PR-Source when we know the source package + length($source_package)?("X-$gProject-PR-Source" => $source_package):(), "Reply-To" => "$ref\@$gEmailDomain", ],< $recips); } +my $maintainerschecked = 0; sub checkmaintainers { return if $maintainerschecked++; return if !length($data->{package}); diff --git a/scripts/service.in b/scripts/service.in index 71d5cd41..f4695047 100755 --- a/scripts/service.in +++ b/scripts/service.in @@ -513,8 +513,7 @@ END # equates to the most recent fixing of the bug, or when # a versionless found command is received. if (defined $version) { - my $lastfixed = - (reverse @{$data->{fixed_versions}})[0]; + my $lastfixed = $data->{fixed_versions}[-1]; # TODO: what if $data->{package} is a source package? addfoundversions($data, $data->{package}, $version, 'binary'); if (defined $lastfixed and not grep { $_ eq $lastfixed } @{$data->{fixed_versions}}) {