# -*- perl -*-
-# $Id: errorlib.in,v 1.4 2001/07/15 09:46:16 doogie Exp $
+# $Id: errorlib.in,v 1.5 2001/08/19 02:09:18 doogie Exp $
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;
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>);
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): $!");
#!/usr/bin/perl
-# $Id: expire.in,v 1.7 2001/08/16 07:25:53 doogie Exp $
+# $Id: expire.in,v 1.8 2001/08/19 02:09:18 doogie Exp $
# Load modules and set envirnment
use File::Copy;
$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)))
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;}
{ 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: $!");
}
}
#!/usr/bin/perl
-# $Id: process.in,v 1.35 2001/08/16 07:11:04 doogie Exp $
+# $Id: process.in,v 1.36 2001/08/19 02:09:18 doogie Exp $
#
# Usage: process nn
# Temps: incoming/Pnn
}
$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.");
$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");
}
}
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 {
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 {
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";
#!/usr/bin/perl
-# $Id: service.in,v 1.41 2001/08/16 07:24:18 doogie Exp $
+# $Id: service.in,v 1.42 2001/08/19 02:09:18 doogie Exp $
# ^ more or less ^
#
# Usage: service <code>.nn
$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".
&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);
$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".
"$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".
#!/usr/bin/perl
-# $Id: summary.in,v 1.4 2001/08/16 17:37:01 doogie Exp $
+# $Id: summary.in,v 1.5 2001/08/19 02:09:18 doogie Exp $
$config_path = '/org/bugs.debian.org/etc';
$lib_path = '/org/bugs.debian.org/scripts';
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'
$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>);