From ada2d48936ad4eebf5d62b8723993f14008751b5 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sat, 31 Jul 2010 17:07:24 -0400 Subject: [PATCH] * Use binary_to_source in process * Use write_log_records in process --- scripts/process | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/process b/scripts/process index b8efcc5..0dbb3b2 100755 --- a/scripts/process +++ b/scripts/process @@ -21,7 +21,7 @@ use Debbugs::Status qw(writebug isstrongseverity lockreadbugmerge lockreadbug re use Debbugs::CGI qw(html_escape bug_url); -use Debbugs::Log qw(:misc); +use Debbugs::Log qw(:misc :write); use Debbugs::Text qw(:templates); @@ -265,8 +265,7 @@ if (defined $pheader{source}) { $source_package = $pheader{source}; } elsif (defined $data->{package} or defined $pheader{package}) { - my $pkg_src = getpkgsrc(); - $source_package = $pkg_src->{defined $data->{package}?$data->{package}:$pheader{package}}; + $source_package = binary_to_source(binary => $data->{package} // $pheader{package}); } $source_pr_header = "X-$gProject-PR-Source: $source_package\n" if defined $source_package and length $source_package; @@ -301,7 +300,7 @@ if ($codeletter eq 'D' || $codeletter eq 'F') push @generalcc, "$gForwardList\@$gListDomain"; $generalcc= "$gForwardList\@$gListDomain"; } else { - $generalcc=''; + $generalcc=''; } } else { # Done if (defined $data->{done} and length($data->{done}) and @@ -512,6 +511,9 @@ if ($ref<0) { # new bug report $data->{package} = 'src:'.$pheader{source}; } elsif (defined $pheader{package}) { $data->{package} = $pheader{package}; + if ($data->{package} =~ /^src:(.+)/) { + $pheader{source} = $1; + } } elsif (defined $config{default_package}) { $data->{package} = $config{default_package}, } @@ -997,12 +999,14 @@ sub sendmessage { my $hash = get_hashname($ref); #save email to the log - open(AP,">>db-h/$hash/$ref.log") || die "opening db-h/$hash/$ref.log (lo): $!"; - print(AP "\2\n",join("\4",@$recips),"\n\5\n", - escape_log(stripbccs($msg)),"\n\3\n") || - die "writing db-h/$hash/$ref.log (lo): $!"; - close(AP) || die "closing db-h/$hash/$ref.log (lo): $!"; - + my $logfh = IO::File->new("db-h/${hash}/${ref}.log",'w') or + die "opening db-h/$hash/${ref}.log: $!"; + write_log_records(logfh => $logfh, + records => {text => stripbccs($msg), + type => 'recips', + recips => [@{$recips}], + }, + ); if (ref($bcc)) { shift @$recips if $recips->[0] eq '-t'; push @$recips, @$bcc; -- 2.39.5