--- shiela.pl 2004/08/11 16:50:39 1.66
+++ shiela.pl 2005/01/12 20:42:46 1.67
@@ -127,8 +127,8 @@
$RT->{pgrp} = getpgrp();
# supplied arguments
- $RT->{cvsroot} = $ENV{CVSROOT} || die 'unknown CVS root (set $CVSROOT variable)';
- $RT->{userid} = $ENV{CVSUSER} || $ENV{LOGNAME} || $ENV{LOGUSER} || $ENV{USER} || die 'unknown CVS user';
+ $RT->{cvsroot} = $ENV{CVSROOT} or die 'unknown CVS root (set $CVSROOT variable)';
+ $RT->{userid} = ($ENV{CVSUSER} || $ENV{LOGNAME} || $ENV{LOGUSER} || $ENV{USER}) or die 'unknown CVS user';
# various directory paths
$RT->{tmpdir} = $ENV{TMPDIR} || $ENV{TEMPDIR} || '/tmp';
@@ -379,7 +379,7 @@
# read configuration file
my $io = new IO::File "<$file"
- || die "unable to open configuration file `$file'";
+ or die "unable to open configuration file `$file'";
my $t = '';
$t .= $_ while (<$io>);
$io->close;
@@ -567,8 +567,8 @@
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
- my $program = shift || "cvs";
- my $cvsroot = shift || $ENV{CVSROOT} || die "unknown CVSROOT";
+ my $program = (shift || "cvs");
+ my $cvsroot = (shift || $ENV{CVSROOT}) or die "unknown CVSROOT";
my $trace = shift || 0;
# spawn a CVS server process and establish a
@@ -581,7 +581,7 @@
$cvs->{rfd} = new IO::Handle;
$cvs->{wfd} = new IO::Handle;
$cvs->{pid} = IPC::Open2::open2($cvs->{rfd}, $cvs->{wfd}, "$program -f -Q -n server")
- || die "cannot spawn CVS server process `$program server'";
+ or die "cannot spawn CVS server process `$program server'";
print STDERR "cvs server: spawned (pid $cvs->{pid})\n" if ($trace);
bless ($cvs, $class);
@@ -822,7 +822,7 @@
# append to or override a file with lines from an array
if ($op eq 'append' or $op eq 'write') {
my $io = new IO::File ($op eq 'append' ? ">>$file" : ">$file")
- || die "unable to open `$file' for operation `$op'";
+ or die "unable to open `$file' for operation `$op'";
foreach my $line (@lines) {
$line =~ s|\n+$||s;
$io->print($prefix . $line . "\n");
@@ -833,7 +833,7 @@
elsif ($op eq 'read') {
my @text = ();
my $io = new IO::File "<$file"
- || die "unable to open `$file' for $op";
+ or die "unable to open `$file' for $op";
while (<$io>) {
s|\n$||s;
push(@text, $prefix . $_);
@@ -871,7 +871,7 @@
$O .= "\n";
}
my $io = new IO::File ">>".$RT->{historydb}
- || die "cannot store information to history db `$RT->{historydb}'";
+ or die "cannot store information to history db `$RT->{historydb}'";
$io->print($O);
$io->close;
return;
@@ -903,7 +903,7 @@
my $file;
foreach $file (@files) {
$file =~ m|^([^/]+)/(.*):([^:]+)$|
- || die "invalid file specification `$file' for access control";
+ or die "invalid file specification `$file' for access control";
my ($d, $f, $t) = ($1, $2, $3);
my $allow = 0;
foreach my $module (keys(%{$CF->{Repository}->{Module}})) {
@@ -1249,7 +1249,7 @@
my $cvsstat = '';
if (not $RT->{useserver}) {
my $io = new IO::File "$RT->{cvs} -f -Q -n status ".join(' ', @cvsfiles)."|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$cvsstat .= $_ while (<$io>);
$io->close;
}
@@ -1340,7 +1340,7 @@
# suck in the log message
my $logfile = $PA->{ARG}->[0];
my $io = new IO::File "<$logfile"
- || die "cannot open message file `$logfile' for reading";
+ or die "cannot open message file `$logfile' for reading";
my $data = '';
$data .= $_ while (<$io>);
$io->close;
@@ -1351,7 +1351,7 @@
# update the log message
# (CVS with RSE patches reads in this again, stock CVS ignores it)
$io = new IO::File ">$logfile"
- || die "cannot open message file `$logfile' for writing";
+ or die "cannot open message file `$logfile' for writing";
$io->print($data);
$io->close;
@@ -1494,7 +1494,7 @@
exit(0);
}
my $io = new IO::File "$RT->{cvs} -f -Q -n log -r$It '$Is'|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$rcslog = $_ while (<$io>);
$io->close;
}
@@ -1583,7 +1583,7 @@
my @newinfo = ();
foreach my $info (@cvsinfo) {
$info =~ m|^([^,]+),([^,]+),([^,]+)|
- || die "invalid loginfo argument `$info' while extending stock CVS information";
+ or die "invalid loginfo argument `$info' while extending stock CVS information";
my ($Is, $IV, $Iv) = ($1, $2, $3);
my $It = '';
@@ -1603,7 +1603,7 @@
my @newinfo = ();
foreach my $info (@cvsinfo) {
$info =~ m|^([^,]+),([^,]+),([^,]+),([^,]*),([^,]*)$|
- || die "invalid loginfo argument `$info' while extending summary information";
+ or die "invalid loginfo argument `$info' while extending summary information";
my ($Is, $IV, $Iv, $It, $Io) = ($1, $2, $3, $4, $5);
# fix branch/tag and accumulate information
@@ -1616,7 +1616,7 @@
my $rcslog ='';
if (not $RT->{useserver}) {
my $io = new IO::File "$RT->{cvs} -f -Q -n log '$Is'|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$rcslog .= $_ while (<$io>);
$io->close;
}
@@ -1639,7 +1639,7 @@
if ($Io eq 'A' or $Io eq 'M' or $Io eq 'R') {
if (not $RT->{useserver}) {
my $io = new IO::File "$RT->{cvs} -f -Q -n log -r$Iv '$Is'|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$rcslog .= $_ while (<$io>);
$io->close;
}
@@ -1706,11 +1706,11 @@
# retrieve whole file contents
unlink("$RT->{tmpfile}.all");
my $io = new IO::File ">$RT->{tmpfile}.all"
- || die "unable to open temporary file $RT->{tmpfile}.all for writing";
+ or die "unable to open temporary file $RT->{tmpfile}.all for writing";
my $l = 0;
if (not $RT->{useserver}) {
my $cvs = new IO::File "$RT->{cvs} -f -Q -n update -p -r$Iv '$Is'|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
while (<$cvs>) {
$io->print($_);
$l++;
@@ -1747,12 +1747,12 @@
unlink("$RT->{tmpfile}.null");
unlink("$RT->{tmpfile}.xdelta");
my $io = new IO::File ">$RT->{tmpfile}.null"
- || die "unable to open temporary file $RT->{tmpfile}.null for writing";
+ or die "unable to open temporary file $RT->{tmpfile}.null for writing";
$io->close;
system("$RT->{xdelta} delta $RT->{tmpfile}.null " .
"$RT->{tmpfile}.all $RT->{tmpfile}.xdelta >/dev/null 2>&1");
$io = new IO::File "$RT->{uuencode} $RT->{tmpfile}.xdelta $Is.xdelta |"
- || die "unable to open uuencode command pipe for reading";
+ or die "unable to open uuencode command pipe for reading";
$cvsdiff .= $_ while (<$io>);
$io->close;
$cvsdiff .= "@@ .\n";
@@ -1772,7 +1772,7 @@
"\$ cvs diff -u -r0 -r$Iv $Is\n";
my $diff = '';
my $io = new IO::File "$RT->{diff} -u /dev/null $RT->{tmpfile}.all|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$diff .= $_ while (<$io>);
$io->close;
my $Is_quoted = quotemeta("$RT->{tmpfile}.all");
@@ -1798,10 +1798,10 @@
# retrieve whole file contents (old revision)
unlink("$RT->{tmpfile}.old");
my $io = new IO::File ">$RT->{tmpfile}.old"
- || die "unable to open temporary file $RT->{tmpfile}.old for writing";
+ or die "unable to open temporary file $RT->{tmpfile}.old for writing";
if (not $RT->{useserver}) {
my $cvs = new IO::File "$RT->{cvs} -f -Q -n update -p -r$IV '$Is'|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$io->print($_) while (<$cvs>);
$cvs->close;
}
@@ -1819,10 +1819,10 @@
# retrieve whole file contents (new revision)
unlink("$RT->{tmpfile}.new");
$io = new IO::File ">$RT->{tmpfile}.new"
- || die "unable to open temporary file $RT->{tmpfile}.new for writing";
+ or die "unable to open temporary file $RT->{tmpfile}.new for writing";
if (not $RT->{useserver}) {
my $cvs = new IO::File "$RT->{cvs} -f -Q -n update -p -r$Iv '$Is'|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$io->print($_) while (<$cvs>);
$cvs->close;
}
@@ -1851,7 +1851,7 @@
system("$RT->{xdelta} delta $RT->{tmpfile}.old " .
"$RT->{tmpfile}.new $RT->{tmpfile}.xdelta >/dev/null 2>&1");
$io = new IO::File "$RT->{uuencode} $RT->{tmpfile}.xdelta $Is.xdelta |"
- || die "unable to open uuencode command pipe for reading";
+ or die "unable to open uuencode command pipe for reading";
$cvsdiff .= $_ while (<$io>);
$io->close;
$cvsdiff .= "@@ .\n";
@@ -1868,7 +1868,7 @@
my $d = '';
if (not $RT->{useserver}) {
my $io = new IO::File "$RT->{cvs} -f -Q -n diff -u -r$IV -r$Iv '$Is'|"
- || die "unable to open CVS command pipe for reading";
+ or die "unable to open CVS command pipe for reading";
$d .= $_ while (<$io>);
$io->close;
}
@@ -1963,7 +1963,7 @@
my $handle_max; $handle_max = undef;
foreach my $cvsinfo (@cvsinfo) {
$cvsinfo =~ m|^([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)$|
- || die "invalid loginfo argument `$cvsinfo' while accumulating information";
+ or die "invalid loginfo argument `$cvsinfo' while accumulating information";
my ($Is, $IV, $Iv, $It, $Io, $Ik, $ID, $Id) = ($1, $2, $3, $4, $5, $6, $7, $8, $9);
my $e = {};
$e->{oldrev} = $IV;
@@ -2068,7 +2068,7 @@
my $logmsg = &produce_log_message($PA, $RT, $CF, $IN, $logtype, @files);
$logurl = $RT->{cvsroot}."/".$logurl if ($logurl !~ m|^/|);
print "cvs commit: Writing commit message to $logurl\n";
- my $io = new IO::File ">>$logurl" || die "cannot append log message to `$logurl'";
+ my $io = new IO::File ">>$logurl" or die "cannot append log message to `$logurl'";
$io->print($logmsg);
$io->close;
}
@@ -2117,7 +2117,7 @@
# Finally generate the logging message.
#
- my $RP = $CF->{Logging}->{Report}->{$type} || die "No report of type `$type' defined";
+ my $RP = $CF->{Logging}->{Report}->{$type} or die "No report of type `$type' defined";
my $prefix = $RP->{Prefix} || '';
my $style = $RP->{Details} || 'patch:plain';
my $O = '';
|