From e045662b9a6f8f24055345e4388d7cfab77c27a3 Mon Sep 17 00:00:00 2001
From: gecko <>
Date: Mon, 20 Sep 1999 04:40:07 -0800
Subject: [PATCH] [project @ 1999-09-20 05:40:06 by gecko] Changes to make
archived bugs accessable. Changes to depersonalize the email (ie... from
$gProject $gBug Tracking System instead of from $gMaintainer)
---
cgi/bugreport.cgi | 11 ++++---
cgi/common.pl | 49 ++++++++++++++++++++--------
cgi/pkgreport.cgi | 71 +++++++++++++++++++++++++++++++++++++++++
debian/tmp.changelog | 25 +++++++++++++++
scripts/expire.in | 9 ++++--
scripts/html-control.in | 6 ++--
scripts/mailsummary.in | 4 +--
scripts/process.in | 17 ++++++++--
scripts/rebuild.in | 55 +++++++++++++++++++++++++++++++
scripts/service.in | 10 +++---
10 files changed, 223 insertions(+), 34 deletions(-)
create mode 100755 cgi/pkgreport.cgi
create mode 100644 debian/tmp.changelog
create mode 100755 scripts/rebuild.in
diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi
index b4191eac..584f1dbc 100755
--- a/cgi/bugreport.cgi
+++ b/cgi/bugreport.cgi
@@ -6,7 +6,7 @@ use strict;
use CGI qw/:standard/;
require '/usr/lib/debbugs/errorlib';
-require '/debian/home/ajt/ajbug/common.pl';
+require '/usr/lib/debbugs/common.pl';
require '/etc/debbugs/config';
require '/etc/debbugs/text';
@@ -17,7 +17,8 @@ my $tail_html;
my %maintainer = getmaintainers();
my $ref= param('bug') || die("No bug number");
-my %status = getbugstatus($ref);
+my $archive = (param('archive') || 'no') eq 'yes';
+my %status = getbugstatus($ref, $archive);
my $msg = param('msg') || "";
my $boring = (param('boring') || 'no') eq 'yes';
@@ -78,9 +79,9 @@ my ($short, $tmaint);
$short = $ref; $short =~ s/^\d+/#$&/;
$tmaint = defined($maintainer{$tpack}) ? $maintainer{$tpack} : '(unknown)';
$descriptivehead= $indexentry.$submitted.";\nMaintainer for $status{package} is\n".
- ''.&sani($tmaint).'.';
+ ''.&sani($tmaint).'.';
-my $buglog = buglog($ref);
+my $buglog = buglog($ref, $archive);
open L, "<$buglog" || &quit("open log for $ref: $!");
my $log='';
@@ -131,7 +132,7 @@ while(my $line = ) {
if $normstate eq 'go' || $normstate eq 'go-nox';
if ($normstate eq 'html') {
- $this .= " Full text available.";
+ $this .= " Full text available.";
}
my $show = 1;
diff --git a/cgi/common.pl b/cgi/common.pl
index aaf00ae9..b46f9e2b 100644
--- a/cgi/common.pl
+++ b/cgi/common.pl
@@ -11,8 +11,9 @@ sub quit {
sub htmlindexentry {
my $ref = shift;
+ my $archive = shift;
- my %status = getbugstatus($ref);
+ my %status = getbugstatus($ref, $archive );
my $result = "";
if ($status{severity} eq 'normal') {
@@ -23,9 +24,9 @@ sub htmlindexentry {
$showseverity = "Severity: $status{severity};\n";
}
- $result .= "Package: "
- . htmlsanit($status{package}) . ";\n"
- if (length($status{package}));
+ $result .= "Package: "
+ . htmlsanit($status{"package"}) . ";\n"
+ if (length($status{"package"}));
$result .= $showseverity;
$result .= "Reported by: " . htmlsanit($status{originator});
$result .= ";\nKeywords: " . htmlsanit($status{keywords})
@@ -97,7 +98,8 @@ sub bugurl {
my $ref = shift;
my $params = "bug=$ref";
foreach my $val (@_) {
- $params .= "\&msg=$1" if ($val =~ /^msg=([0-9]+)$/);
+ $params .= "\&msg=$1" if ($val =~ /^msg=([0-9]+)/);
+ $params .= "\&archive=yes" if ($val =~ /^archive=1/);
}
return $debbugs::gCGIDomain . "bugreport.cgi" . "?" . "$params";
@@ -111,7 +113,7 @@ sub packageurl {
sub allbugs {
my @bugs = ();
- opendir(D, $debbugs::gSpoolDir/db) || &quit("opendir db: $!");
+ opendir(D, "$debbugs::gSpoolDir/db") || &quit("opendir db: $!");
@bugs = sort { $a <=> $b }
grep s/\.status$//,
(grep m/^[0-9]+\.status$/,
@@ -123,13 +125,23 @@ sub allbugs {
sub pkgbugs {
my $pkg = shift;
- my @bugs = ();
- open I, "<$gAJIndex" || &quit("bugindex: $!");
- while() {
- push @bugs, $1 if (/^([0-9]+) $pkg$/);
+ open I, "<$debbugs::gSpoolDir/archive/index" || &quit("bugindex: $!");
+ while()
+ { if (/^$pkg\s+(\d+)\s+(.+)/)
+ {
+ my $tmpstr = sprintf( "%d: %s", $1, $2 );
+ $descstr{ $1 } = $tmpstr;
+ }
}
- @bugs = sort { $a <=> $b } @bugs;
- return @bugs;
+ return %descstr;
+}
+
+sub pkgbugsindex {
+ my $pkg = shift;
+ my @bugs = ();
+ open I, "<$debbugs::gSpoolDir/archive/index" || &quit("bugindex: $!");
+ while() { $descstr{ $1 } = 1 if (/^(\S+)/); }
+ return %descstr;
}
sub getmaintainers {
@@ -149,10 +161,15 @@ sub getmaintainers {
sub getbugstatus {
my $bugnum = shift;
+ my $archive = shift;
my %status;
- open(S,"$gSpoolDir/db/$bugnum.status") || &quit("open $bugnum.status: $!");
+ if ( $archive )
+ { my $archdir = $bugnum % 100;
+ open(S,"$gSpoolDir/archive/$archdir/$bugnum.status" ) || &quit("open $bugnum.status: $!");
+ } else
+ { open(S,"$gSpoolDir/db/$bugnum.status") || &quit("open $bugnum.status: $!"); }
my @lines = qw(originator date subject msgid package keywords done
forwarded mergedwith severity);
while() {
@@ -175,7 +192,11 @@ sub getbugstatus {
sub buglog {
my $bugnum = shift;
- return "$gSpoolDir/db/$bugnum.log";
+ my $archive = shift;
+ if ( $archive )
+ { my $archdir = $bugnum % 100;
+ return "$gSpoolDir/archive/$archdir/$bugnum.log";
+ } else { return "$gSpoolDir/db/$bugnum.log"; }
}
1
diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi
new file mode 100755
index 00000000..5526b7e8
--- /dev/null
+++ b/cgi/pkgreport.cgi
@@ -0,0 +1,71 @@
+#!/usr/bin/perl -w
+
+package debbugs;
+
+use strict;
+use CGI qw/:standard/;
+
+require '/usr/lib/debbugs/errorlib';
+require '/usr/lib/debbugs/common.pl';
+
+require '/etc/debbugs/config';
+require '/etc/debbugs/text';
+
+my $pkg = param('pkg');
+
+$pkg = 'ALL' unless defined( $pkg );
+
+my $repeatmerged = (param('repeatmerged') || 'yes') eq 'yes';
+my $this = "";
+
+my %indexentry;
+my %maintainer = ();
+my %strings = ();
+
+my %displayshowpending = ('pending','outstanding',
+ 'done','resolved',
+ 'forwarded','forwarded to upstream software authors');
+
+my $dtime=`date -u '+%H:%M:%S GMT %a %d %h'`;
+chomp($dtime);
+my $tail_html = $debbugs::gHTMLTail;
+$tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
+
+
+print header;
+print start_html("$debbugs::gProject Archived $debbugs::gBug report logs: package $pkg");
+print h1("$debbugs::gProject Archived $debbugs::gBug report logs: package $pkg");
+
+#if (defined $maintainer{$pkg}) {
+# print "Maintainer for $pkg is "
+# . htmlsanit($maintainer{$pkg}) . ".
\n";
+#}
+
+print "Note that with multi-binary packages there may be other reports\n";
+print "filed under the different binary package names.
\n";
+
+if ( $pkg ne 'ALL' )
+{ %strings = pkgbugs($pkg);
+ foreach my $bug ( keys %strings )
+ { $this .= " ". $strings{ $bug } ."\n"; }
+} else
+{ %strings = pkgbugsindex();
+ my @bugs = ();
+ foreach my $bug ( keys %strings ) { push @bugs, $bug; }
+ @bugs = sort { $a cmp $b } @bugs;
+ foreach my $bug ( @bugs )
+ { $this .= " ". $bug . "\n"; }
+}
+
+if ( length( $this ) )
+{ print "\n";
+ print $this;
+ print "
\n";
+} else
+{ print "No archived reports found\n"; }
+
+print hr;
+print "$tail_html";
+
+print end_html;
diff --git a/debian/tmp.changelog b/debian/tmp.changelog
new file mode 100644
index 00000000..3f613dbb
--- /dev/null
+++ b/debian/tmp.changelog
@@ -0,0 +1,25 @@
+This file is to document changes I've made until I change the version in
+the changelog file.
+
+* Fixed X-Project-CC header to specify additional addresses to send bug
+ info to. The header has been changed to X-Project-CC to make it
+ generic, too.
+
+* Cleaned service and processall scripts to be -w clean.
+
+* Added a column to the ./db/ix/summary.html that gives an indication of
+ the severity of the bug -- if set. For the moment, if the severity has
+ been set to "normal" we'll see "n". If severity wasn't set, there'd be
+ no letter. We might want to make "blank" to "n" or "n" to blank
+
+* Removed the case in package names so that netscap4 and Netscape4 are
+ the same package.
+
+* Added option archiving of bugs (move instead of remove). When
+ archived, the bugs will be left in /var/lib/debbugs/spool/archive.
+ Added the necessary CGI scripts to access the archived bugs.
+
+* Changed the message sent back to the developer (and to the
+ debian-bugs-closed list) to include the message used to close the bug.
+
+* Changed scripts to ignore mime and clearsigned pgp/gpg signed messages
diff --git a/scripts/expire.in b/scripts/expire.in
index 83378c34..ab45e5bc 100755
--- a/scripts/expire.in
+++ b/scripts/expire.in
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: expire.in,v 1.4 1999/09/16 07:16:47 gecko Exp $
+# $Id: expire.in,v 1.5 1999/09/20 05:40:07 gecko Exp $
# Load modules and set envirnment
require('/etc/debbugs/config');
@@ -30,7 +30,7 @@ grep(s/\.status$//,@list);
#process each bug (ie, status file)
while (length($ref=shift(@list)))
-{ print STDERR "$ref $considering\n" if $debug;
+{ print STDERR "$ref considering\n" if $debug;
$bfound= &lockreadbugmerge($ref);
print STDERR "$ref read $bfound\n" if $debug;
$bfound || next;
@@ -73,6 +73,11 @@ while (length($ref=shift(@list)))
copy( "db/$mref.log", "$dir/$mref.log" );
copy( "db/$mref.status", "$dir/$mref.status" );
copy( "db/$mref.report", "$dir/$mref.report" );
+ if ( open( IDXFILE, ">>archive/index" ) )
+ { printf IDXFILE "%s %d %s\n", $s_package, $mref, $s_subject;
+ close IDXFILE;
+ } else { print "Unable to write to index file\n"; }
+
print("archived $mref to $dir (from $ref)\n") || &quit("output old: $!");
}
unlink("db/$mref.log", "db/$mref.status", "db/$mref.report");
diff --git a/scripts/html-control.in b/scripts/html-control.in
index e30b396c..beb82d34 100755
--- a/scripts/html-control.in
+++ b/scripts/html-control.in
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: html-control.in,v 1.2 1999/09/02 22:27:29 gecko Exp $
+# $Id: html-control.in,v 1.3 1999/09/20 05:40:07 gecko Exp $
use POSIX;
@@ -53,7 +53,7 @@ $seqmid= $sequences; $seqmid =~ y/ /-/;
open(MM,">html-data.mail") or nonawful("open html-data.mail: $!");
if ( length( $gListDomain ) > 0 && length( $gMirrorList ) > 0 ) {
print(MM <
@@ -63,7 +63,7 @@ END
) or nonawful("write html-data.mail header: $!");
} else {
print(MM <
diff --git a/scripts/mailsummary.in b/scripts/mailsummary.in
index 4cf97b01..c6e65d9d 100755
--- a/scripts/mailsummary.in
+++ b/scripts/mailsummary.in
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: mailsummary.in,v 1.3 1999/09/14 22:33:48 gecko Exp $
+# $Id: mailsummary.in,v 1.4 1999/09/20 05:40:07 gecko Exp $
require( '/etc/debbugs/config' );
@@ -59,7 +59,7 @@ open(D, '| '.join(' ',('/usr/lib/sendmail','-f'.$gMaintainerEmail)).' -odi -oem
die "start sendmail: $!";
print D <$fn|$'|\n";
$fwd .= $fn.': '.$fv."\n";
$fn =~ y/A-Z/a-z/;
@@ -781,12 +781,23 @@ sub get_addresses {
sub sendmessage {
local ($msg,@recips) = @_;
if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); }
+
+ #save email to the log
open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lo): $!");
print(AP "\2\n",join("\4",@recips),"\n\5\n$msg\n\3\n") ||
&quit("writing db/$ref.log (lo): $!");
close(AP) || &quit("closing db/$ref.log (lo): $!");
- print DEBUG "mailing to >",join('|',@recips),"<\n";
+ #if debbuging.. save email to a log
+# open AP, ">>debug";
+# print AP join( '|', @recips )."\n>>";
+# print AP get_addresses( @recips );
+# print AP "<<\n".$msg;
+# print AP "\n--------------------------------------------------------\n";
+# close AP;
+
+ #start mailing
+ $msg =~ /^Subject: (.*)$/;
$SIG{'CHLD'}='chldhandle';
#print DEBUG "mailing sigchild set up<\n";
$chldexit = 'no';
diff --git a/scripts/rebuild.in b/scripts/rebuild.in
new file mode 100755
index 00000000..88e71a1c
--- /dev/null
+++ b/scripts/rebuild.in
@@ -0,0 +1,55 @@
+#!/usr/bin/perl -w
+# $Id: rebuild.in,v 1.1 1999/09/20 05:40:07 gecko Exp $
+
+# Load modules and set envirnment
+use File::Copy;
+require('/etc/debbugs/config');
+require('/usr/lib/debbugs/errorlib');
+$ENV{'PATH'}= '/usr/lib/debbugs'.$ENV{'PATH'};
+chdir("$gSpoolDir") || die "chdir spool: $!\n";
+
+sub readreport {
+ my $lref = shift;
+ my $path = shift;
+
+ open(S,"$path/$lref.status") || die "unable to open $path/$lref: $!\n";
+ chop($s_originator= );
+ chop($s_date= );
+ chop($s_subject= );
+ chop($s_msgid= );
+ chop($s_package= );
+ chop($s_keywords= );
+ chop($s_done= );
+ chop($s_forwarded= );
+ chop($s_mergedwith= );
+ chop($s_severity= );
+ close(S);
+ return 1;
+}
+
+#global variables
+$debug = 0;
+defined($startdate= time) || &quit("failed to get time: $!");
+
+open IDXFILE, ">archive/index" or &quit( "trying to reset index file: $!" );
+
+#get list of bugs (ie, status files)
+for ($subdir=0; $subdir<100; $subdir++ )
+{
+ my $path = sprintf( "archive/%.2d", $subdir );
+ opendir(DIR,$path) || next;
+ @list= grep(m/^\d+\.status$/,readdir(DIR));
+ closedir DIR;
+ grep(s/\.status$//,@list);
+ @list= sort { $a <=> $b } @list;
+
+ #process each bug (ie, status file)
+ while ( defined( $list[0] ))
+ { my $ref = shift @list;
+ print STDERR "$ref considering\n" if $debug;
+ readreport($ref, $path);
+ printf IDXFILE "%s %d %s\n", $s_package, $ref, $s_subject;
+ }
+}
+
+close IDXFILE;
diff --git a/scripts/service.in b/scripts/service.in
index bce816f0..9aae39be 100755
--- a/scripts/service.in
+++ b/scripts/service.in
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# $Id: service.in,v 1.7 1999/09/18 21:01:27 gecko Exp $
+# $Id: service.in,v 1.8 1999/09/20 05:40:07 gecko Exp $
#
# Usage: service .nn
# Temps: incoming/P.nn
@@ -229,7 +229,7 @@ END
0 ) { &addccaddress("$gDoneList\@$gListDomain"); }
$s_done= $replyto;
$message= <