Re: Upcoming debbugs modification, major change
On Fri, 17 Aug 2001, Anthony Towns wrote:
> On Thu, Aug 16, 2001 at 05:00:33AM -0500, Adam Heath wrote:
> > This Saturday, baring any real life circumstances, or someone objecting here,
> > I will turn off the debbugs cronjob(2) that processing incoming. I will then
> > go about converting the scripts to only support this new db/ layout. All
> > existing files will then be moved to the new directory, and testing of the new
> > code will begin.
>
> Uh. No. debbugs can't afford to go down while you try implementing and
> testing something brand new that's likely to be flakey. Least of all
> during a freeze when we're tring to fix bugs.
>
> Work on it seperately, get some code that works for you on your machine,
> then post it, then we'll talk.
I disabled processall for a bit, submitted a few emails, ran them 'by hand'
thru my new scripts, and all appeared well. The already modified cgi scripts
read the info from the new directory fine.
==
Index: errorlib.in
===================================================================
RCS file: /cvs/debbugs/source/scripts/errorlib.in,v
retrieving revision 1.4
diff -u -r1.4 errorlib.in
--- errorlib.in 2001/07/15 09:46:16 1.4
+++ errorlib.in 2001/08/18 22:27:31
@@ -4,6 +4,11 @@
sub F_SETLK { 6; } sub F_WRLCK{ 1; }
$flockstruct= 'sslll'; # And there ought to be something for this too.
+sub get_hashname {
+ return "" if ( $_[ 0 ] < 0 );
+ return sprintf "%02d", $_[ 0 ] % 100;
+}
+
sub unlockreadbugmerge {
local ($rv) = @_;
&unfilelock if $rv >= 2;
@@ -23,7 +28,7 @@
sub lockreadbug {
local ($lref) = @_;
&filelock("lock/$lref");
- if (!open(S,"db/$lref.status")) { &unfilelock; return 0; }
+ if (!open(S,"db-h/".get_hashname($lref)."/$lref.status")) { &unfilelock; return 0; }
chop($s_originator= <S>);
chop($s_date= <S>);
chop($s_subject= <S>);
@@ -109,7 +114,7 @@
if (!open(AP,">>$file")) {
print DEBUG "failed open log<\n";
print DEBUG "failed open log err $!<\n";
- &quit("opening db/$ref.log (li): $!");
+ &quit("opening $file (appendfile): $!");
}
print(AP @_) || &quit("writing $file (appendfile): $!");
close(AP) || &quit("closing $file (appendfile): $!");
Index: expire.in
===================================================================
RCS file: /cvs/debbugs/source/scripts/expire.in,v
retrieving revision 1.7
diff -u -r1.7 expire.in
--- expire.in 2001/08/16 07:25:53 1.7
+++ expire.in 2001/08/18 22:27:31
@@ -17,21 +17,15 @@
$debug = 0;
defined($startdate= time) || &quit("failed to get time: $!");
-sub get_archivename
-{ my $bugnum = shift;
- my $archivename = "";
-
-# while( $bugnum > 99 ) { $bugnum = int $bugnum/10; }
- $bugnum = $bugnum % 100;
- $archivename = sprintf "%02d", $bugnum;
- return $archivename;
-}
-
#get list of bugs (ie, status files)
-opendir(DIR,"db") || &quit("opendir db: $!\n");
-@list= grep(m/^\d+\.status$/,readdir(DIR));
-grep(s/\.status$//,@list);
-@list= sort { $a <=> $b } @list;
+opendir(DIR,"db-h") || &quit("opendir db: $!\n");
+@dirs = sort { $a <=> $b } grep(s,^,db-h/,, grep(m/^\d+$/,readdir(DIR)));
+close(DIR);
+foreach my $dir (@dirs) {
+ opendir(DIR,$dir);
+ push @list, sort { $a <=> $b } grep(s/\.status$//,grep(m/^\d+\.status$/,readdir(DIR)));
+ close(DIR);
+}
#process each bug (ie, status file)
while (length($ref=shift(@list)))
@@ -61,7 +55,7 @@
print "$ref $mref merge-ok\n" if $debug;
length($s_done) || die "$ref -> $mref";
print "$ref $mref done-ok\n" if $debug;
- $days= -M "db/$mref.log";
+ $days= -M "db-h/".get_hashname($mref)."/$mref.log";
print "ref $mref days $days\n" if $debug;
if ($days <= $gRemoveAge)
{ print "$ref $mref saved\n" if $debug; $oktoremove= 0;}
@@ -70,22 +64,21 @@
{ print "$ref removing\n" if $debug;
for $mref (@aref)
{ print "$ref removing $mref\n" if $debug;
+ my $dir = get_hashname($mref);
if ( $gSaveOldBugs )
{
- my $dir;
- $dir = "archive/" . get_archivename $mref;
- `mkdir -p "$dir"`;
- 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" ) )
+ `mkdir -p "archive2/$dir"`;
+ copy( "db-h/$dir/$mref.log", "archive2/$dir/$mref.log" );
+ copy( "db-h/$dir/$mref.status", "archive2/$dir/$mref.status" );
+ copy( "db-h/$dir/$mref.report", "archive2/$dir/$mref.report" );
+ if ( open( IDXFILE, ">>archive2/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: $!");
+ print("archived $mref to archive2/$dir (from $ref)\n") || &quit("output old: $!");
}
- unlink("db/$mref.log", "db/$mref.status", "db/$mref.report");
+ unlink("db-h/$dir/$mref.log", "db-h/$dir/$mref.status", "db-h/$dir/$mref.report");
print("deleted $mref (from $ref)\n") || &quit("output old: $!");
}
}
Index: process.in
===================================================================
RCS file: /cvs/debbugs/source/scripts/process.in,v
retrieving revision 1.35
diff -u -r1.35 process.in
--- process.in 2001/08/16 07:11:04 1.35
+++ process.in 2001/08/18 22:27:32
@@ -7,9 +7,10 @@
use Mail::Address;
$config_path = '/org/bugs.debian.org/etc';
$lib_path = '/org/bugs.debian.org/scripts';
+$lib_path = '/debian/home/doogie/debbugs/debbugs/scripts';
require "$config_path/config";
-require "$lib_path/errorlib";
+require "$lib_path/errorlib.in";
$ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
chdir( "$gSpoolDir" ) || die 'chdir spool: $!\n';
@@ -267,13 +268,14 @@
}
$s_done= $set_done if defined($set_done);
$s_forwarded= $set_forwarded if defined($set_forwarded);
- &overwrite("db/$ref.status",
+ my $hash = get_hashname($ref);
+ &overwrite("db-h/$hash/$ref.status",
"$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
"$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
&bughook('change',$ref,
"$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
"$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
- open(O,"db/$ref.report") || &quit("read original report: $!");
+ open(O,"db-h/$hash/$ref.report") || &quit("read original report: $!");
$x= join('',<O>); close(O);
if ($codeletter eq 'F')
{ &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded.");
@@ -481,14 +483,15 @@
$ref= $v+0; $v += 1; $newref=1;
&overwrite('nextnumber', "$v\n");
&unfilelock;
- &overwrite("db/$ref.log",'');
- &overwrite("db/$ref.status",
+ my $hash = get_hashname($ref);
+ &overwrite("db-h/$hash/$ref.log",'');
+ &overwrite("db-h/$hash/$ref.status",
"$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
"$s_package\n$s_keywords\n\n\n\n$s_severity\n");
&bughook('new',$ref,
"$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
"$s_package\n$s_keywords\n\n\n\n$s_severity\n");
- &overwrite("db/$ref.report",
+ &overwrite("db-h/$hash/$ref.report",
join("\n",@msg)."\n");
}
@@ -768,13 +771,14 @@
}
sub appendlog {
- if (!open(AP,">>db/$ref.log")) {
+ my $hash = get_hashname($ref);
+ if (!open(AP,">>db-h/$hash/$ref.log")) {
print DEBUG "failed open log<\n";
print DEBUG "failed open log err $!<\n";
- &quit("opening db/$ref.log (li): $!");
+ &quit("opening db-h/$hash/$ref.log (li): $!");
}
- print(AP "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log (li): $!");
- close(AP) || &quit("closing db/$ref.log (li): $!");
+ print(AP "\7\n",@log,"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
+ close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!");
}
sub finish {
@@ -791,13 +795,14 @@
sub htmllog {
local ($whatobj,$whatverb,$where,$desc) = @_;
- open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lh): $!");
+ my $hash = get_hashname($ref);
+ open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lh): $!");
print(AP
"\6\n".
"<strong>$whatobj $whatverb</strong> to <code>".&sani($where).
"</code>:<br>\n". $desc.
- "\n\3\n") || &quit("writing db/$ref.log (lh): $!");
- close(AP) || &quit("closing db/$ref.log (lh): $!");
+ "\n\3\n") || &quit("writing db-h/$hash/$ref.log (lh): $!");
+ close(AP) || &quit("closing db-h/$hash/$ref.log (lh): $!");
}
sub get_addresses {
@@ -811,11 +816,12 @@
local ($msg,@recips) = @_;
if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); }
+ my $hash = get_hashname($ref);
#save email to the log
- open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lo): $!");
+ open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$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): $!");
+ &quit("writing db-h/$hash/$ref.log (lo): $!");
+ close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!");
#if debbuging.. save email to a log
# open AP, ">>debug";
Index: service.in
===================================================================
RCS file: /cvs/debbugs/source/scripts/service.in,v
retrieving revision 1.41
diff -u -r1.41 service.in
--- service.in 2001/08/16 07:24:18 1.41
+++ service.in 2001/08/18 22:27:32
@@ -8,15 +8,16 @@
use Mail::Address;
$config_path = '/org/bugs.debian.org/etc';
$lib_path = '/org/bugs.debian.org/scripts';
+$lib_path = '/debian/home/doogie/debbugs/debbugs/scripts';
require "$config_path/config";
-require "$lib_path/errorlib";
+require "$lib_path/errorlib.in";
$ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
chdir("$gSpoolDir") || die "chdir spool: $!\n";
-# open(DEBUG,">&4");
-open DEBUG, ">/dev/null";
+ open(DEBUG,">/tmp/debbugs.debug");
+#open DEBUG, ">/dev/null";
$debug = 0;
umask(002);
@@ -580,7 +581,7 @@
$repliedshow= join(', ',$replyto,@maintccaddrs);
&filelock("lock/-1");
-open(AP,">>db/-1.log") || &quit("open db/-1.log: $!");
+open(AP,">>db-h/-1.log") || &quit("open db-h/-1.log: $!");
print(AP
"\2\n$repliedshow\n\5\n$reply\n\3\n".
"\6\n".
@@ -588,10 +589,10 @@
&sani($header{'from'})."</code>\n".
"to <code>".&sani($controlrequestaddr)."</code>\n".
"\3\n".
- "\7\n",@log,"\n\3\n") || &quit("writing db/-1.log: $!");
-close(AP) || &quit("open db/-1.log: $!");
+ "\7\n",@log,"\n\3\n") || &quit("writing db-h/-1.log: $!");
+close(AP) || &quit("open db-h/-1.log: $!");
&unfilelock;
-utime(time,time,"db");
+utime(time,time,"db-h");
&sendmailmessage($reply,$replyto,@maintccaddrs);
@@ -787,16 +788,17 @@
$lowstate eq 'open' || die "$lowstate ?";
length($action) || die;
$ref == $sref || die "read $sref but saving $ref ?";
- open(L,">>db/$ref.log") || &quit("opening db/$ref.log: $!");
+ my $hash = get_hashname($ref);
+ open(L,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log: $!");
print(L
"\6\n".
"<strong>".&sani($action)."</strong>\n".
"Request was from <code>".&sani($header{'from'})."</code>\n".
"to <code>".&sani($controlrequestaddr)."</code>. \n".
"\3\n".
- "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log: $!");
- close(L) || &quit("closing db/$ref.log: $!");
- open(S,">db/$ref.status.new") || &quit("opening db/$ref.status.new: $!");
+ "\7\n",@log,"\n\3\n") || &quit("writing db-h/$hash/$ref.log: $!");
+ close(L) || &quit("closing db-h/$hash/$ref.log: $!");
+ open(S,">db-h/$hash/$ref.status.new") || &quit("opening db-h/$hash/$ref.status.new: $!");
print(S
"$s_originator\n".
"$s_date\n".
@@ -807,10 +809,10 @@
"$s_done\n".
"$s_forwarded\n".
"$s_mergedwith\n".
- "$s_severity\n") || &quit("writing db/$ref.status.new: $!");
- close(S) || &quit("closing db/$ref.status.new: $!");
- rename("db/$ref.status.new","db/$ref.status") ||
- &quit("installing new db/$ref.status: $!");
+ "$s_severity\n") || &quit("writing db-h/$hash/$ref.status.new: $!");
+ close(S) || &quit("closing db-h/$hash/$ref.status.new: $!");
+ rename("db-h/$hash/$ref.status.new","db-h/$hash/$ref.status") ||
+ &quit("installing new db-h/$hash/$ref.status: $!");
&bughook('change',$ref,
"$s_originator\n".
"$s_date\n".
Index: summary.in
===================================================================
RCS file: /cvs/debbugs/source/scripts/summary.in,v
retrieving revision 1.4
diff -u -r1.4 summary.in
--- summary.in 2001/08/16 17:37:01 1.4
+++ summary.in 2001/08/18 22:27:32
@@ -34,10 +34,14 @@
defined($startdate= time) || &quit("failed to get time: $!");
-opendir(DIR,"db") || &quit("opendir db: $!\n");
-@list= grep(m/^\d+\.status$/,readdir(DIR));
-grep(s/\.status$//,@list);
-@list= sort { $a <=> $b } @list;
+opendir(DIR,"db-h") || &quit("opendir db: $!\n");
+@dirs = sort { $a <=> $b } grep(s,^,db-h/,, grep(m/^\d+$/,readdir(DIR)));
+close(DIR);
+foreach my $dir (@dirs) {
+ opendir(DIR,$dir);
+ push @list, sort { $a <=> $b } grep(s/\.status$//,grep(m/^\d+\.status$/,readdir(DIR)));
+ close(DIR);
+}
$head= $mode eq 'bymaint'
? ' Package Ref Subject'
@@ -45,8 +49,7 @@
$amonths=-1;
while (length($f=shift(@list))) {
- &filelock("lock/$f");
- if (!open(S,"db/$f.status")) { &unlinklock; next; }
+ if (!lockreadbug($f)) { next; }
chop($s_originator= <S>);
chop($s_date= <S>);
chop($s_subject= <S>);
==
>
> Cheers,
> aj
>
> --
> Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
> I don't speak for anyone save myself. GPG signed mail preferred.
>
> ``_Any_ increase in interface difficulty, in exchange for a benefit you
> do not understand, cannot perceive, or don't care about, is too much.''
> -- John S. Novak, III (The Humblest Man on the Net)
>
Reply to: