From 438b04eabe93a6307a2cf3567c481c2dc4b5dab7 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 9 Jun 2008 08:48:51 -0700 Subject: [PATCH] * finish deprecating quit by replacing it with die --- scripts/db2html | 52 +++++++++++++++++++-------------------- scripts/html-control | 20 +++++++-------- scripts/process | 58 ++++++++++++++++++++++---------------------- scripts/rebuild | 4 +-- scripts/summary | 20 +++++++-------- 5 files changed, 77 insertions(+), 77 deletions(-) diff --git a/scripts/db2html b/scripts/db2html index b45d2b9..f39ea98 100755 --- a/scripts/db2html +++ b/scripts/db2html @@ -42,7 +42,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) elsif ($ARGV[0] =~ m/^-lastrun\=([0-9.]+)$/) { $lastrun= $1; undef $stampfile; } elsif ($ARGV[0] =~ m/^-full$/) { undef $lastrun; undef $stampfile; } elsif ($ARGV[0] =~ m/^-stampfile\=(\S+)$/) { $stampfile= $1; } - else { &quit("bad usage"); } + else { die "bad usage"; } shift; } @@ -51,7 +51,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) $wwwbase= shift(@ARGV); #get starting time -defined($startdate= time) || &quit("failed to get time: $!"); +defined($startdate= time) || die "failed to get time: $!"; $|=1; @@ -76,9 +76,9 @@ if (defined($lastrun) && -M "db-h" > $lastrun) } #parse maintainer file -open(MM,"$gMaintainerFile") || &quit("open $gMaintainerFile: $!"); +open(MM,"$gMaintainerFile") || die "open $gMaintainerFile: $!"; while() -{ m/^(\S+)\s+(\S.*\S)\s*$/ || &quit("$gMaintainerFile: \`$_'"); +{ m/^(\S+)\s+(\S.*\S)\s*$/ || die "$gMaintainerFile: \`$_'"; ($a,$b)=($1,$2); $a =~ y/A-Z/a-z/; $maintainer{$a}= $b; @@ -86,7 +86,7 @@ while() close(MM); #load all database files -opendir(D,'db-h') || &quit("opendir db-h: $!"); +opendir(D,'db-h') || die "opendir db-h: $!"; @dirs = grep(s#^#db-h/#,grep(/^\d+$/,readdir(D))); closedir(D); foreach my $dir (@dirs) { @@ -99,7 +99,7 @@ foreach my $dir (@dirs) { for $pending (qw(pending done forwarded)) { for $severity (@showseverities) { eval "\$index${pending}${severity}= \$iiindex${pending}${severity}= ''; 1;" - or &quit("reset \$index${pending}${severity}: $@"); + or die "reset \$index${pending}${severity}: $@"; } } @@ -233,24 +233,24 @@ for $f (@files) $indexadd .= "" if defined($iiref); $indexadd .= "\n"; $estr= "\$index$indexpart = \$indexadd.\$index$indexpart; 1;"; - eval($estr) || &quit("eval add to \$index$indexpart ($estr) failed: $@"); + eval($estr) || die "eval add to \$index$indexpart ($estr) failed: $@"; #print STDERR ">$estr|$indexadd<\n"; $indexadd= "\n" if defined($iiref); eval("\$iiindex$indexpart = \$indexadd.\$iiindex$indexpart; 1;") || - &quit("eval add to \$iiindex$indexpart failed: $@"); + die "eval add to \$iiindex$indexpart failed: $@"; if (defined($tmaint)) { $countpermaint{$tmaint} += length($data->{done}) ? 0 : length($data->{forwarded}) ? 0 : 1; eval("\$permaint${indexpart}{\$tmaint} .= \$indexadd; 1;") || - &quit("eval add to \$permaint${indexpart}{\$tmaint} failed: $@"); + die "eval add to \$permaint${indexpart}{\$tmaint} failed: $@"; } if (defined($tpack)) { $countperpack{$tpack} += length($data->{done}) ? 0 : length($data->{forwarded}) ? 0 : 1; eval("\$perpack${indexpart}{\$tpack} .= \$indexadd; 1;") || - &quit("eval add to \$perpack${indexpart}{\$tpack} failed: $@"); + die "eval add to \$perpack${indexpart}{\$tpack} failed: $@"; } if ($preserveonly) { &preserve("$linkto.html"); &preserve("$linkto-b.html"); &unfilelock; next; } my $hash = get_hashname($ref); - open(L,"db-h/$hash/$ref.log") || &quit("open db-h/$hash/$ref.log: $!"); + open(L,"db-h/$hash/$ref.log") || die "open db-h/$hash/$ref.log: $!"; $log=''; $boring=''; $xmessage= 0; $normstate= 'kill-init'; @@ -258,19 +258,19 @@ for $f (@files) while() { if (m/^\07$/) { $normstate eq 'kill-init' || $normstate eq 'kill-end' || - &quit("$ref ^G in state $normstate"); + die "$ref ^G in state $normstate"; $normstate= 'incoming-recv'; } elsif (m/^\01$/) { $normstate eq 'kill-init' || $normstate eq 'kill-end' || - &quit("$ref ^A in state $normstate"); + die "$ref ^A in state $normstate"; $normstate= 'autocheck'; } elsif (m/^\02$/) { $normstate eq 'kill-init' || $normstate eq 'kill-end' || - &quit("$ref ^B in state $normstate"); + die "$ref ^B in state $normstate"; $normstate= 'recips'; } elsif (m/^\03$/) { $normstate eq 'go' || $normstate eq 'go-nox' || $normstate eq 'html' || - &quit("$ref ^C in state $normstate"); + die "$ref ^C in state $normstate"; $this .= "\n" if $normstate eq 'go' || $normstate eq 'go-nox'; if ($normstate eq 'html') { $xmessage++; @@ -286,17 +286,17 @@ for $f (@files) $suppressnext= $normstate eq 'html'; $normstate= 'kill-end'; } elsif (m/^\05$/) { - $normstate eq 'kill-body' || &quit("^E in state $normstate"); + $normstate eq 'kill-body' || die "^E in state $normstate"; $this .= "
\n";
             $normstate= 'go';
         } elsif (m/^\06$/) {
             $normstate eq 'kill-init' || $normstate eq 'kill-end' ||
-                &quit("$ref ^F in state $normstate");
+                die "$ref ^F in state $normstate";
             $normstate= 'html'; $this= '';
         } elsif ($normstate eq 'incoming-recv') {
             $pl= $_; $pl =~ s/\n+$//;
             m/^Received: \(at (\S+)\) by (\S+)\;/ ||
-                &quit("bad line \`$pl' in state incoming-recv");
+                die "bad line \`$pl' in state incoming-recv";
             $this = "

Message received at ".&sani("$1\@$2").":


\n". "
\n".
                     "$_";
@@ -326,10 +326,10 @@ for $f (@files)
             $normstate= 'go-nox';
             $this .= "
\n";
         } else {
-            &quit("$ref state $normstate line \`$_'");
+            die "$ref state $normstate line \`$_'";
         }
     }
-    &quit("$ref state $normstate at end") unless $normstate eq 'kill-end';
+    die "$ref state $normstate at end" unless $normstate eq 'kill-end';
     close(L);
     if (length($boring)) {
         &file("$linkto-b.html",'non',
@@ -415,7 +415,7 @@ sub makeindex ($$$) {
             $estr= "\$value= \\${varprefix}${pending}${severity}${varsuffix}; 1;";
 #print STDERR $estr;
             eval $estr
-                or &quit("eval get \$${varprefix}${pending}${severity} failed: $@");
+                or die "eval get \$${varprefix}${pending}${severity} failed: $@";
 #print STDERR ">$$value<\n";
             next unless length($$value);
             $text.= "
\n

".&heading($pending,$severity).":

\n". @@ -456,7 +456,7 @@ contents WWW page. for $pending (qw(pending forwarded done)) { for $severity (@showseverities) { eval "\$value= \\\$iiindex${pending}${severity}; 1;" - or &quit("eval get \$iiindex${pendingtype}${severity} failed: $@"); + or die "eval get \$iiindex${pendingtype}${severity} failed: $@"; $value= \$nobugs_html if !length($$value); $headstring= &heading($pending,$severity); &file("si/$pending$severity.html",'ref', @@ -591,7 +591,7 @@ for $k (map {$_->[0] } $tail_html."\n"); open(P,"$gPseudoDescFile") || - &quit("$gPseudoDescFile: $!"); + die "$gPseudoDescFile: $!"; $ppd=''; while(

) { s/\s*\n$//; $ppd.= &sani($_)."\n"; } close(P); &file('ix/pseudopackages.html','non', $gPseudoIndex. @@ -620,7 +620,7 @@ sub file { print "preserve $name\n"; return; } - defined($c= open(P,"-|")) or &quit("pipe/fork for diff: $!"); + defined($c= open(P,"-|")) or die "pipe/fork for diff: $!"; if (!$c) { open(Q,"|diff -e $cmppath -") or die "pipe/fork II for diff: $!\n"; print Q $file or die "write orig to diff: $!\n"; @@ -635,12 +635,12 @@ sub file { } $v= (split(/\n/,$difftxt)); print "diff $v $ii $name\n${difftxt}thatdiff $name\n" - or &quit("stdout (diff): $!"); + or die "stdout (diff): $!"; return; } } $v= (split(/\n/,$file)); - print "file $v $ii $name\n${file}thatfile $name\n" or &quit("stdout: $!"); + print "file $v $ii $name\n${file}thatfile $name\n" or die "stdout: $!"; } sub preserve { diff --git a/scripts/html-control b/scripts/html-control index 5dd8e0d..f3901df 100755 --- a/scripts/html-control +++ b/scripts/html-control @@ -17,11 +17,11 @@ chdir("$gSpoolDir") || die "chdir spool: $!\n"; &filelock("html.fcntl-lock"); -unlink("html-data.gz") || $!==&ENOENT or &quit("remove html-data.gz: $!"); +unlink("html-data.gz") || $!==&ENOENT or die "remove html-data.gz: $!"; sub nonawful ($) { rename("stamp.html.run","stamp.html") or warn "warning: put back stamp.html: $!"; - &quit($_[0]); + die $_[0]; } if (open(US,'updateseqs') && -f 'stamp.html') { @@ -31,20 +31,20 @@ if (open(US,'updateseqs') && -f 'stamp.html') { $lastsub++; $args= "-diff -stampfile=stamp.html.run"; - rename("stamp.html","stamp.html.run") or &quit("rename stamp.html: $!"); + rename("stamp.html","stamp.html.run") or die "rename stamp.html: $!"; } else { $lastsub=0; $lastmain = strftime "%Y%m%d%H%M%S", localtime; $args= '-full'; - unlink('stamp.html') || $!==&ENOENT or &quit("excise stale stamp.html: $!"); + unlink('stamp.html') || $!==&ENOENT or die "excise stale stamp.html: $!"; } -open(X,">stamp.html.new") or &quit("stamp.html.new: $!"); -close(X) or &quit("close stamp.html.new: $!"); +open(X,">stamp.html.new") or die "stamp.html.new: $!"; +close(X) or die "close stamp.html.new: $!"; -open(US,'>updateseqs.new') || &quit("create updateseqs.new: $!"); -print(US "$lastmain\n$lastsub\n") || &quit("write updateseqs.new: $!"); -close(US) || &quit("close updateseqs.new: $!"); +open(US,'>updateseqs.new') || die "create updateseqs.new: $!"; +print(US "$lastmain\n$lastsub\n") || die "write updateseqs.new: $!"; +close(US) || die "close updateseqs.new: $!"; rename('updateseqs.new','updateseqs') or nonawful("install updateseqs: $!"); sub runshell ($&) { @@ -88,7 +88,7 @@ runshell("$lib_path/html-install $gWebDir/db &1",sub { &quit; }); #runshell('2>&1 '.join(' ',('/usr/lib/sendmail','-f'."$gMaintainerEmail")).' -oem -oi -t /dev/null"; -my $intdate = time or quit("failed to get time: $!"); +my $intdate = time or die "failed to get time: $!"; $_=shift; -m/^([BMQFDUL])(\d*)\.\d+$/ or quit("bad argument: $_"); +m/^([BMQFDUL])(\d*)\.\d+$/ or die "bad argument: $_"; my $codeletter= $1; my $tryref= length($2) ? $2 : -1; my $nn= $_; @@ -45,7 +45,7 @@ my $nn= $_; if (!rename("incoming/G$nn","incoming/P$nn")) { $_=$!.''; m/no such file or directory/i && exit 0; - &quit("renaming to lock: $!"); + die "renaming to lock: $!"; } my $baddress= 'submit' if $codeletter eq 'B'; @@ -55,7 +55,7 @@ $baddress= 'forwarded' if $codeletter eq 'F'; $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"); +$baddress || die "bad codeletter $codeletter"; my $baddressroot= $baddress; $baddress= "$tryref-$baddress" if $tryref>=0; @@ -191,7 +191,7 @@ print DEBUG "***\n$fwd\n***\n"; if (defined $header{'resent-from'} && !defined $header{'from'}) { $header{'from'} = $header{'resent-from'}; } -defined($header{'from'}) || &quit("no From header"); +defined($header{'from'}) || die "no From header"; my $replyto = $header{'reply-to'}; $replyto = '' unless defined $replyto; @@ -390,7 +390,7 @@ if ($codeletter eq 'D' || $codeletter eq 'F') writebug($ref, $data); my $hash = get_hashname($ref); - open(O,"db-h/$hash/$ref.report") || &quit("read original report: $!"); + open(O,"db-h/$hash/$ref.report") || die "read original report: $!"; my $orig_report= join('',); close(O); if ($codeletter eq 'F') { &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded."); @@ -580,8 +580,8 @@ if ($ref<0) { # new bug report $data->{'forwarded-to'} = $pheader{forwarded}; } &filelock("nextnumber.lock"); - open(N,"nextnumber") || &quit("nextnumber: read: $!"); - my $nextnumber=; $nextnumber =~ s/\n$// || &quit("nextnumber bad format"); + open(N,"nextnumber") || die "nextnumber: read: $!"; + my $nextnumber=; $nextnumber =~ s/\n$// || die "nextnumber bad format"; $ref= $nextnumber+0; $nextnumber += 1; $newref=1; &overwrite('nextnumber', "$nextnumber\n"); &unfilelock; @@ -884,10 +884,10 @@ if (not exists $header{'x-debbugs-no-ack'} and sub overwrite { my ($f,$v) = @_; - open(NEW,">$f.new") || &quit("$f.new: create: $!"); - print(NEW "$v") || &quit("$f.new: write: $!"); - close(NEW) || &quit("$f.new: close: $!"); - rename("$f.new","$f") || &quit("rename $f.new to $f: $!"); + open(NEW,">$f.new") || die "$f.new: create: $!"; + print(NEW "$v") || die "$f.new: write: $!"; + close(NEW) || die "$f.new: close: $!"; + rename("$f.new","$f") || die "rename $f.new to $f: $!"; } sub appendlog { @@ -895,10 +895,10 @@ sub appendlog { if (!open(AP,">>db-h/$hash/$ref.log")) { print DEBUG "failed open log<\n"; print DEBUG "failed open log err $!<\n"; - &quit("opening db-h/$hash/$ref.log (li): $!"); + die "opening db-h/$hash/$ref.log (li): $!"; } - print(AP "\7\n",escape_log(@log),"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!"); - close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!"); + print(AP "\7\n",escape_log(@log),"\n\3\n") || die "writing db-h/$hash/$ref.log (li): $!"; + close(AP) || die "closing db-h/$hash/$ref.log (li): $!"; } sub finish { @@ -908,23 +908,23 @@ sub finish { # cleanups are run in an end block now. #my ($u); #while ($u= $cleanups[$#cleanups]) { &$u; } - unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!"); + unlink("incoming/P$nn") || die "unlinking incoming/P$nn: $!"; exit $exit; } -&quit("wot no exit"); +die "wot no exit"; sub htmllog { my ($whatobj,$whatverb,$where,$desc) = @_; my $hash = get_hashname($ref); - open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lh): $!"); + open(AP,">>db-h/$hash/$ref.log") || die "opening db-h/$hash/$ref.log (lh): $!"; print(AP "\6\n". "$whatobj $whatverb". ($where eq '' ? "" : " to ".html_escape($where).""). ":
\n". $desc. - "\n\3\n") || &quit("writing db-h/$hash/$ref.log (lh): $!"); - close(AP) || &quit("closing db-h/$hash/$ref.log (lh): $!"); + "\n\3\n") || die "writing db-h/$hash/$ref.log (lh): $!"; + close(AP) || die "closing db-h/$hash/$ref.log (lh): $!"; } sub stripbccs { @@ -982,11 +982,11 @@ sub sendmessage { my $hash = get_hashname($ref); #save email to the log - open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lo): $!"); + 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") || - &quit("writing db-h/$hash/$ref.log (lo): $!"); - close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!"); + die "writing db-h/$hash/$ref.log (lo): $!"; + close(AP) || die "closing db-h/$hash/$ref.log (lo): $!"; if (ref($bcc)) { shift @$recips if $recips->[0] eq '-t'; @@ -1052,28 +1052,28 @@ sub checkmaintainers { return if $maintainerschecked++; return if !length($data->{package}); my %maintainerof; - open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!"); + open(MAINT,"$gMaintainerFile") || die die "maintainers open: $!"; while () { m/^\n$/ && next; m/^\s*$/ && next; - m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers bogus \`$_'"); + m/^(\S+)\s+(\S.*\S)\s*\n$/ || die "maintainers bogus \`$_'"; $a= $1; $b= $2; $a =~ y/A-Z/a-z/; # use the package which is normalized to lower case; we do this because we lc the pseudo headers. $maintainerof{$a}= $2; } close(MAINT); - open(MAINT,"$gMaintainerFileOverride") || die &quit("maintainers.override open: $!"); + open(MAINT,"$gMaintainerFileOverride") || die die "maintainers.override open: $!"; while () { m/^\n$/ && next; m/^\s*$/ && next; - m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers.override bogus \`$_'"); + m/^(\S+)\s+(\S.*\S)\s*\n$/ || die "maintainers.override bogus \`$_'"; $a= $1; $b= $2; $a =~ y/A-Z/a-z/; # use the package which is normalized to lower case; we do this because we lc the pseudo headers. $maintainerof{$a}= $2; } close(MAINT); my %pkgsrc; - open(SOURCES,"$gPackageSource") || &quit("pkgsrc open: $!"); + open(SOURCES,"$gPackageSource") || die "pkgsrc open: $!"; while () { next unless m/^(\S+)\s+\S+\s+(\S.*\S)\s*$/; ($a,$b)=($1,$2); @@ -1164,6 +1164,6 @@ sub bug_list_forward{ envelope_from => $envelope_from, encode_headers => 0, ); - unlink("incoming/P$bug_fn") || &quit("unlinking incoming/P$bug_fn: $!"); + unlink("incoming/P$bug_fn") || die "unlinking incoming/P$bug_fn: $!"; exit 0; } diff --git a/scripts/rebuild b/scripts/rebuild index 6c98f25..fd1b927 100755 --- a/scripts/rebuild +++ b/scripts/rebuild @@ -17,11 +17,11 @@ chdir("$gSpoolDir") || die "chdir spool: $!\n"; #global variables $debug = 0; -@ARGV==0 and &quit( "no archive given on the commandline" ); +@ARGV==0 and die "no archive given on the commandline" ; my $archive = shift(@ARGV); my $index = "index.$archive"; $index = 'index.db' if $archive eq 'db-h'; -open IDXFILE, "> $index" or &quit( "trying to reset index file: $!" ); +open IDXFILE, "> $index" or die "trying to reset index file: $!" ; #get list of bugs (ie, status files) my @files; diff --git a/scripts/summary b/scripts/summary index a1be697..5d2b03f 100755 --- a/scripts/summary +++ b/scripts/summary @@ -14,7 +14,7 @@ chdir("$gSpoolDir") || die "chdir spool: $!\n"; $mode= shift(@ARGV); -open(M,"$gMaintainerFile") || &quit("open $gMaintainerFile: $!"); +open(M,"$gMaintainerFile") || die "open $gMaintainerFile: $!"; while () { m/^(\S+)\s+(\S.*\S)\s*$/ || warn "$_ ?"; ($a,$b)=($1,$2); @@ -22,7 +22,7 @@ while () { $maintainer{$a}= $b; } close(M); -open(M,"$gMaintainerFileOverride") || &quit("open $gMaintainerFileOverride: $!"); +open(M,"$gMaintainerFileOverride") || die "open $gMaintainerFileOverride: $!"; while () { m/^(\S+)\s+(\S.*\S)\s*$/ || warn "$_ ?"; ($a,$b)=($1,$2); @@ -32,9 +32,9 @@ while () { close(M); -defined($startdate= time) || &quit("failed to get time: $!"); +defined($startdate= time) || die "failed to get time: $!"; -opendir(DIR,"db-h") || &quit("opendir db-h: $!\n"); +opendir(DIR,"db-h") || die "opendir db-h: $!\n"; @dirs = grep(s,^,db-h/,, grep(m/^\d+$/,readdir(DIR))); closedir(DIR); foreach my $dir (@dirs) { @@ -71,7 +71,7 @@ while (length($f=shift(@list))) { } printf("%6d %-10.10s %-30.30s %-.31s\n", $f, $data->{package}, (length($data->{keywords}) ? $data->{keywords}.'/' : '').$data->{subject}, - $data->{maintainer}) || &quit("output undone: $!"); + $data->{maintainer}) || die "output undone: $!"; } elsif ($mode eq 'bymaint') { &unfilelock; next if length($data->{done}) || length($data->{forwarded}); @@ -81,19 +81,19 @@ while (length($f=shift(@list))) { $maintainercnt{$data->{maintainer}}++; $maintainerlist{$data->{maintainer}}.= " $f"; } else { - &quit("badmode $mode"); + die "badmode $mode"; } } if ($mode eq 'bymaint') { - print("$head\n") || &quit("output head: $!"); + print("$head\n") || die "output head: $!"; for $m (sort { $maintainercnt{$a} <=> $maintainercnt{$b} } keys %maintainercnt) { printf("\n%s (%d $gBugs):\n",$m,$maintainercnt{$m}) - || &quit("output mainthead: $!"); + || die "output mainthead: $!"; for $i (sort { $string{$a} cmp $string{$b} } split(/ /,$maintainerlist{$m})) { - printf($string{$i}) || &quit("output 1bymaint: $!"); + printf($string{$i}) || die "output 1bymaint: $!"; } } } -close(STDOUT) || &quit("close stdout: $!"); +close(STDOUT) || die "close stdout: $!"; -- 2.39.2