The following commit has been merged in the master branch:
commit 5f9656f5d6ad0c153e301bc2d4805e6b52358829
Author: James Vega <[email protected]>
Date: Tue Apr 13 22:46:24 2010 -0400
Use $progname instead of hard-coded names in bts and mass-bug.
Signed-off-by: James Vega <[email protected]>
diff --git a/scripts/bts.pl b/scripts/bts.pl
index 134d228..a2d100d 100755
--- a/scripts/bts.pl
+++ b/scripts/bts.pl
@@ -574,10 +574,10 @@ GetOptions("help|h" => \$opt_help,
"bts-server=s" => \$btsserver,
"mutt" => \$opt_mutt,
)
- or die "Usage: bts [options]\nRun $progname --help for more details\n";
+ or die "Usage: $progname [options]\nRun $progname --help for more
details\n";
if ($opt_noconf) {
- die "bts: --no-conf is only acceptable as the first command-line
option!\n";
+ die "$progname: --no-conf is only acceptable as the first command-line
option!\n";
}
if ($opt_help) { bts_help(); exit 0; }
if ($opt_version) { bts_version(); exit 0; }
@@ -595,7 +595,7 @@ if ($opt_mailreader) {
if ($opt_mailreader =~ /\%s/) {
$mailreader=$opt_mailreader;
} else {
- warn "bts: ignoring invalid --mailreader option: invalid mail command
following it.\n";
+ warn "$progname: ignoring invalid --mailreader option: invalid mail
command following it.\n";
}
}
@@ -604,11 +604,11 @@ if ($opt_mutt) {
}
if ($opt_sendmail and $opt_smtphost) {
- die "bts: --sendmail and --smtp-host mutually exclusive\n";
+ die "$progname: --sendmail and --smtp-host mutually exclusive\n";
} elsif ($opt_mutt and $opt_sendmail) {
- die "bts: --sendmail and --mutt mutually exclusive\n";
+ die "$progname: --sendmail and --mutt mutually exclusive\n";
} elsif ($opt_mutt and $opt_smtphost) {
- die "bts: --smtp-host and --mutt mutually exclusive\n";
+ die "$progname: --smtp-host and --mutt mutually exclusive\n";
}
$smtphost = $opt_smtphost if $opt_smtphost;
@@ -651,7 +651,7 @@ if ($opt_cachemode) {
if ($opt_cachemode =~ /^(min|mbox|full)$/) {
$cachemode=$opt_cachemode;
} else {
- warn "bts: ignoring invalid --cache-mode; must be one of min, mbox,
full.\n";
+ warn "$progname: ignoring invalid --cache-mode; must be one of min,
mbox, full.\n";
}
}
@@ -729,7 +729,7 @@ for $index (0 .. $ncommand) {
} else {
my @matches=grep /^bts_\Q$command[$index]\E/, keys %::;
if (@matches != 1) {
- die "bts: Couldn't find a unique match for the command
$command[$index]!\nRun $progname --help for a list of valid commands.\n";
+ die "$progname: Couldn't find a unique match for the command
$command[$index]!\nRun $progname --help for a list of valid commands.\n";
}
# Replace the abbreviated command with its expanded equivalent
@@ -901,7 +901,7 @@ sub bts_bugs {
"m|mbox" => \$sub_mboxmode,
"mailreader|mail-reader=s" => \$sub_mailreader,
)
- or die "bts: unknown options for bugs command\n";
+ or die "$progname: unknown options for bugs command\n";
@_ = @ARGV; # whatever's left
if (defined $sub_offlinemode) {
@@ -917,7 +917,7 @@ sub bts_bugs {
if ($sub_mailreader =~ /\%s/) {
($mailreader, $sub_mailreader) = ($sub_mailreader, $mailreader);
} else {
- warn "bts: ignoring invalid --mailreader $sub_mailreader
option:\ninvalid mail command following it.\n";
+ warn "$progname: ignoring invalid --mailreader $sub_mailreader
option:\ninvalid mail command following it.\n";
$sub_mailreader = undef;
}
}
@@ -1180,8 +1180,8 @@ sub common_close {
sub bts_close {
my ($bug) = common_close(@_);
warn <<"EOT";
-bts: Closing $bug as you requested.
-Please note that the "bts close" command is deprecated!
+$progname: Closing $bug as you requested.
+Please note that the "$progname close" command is deprecated!
It is usually better to email nnnnnn-do...@$btsserver with
an informative mail.
Please remember to email $bug-submitt...@$btsserver with
@@ -1340,7 +1340,7 @@ sub bts_found {
my $bug=checkbug(shift) or die "bts found: found what bug?\n";
my $version=shift;
if (! defined $version) {
- warn "bts: found has no version number, but sending to the BTS
anyway\n";
+ warn "$progname: found has no version number, but sending to the BTS
anyway\n";
$version="";
}
opts_done(@_);
@@ -2008,7 +2008,7 @@ sub bts_reportspam {
my @bugs;
if (! have_lwp()) {
- die "bts: Couldn't run bts reportspam: $lwp_broken\n";
+ die "$progname: Couldn't run bts reportspam: $lwp_broken\n";
}
foreach (@_) {
@@ -2028,7 +2028,7 @@ sub bts_reportspam {
my $request = HTTP::Request->new('GET', $url);
my $response = $ua->request($request);
if (! $response->is_success) {
- warn "bts: failed to report $bug as containing spam: " .
+ warn "$progname: failed to report $bug as containing spam: " .
$response->status_line . "\n";
}
}
@@ -2106,7 +2106,7 @@ sub bts_cache {
"q|quiet+" => \$sub_quiet,
"include-resolved!" => \$sub_includeresolved,
)
- or die "bts: unknown options for cache command\n";
+ or die "$progname: unknown options for cache command\n";
@_ = @ARGV; # whatever's left
if (defined $sub_refreshmode) {
@@ -2119,7 +2119,7 @@ sub bts_cache {
if ($sub_cachemode =~ /^(min|mbox|full)$/) {
($cachemode, $sub_cachemode) = ($sub_cachemode, $cachemode);
} else {
- warn "bts: ignoring invalid --cache-mode $sub_cachemode;\nmust be
one of min, mbox, full.\n";
+ warn "$progname: ignoring invalid --cache-mode
$sub_cachemode;\nmust be one of min, mbox, full.\n";
}
}
# This may be a no-op, we don't mind
@@ -2128,16 +2128,16 @@ sub bts_cache {
prunecache();
if (! have_lwp()) {
- die "bts: Couldn't run bts cache: $lwp_broken\n";
+ die "$progname: Couldn't run bts cache: $lwp_broken\n";
}
if (! -d $cachedir) {
if (! -d dirname($cachedir)) {
mkdir(dirname($cachedir))
- or die "bts: couldn't mkdir ".dirname($cachedir).": $!\n";
+ or die "$progname: couldn't mkdir ".dirname($cachedir).": $!\n";
}
mkdir($cachedir)
- or die "bts: couldn't mkdir $cachedir: $!\n";
+ or die "$progname: couldn't mkdir $cachedir: $!\n";
}
download("css/bugs.css");
@@ -2176,7 +2176,7 @@ sub bts_cache {
if (keys %oldbugs) {
tie (%timestamp, "Devscripts::DB_File_Lock", $timestampdb,
O_RDWR()|O_CREAT(), 0600, $DB_HASH, "write")
- or die "bts: couldn't open DB file $timestampdb for writing: $!\n"
+ or die "$progname: couldn't open DB file $timestampdb for writing:
$!\n"
if ! tied %timestamp;
}
@@ -2249,7 +2249,7 @@ sub bts_cleancache {
# clean index
tie (%timestamp, "Devscripts::DB_File_Lock", $timestampdb,
O_RDWR()|O_CREAT(), 0600, $DB_HASH, "write")
- or die "bts: couldn't open DB file $timestampdb for writing: $!\n"
+ or die "$progname: couldn't open DB file $timestampdb for writing: $!\n"
if ! tied %timestamp;
if ($toclean =~ /^\d+$/) {
@@ -2388,7 +2388,7 @@ sub checkbug {
if ($bug eq 'it') {
if (not defined $it) {
- die "bts: You specified 'it', but no previous bug number
referenced!\n";
+ die "$progname: You specified 'it', but no previous bug number
referenced!\n";
}
} else {
$bug=~s/^(?:(?:bug)?\#)?(-?\d+):?$/$1/i;
@@ -2469,14 +2469,14 @@ sub send_mail {
DIR => File::Spec->tmpdir,
UNLINK => 1);
open (MAILOUT, ">&", $fh)
- or die "bts: writing to temporary file: $!\n";
+ or die "$progname: writing to temporary file: $!\n";
print MAILOUT $message;
my $mailcmd = $muttcmd;
$mailcmd =~ s/\%([%s])/$1 eq '%' ? '%' : $filename/eg;
- exec($mailcmd) or die "bts: unable to start mailclient: $!";
+ exec($mailcmd) or die "$progname: unable to start mailclient: $!";
}
elsif (length $smtphost) {
my $smtp;
@@ -2487,56 +2487,56 @@ sub send_mail {
if (have_smtp_ssl) {
$smtp = Net::SMTP::SSL->new($host, Port => $port,
- Hello => $smtphelo) or die "bts: failed to open SMTPS
connection to $smtphost\n($@)\n";
+ Hello => $smtphelo) or die "$progname: failed to open SMTPS
connection to $smtphost\n($@)\n";
} else {
- die "bts: Unable to establish SMTPS connection:
$smtp_ssl_broken\n($@)\n";
+ die "$progname: Unable to establish SMTPS connection:
$smtp_ssl_broken\n($@)\n";
}
} else {
my ($host, $port) = split(/:/, $smtphost);
$port ||= '25';
$smtp = Net::SMTP->new($host, Port => $port, Hello => $smtphelo)
- or die "bts: failed to open SMTP connection to
$smtphost\n($@)\n";
+ or die "$progname: failed to open SMTP connection to
$smtphost\n($@)\n";
}
if ($smtpuser) {
$smtppass = getpass() if not $smtppass;
$smtp->auth($smtpuser, $smtppass)
- or die "bts: failed to authenticate to $smtphost\n($@)\n";
+ or die "$progname: failed to authenticate to $smtphost\n($@)\n";
}
$smtp->mail($fromaddress)
- or die "bts: failed to set SMTP from address $fromaddress\n($@)\n";
+ or die "$progname: failed to set SMTP from address
$fromaddress\n($@)\n";
my @addresses = extract_addresses($to);
push @addresses, extract_addresses($cc);
foreach my $address (@addresses) {
$smtp->recipient($address)
- or die "bts: failed to set SMTP recipient $address\n($@)\n";
+ or die "$progname: failed to set SMTP recipient
$address\n($@)\n";
}
$smtp->data($message)
- or die "bts: failed to send message as SMTP DATA\n($@)\n";
+ or die "$progname: failed to send message as SMTP DATA\n($@)\n";
$smtp->quit
- or die "bts: failed to quit SMTP connection\n($@)\n";
+ or die "$progname: failed to quit SMTP connection\n($@)\n";
}
else {
my $pid = open(MAIL, "|-");
if (! defined $pid) {
- die "bts: Couldn't fork: $!\n";
+ die "$progname: Couldn't fork: $!\n";
}
- $SIG{'PIPE'} = sub { die "bts: pipe for $sendmailcmd broke\n"; };
+ $SIG{'PIPE'} = sub { die "$progname: pipe for $sendmailcmd broke\n"; };
if ($pid) {
# parent
print MAIL $message;
- close MAIL or die "bts: sendmail error: $!\n";
+ close MAIL or die "$progname: sendmail error: $!\n";
}
else {
# child
if ($debug) {
exec("/bin/cat")
- or die "bts: error running cat: $!\n";
+ or die "$progname: error running cat: $!\n";
} else {
my @mailcmd = split ' ', $sendmailcmd;
push @mailcmd, "-t" if $sendmailcmd =~ /$sendmail_t/;
exec @mailcmd
- or die "bts: error running sendmail: $!\n";
+ or die "$progname: error running sendmail: $!\n";
}
}
}
@@ -2626,23 +2626,23 @@ sub mailbtsall {
}
unless (system("command -v mail >/dev/null 2>&1") == 0) {
- die "bts: You need to either set DEBEMAIL or have the
mailx/mailutils package\ninstalled to send mail!\n";
+ die "$progname: You need to either set DEBEMAIL or have the
mailx/mailutils package\ninstalled to send mail!\n";
}
my $pid = open(MAIL, "|-");
if (! defined $pid) {
- die "bts: Couldn't fork: $!\n";
+ die "$progname: Couldn't fork: $!\n";
}
- $SIG{'PIPE'} = sub { die "bts: pipe for mail broke\n"; };
+ $SIG{'PIPE'} = sub { die "$progname: pipe for mail broke\n"; };
if ($pid) {
# parent
print MAIL $body;
- close MAIL or die "bts: mail: $!\n";
+ close MAIL or die "$progname: mail: $!\n";
}
else {
# child
if ($debug) {
exec("/bin/cat")
- or die "bts: error running cat: $!\n";
+ or die "$progname: error running cat: $!\n";
} else {
$ccemail =~ s/ //g;
my @args;
@@ -2650,7 +2650,7 @@ sub mailbtsall {
push(@args, "-c", "$ccemail") if $ccemail;
push(@args, "-a", "X-Debbugs-No-Ack: Yes")
if $requestack==0;
- exec("mail", @args) or die "bts: error running mail: $!\n";
+ exec("mail", @args) or die "$progname: error running mail:
$!\n";
}
}
}
@@ -2717,7 +2717,7 @@ sub addfooter() {
sub getpass() {
system "stty -echo cbreak </dev/tty";
- die "bts: error disabling stty echo\n" if $?;
+ die "$progname: error disabling stty echo\n" if $?;
print "\a${smtpuser}";
print "\...@$smtphost" if $smtpuser !~ /\@/;
print "'s SMTP password: ";
@@ -2725,12 +2725,12 @@ sub getpass() {
chomp;
print "\n";
system "stty echo -cbreak </dev/tty";
- die "bts: error enabling stty echo\n" if $?;
+ die "$progname: error enabling stty echo\n" if $?;
return $_;
}
sub extractemail() {
- my $thing=shift or die "bts: extract e-mail from what?\n";
+ my $thing=shift or die "$progname: extract e-mail from what?\n";
if ($thing =~ /^(.*?)\s+<(.*)>\s*$/) {
$thing = $2;
@@ -2749,26 +2749,26 @@ sub mailto {
}
else { # No $from
unless (system("command -v mail >/dev/null 2>&1") == 0) {
- die "bts: You need to either specify an email address (say using
DEBEMAIL)\n or have the mailx/mailutils package installed to send mail!\n";
+ die "$progname: You need to either specify an email address (say
using DEBEMAIL)\n or have the mailx/mailutils package installed to send
mail!\n";
}
my $pid = open(MAIL, "|-");
if (! defined $pid) {
- die "bts: Couldn't fork: $!\n";
+ die "$progname: Couldn't fork: $!\n";
}
- $SIG{'PIPE'} = sub { die "bts: pipe for mail broke\n"; };
+ $SIG{'PIPE'} = sub { die "$progname: pipe for mail broke\n"; };
if ($pid) {
# parent
print MAIL $body;
- close MAIL or die "bts: mail: $!\n";
+ close MAIL or die "$progname: mail: $!\n";
}
else {
# child
if ($debug) {
exec("/bin/cat")
- or die "bts: error running cat: $!\n";
+ or die "$progname: error running cat: $!\n";
} else {
exec("mail", "-s", $subject, $to)
- or die "bts: error running mail: $!\n";
+ or die "$progname: error running mail: $!\n";
}
}
}
@@ -2910,10 +2910,10 @@ sub download {
}
if (! -d $cachedir) {
- die "bts: download() called but no cachedir!\n";
+ die "$progname: download() called but no cachedir!\n";
}
- chdir($cachedir) || die "bts: chdir $cachedir: $!\n";
+ chdir($cachedir) || die "$progname: chdir $cachedir: $!\n";
if (-f cachefile($thing, $thgopts)) {
($timestamp, $versionstamp) = get_timestamp($thing, $thgopts);
@@ -2934,7 +2934,7 @@ sub download {
if (! -r mboxfile($thing)) {
$forcedownload = 1;
} elsif ($cachemode eq 'full' and -d $thing) {
- opendir DIR, $thing or die "bts: opendir $cachedir/$thing:
$!\n";
+ opendir DIR, $thing or die "$progname: opendir
$cachedir/$thing: $!\n";
my @htmlfiles = grep { /^\d+\.html$/ } readdir(DIR);
closedir DIR;
$forcedownload = 1 unless @htmlfiles;
@@ -2964,7 +2964,7 @@ sub download {
print "$bug_current/$bug_total" if $bug_total;
print "\n";
}
- chdir $oldcwd or die "bts: chdir $oldcwd failed: $!\n";
+ chdir $oldcwd or die "$progname: chdir $oldcwd failed: $!\n";
return "";
}
elsif ($ret == MIRROR_DOWNLOADED) {
@@ -2972,7 +2972,7 @@ sub download {
# we've successfully stashed the data away
$timestamp = time;
- die "bts: empty page downloaded\n" unless length $livepage;
+ die "$progname: empty page downloaded\n" unless length $livepage;
my $bug2filename = { };
@@ -2985,11 +2985,11 @@ sub download {
my $data = $livepage; # work on a copy, not the original
my $cachefile=cachefile($thing,$thgopts);
- open (OUT_CACHE, ">$cachefile") or die "bts: open $cachefile: $!\n";
+ open (OUT_CACHE, ">$cachefile") or die "$progname: open $cachefile:
$!\n";
$data = mangle_cache_file($data, $thing, $bug2filename, $timestamp,
$charset ? $contenttype : '');
print OUT_CACHE $data;
- close OUT_CACHE or die "bts: problems writing to $cachefile: $!\n";
+ close OUT_CACHE or die "$progname: problems writing to $cachefile:
$!\n";
set_timestamp($thing, $thgopts,
$manual ? make_manual($timestamp) : make_automatic($timestamp),
@@ -3011,10 +3011,10 @@ sub download {
$base=~s%/[^/]*$%%;
$livepage=~s%<head>%<head><base href="$base">%i;
- chdir $oldcwd or die "bts: chdir $oldcwd failed: $!\n";
+ chdir $oldcwd or die "$progname: chdir $oldcwd failed: $!\n";
return $livepage;
} else {
- die "bts: couldn't download $url:\n$msg\n";
+ die "$progname: couldn't download $url:\n$msg\n";
}
}
@@ -3048,7 +3048,7 @@ sub download_attachments {
# it's an attachment, must download
if (-f dirname($filename)) {
- warn "bts: found file where directory expected; using existing
file (" . dirname($filename) . ")\n";
+ warn "$progname: found file where directory expected; using
existing file (" . dirname($filename) . ")\n";
$bug2filename{$msg} = dirname($filename);
} else {
$bug2filename{$msg} = $filename;
@@ -3098,7 +3098,7 @@ sub download_attachments {
my $content_length = defined $response->content ?
length($response->content) : 0;
if ($content_length == 0) {
- warn "bts: failed to download $ref, skipping\n";
+ warn "$progname: failed to download $ref, skipping\n";
next;
}
@@ -3112,11 +3112,11 @@ sub download_attachments {
}
mkpath(dirname $bug2filename{$msg});
open OUT_CACHE, ">$bug2filename{$msg}"
- or die "bts: open cache $bug2filename{$msg}\n";
+ or die "$progname: open cache $bug2filename{$msg}\n";
print OUT_CACHE $data;
close OUT_CACHE;
} else {
- warn "bts: failed to download $ref, skipping\n";
+ warn "$progname: failed to download $ref, skipping\n";
next;
}
}
@@ -3132,11 +3132,11 @@ sub download_mbox {
my $temp = shift; # do we wish to store it in cache or in a temp file?
my $mboxfile = mboxfile($thing);
- die "bts: trying to download mbox for illegal bug number $thing.\n"
+ die "$progname: trying to download mbox for illegal bug number $thing.\n"
unless $mboxfile;
if (! have_lwp()) {
- die "bts: couldn't run bts --mbox: $lwp_broken\n";
+ die "$progname: couldn't run bts --mbox: $lwp_broken\n";
}
init_agent() unless $ua;
@@ -3146,7 +3146,7 @@ sub download_mbox {
my $content_length = defined $response->content ?
length($response->content) : 0;
if ($content_length == 0) {
- die "bts: failed to download mbox.\n";
+ die "$progname: failed to download mbox.\n";
}
my ($fh, $filename);
@@ -3157,18 +3157,18 @@ sub download_mbox {
UNLINK => 1);
# Use filehandle for security
open (OUT_MBOX, ">&", $fh)
- or die "bts: writing to temporary file: $!\n";
+ or die "$progname: writing to temporary file: $!\n";
} else {
$filename = $mboxfile;
open (OUT_MBOX, ">$mboxfile")
- or die "bts: writing to mbox file $mboxfile: $!\n";
+ or die "$progname: writing to mbox file $mboxfile: $!\n";
}
print OUT_MBOX $response->content;
close OUT_MBOX;
return ($fh, $filename);
} else {
- die "bts: failed to download mbox.\n";
+ die "$progname: failed to download mbox.\n";
}
}
@@ -3271,7 +3271,7 @@ sub deletecache {
my $thgopts=shift || '';
if (! -d $cachedir) {
- die "bts: deletecache() called but no cachedir!\n";
+ die "$progname: deletecache() called but no cachedir!\n";
}
delete_timestamp($thing,$thgopts);
@@ -3288,7 +3288,7 @@ sub deletecache {
sub cachefile {
my $thing=shift;
my $thgopts=shift || '';
- if ($thing eq '') { die "bts: cachefile given empty argument\n"; }
+ if ($thing eq '') { die "$progname: cachefile given empty argument\n"; }
if ($thing =~ /bugs.css$/) { return $cachedir."bugs.css" }
$thing =~ s/^src:/src_/;
$thing =~ s/^from:/from_/;
@@ -3310,7 +3310,7 @@ sub mboxfile {
# Given a bug number, returns the dirname for it in the cache.
sub cachebugdir {
my $thing=shift;
- if ($thing !~ /^\d+$/) { die "bts: cachebugdir given faulty argument:
$thing\n"; }
+ if ($thing !~ /^\d+$/) { die "$progname: cachebugdir given faulty
argument: $thing\n"; }
return $cachedir.$thing;
}
@@ -3374,7 +3374,7 @@ sub bugs_from_thing {
if (-f $cachefile) {
local $/;
- open (IN, $cachefile) || die "bts: open $cachefile: $!\n";
+ open (IN, $cachefile) || die "$progname: open $cachefile: $!\n";
my $data=<IN>;
close IN;
@@ -3454,7 +3454,7 @@ sub href_to_filename {
}
else {
$href =~ s/>.*/>/s;
- warn "bts: in href_to_filename: unrecognised BTS URL type: $href\n";
+ warn "$progname: in href_to_filename: unrecognised BTS URL type:
$href\n";
return undef;
}
}
@@ -3498,7 +3498,7 @@ sub browse {
if ($thing eq '') {
if ($thgopts ne '') {
- die "bts: you can only give options for a BTS page if you specify a
bug/maint/... .\n";
+ die "$progname: you can only give options for a BTS page if you
specify a bug/maint/... .\n";
}
runbrowser($btsurl);
return;
@@ -3508,13 +3508,13 @@ sub browse {
my $cachefile=cachefile($thing,$thgopts);
my $mboxfile=mboxfile($thing);
if ($mboxmode and ! $mboxfile) {
- die "bts: you can only request a mailbox for a single bug report.\n";
+ die "$progname: you can only request a mailbox for a single bug
report.\n";
}
# Check that if we're requesting a tag, that it's a valid tag
if (($thing.$thgopts) =~ /(?:^|;)(?:tag|include|exclude)[:=]([^;]*)/) {
unless (exists $valid_tags{$1}) {
- die "bts: invalid tag requested: $1\nRecognised tag names are: " .
join(" ", @valid_tags) . "\n";
+ die "$progname: invalid tag requested: $1\nRecognised tag names
are: " . join(" ", @valid_tags) . "\n";
}
}
@@ -3522,11 +3522,11 @@ sub browse {
if ($offlinemode) {
$livedownload = 0;
if (! $hascache) {
- die "bts: Sorry, you are in offline mode and have no cache.\nRun
\"bts cache\" or \"bts show\" to create one.\n";
+ die "$progname: Sorry, you are in offline mode and have no
cache.\nRun \"bts cache\" or \"bts show\" to create one.\n";
}
elsif ((! $mboxmode and ! -r $cachefile) or
($mboxmode and ! -r $mboxfile)) {
- die "bts: Sorry, you are in offline mode and that is not
cached.\nUse \"bts [--cache-mode=...] cache\" to update the cache.\n";
+ die "$progname: Sorry, you are in offline mode and that is not
cached.\nUse \"bts [--cache-mode=...] cache\" to update the cache.\n";
}
if ($mboxmode) {
runmailreader($mboxfile);
@@ -3539,12 +3539,12 @@ sub browse {
if (! $hascache) {
if (! -d dirname($cachedir)) {
unless (mkdir(dirname($cachedir))) {
- warn "bts: couldn't mkdir ".dirname($cachedir).": $!\n";
+ warn "$progname: couldn't mkdir ".dirname($cachedir).":
$!\n";
goto LIVE;
}
}
unless (mkdir($cachedir)) {
- warn "bts: couldn't mkdir $cachedir: $!\n";
+ warn "$progname: couldn't mkdir $cachedir: $!\n";
goto LIVE;
}
}
@@ -3563,7 +3563,7 @@ sub browse {
# Use filehandle for security
open (OUT_LIVE, ">&", $fh)
- or die "bts: writing to temporary file: $!\n";
+ or die "$progname: writing to temporary file: $!\n";
# Correct relative urls to point to the bts.
$live =~ s%\shref="(?:/cgi-bin/)?(\w+\.cgi)%
href="$btscgiurl$1%g;
print OUT_LIVE $live;
@@ -3606,12 +3606,12 @@ sub prunecache {
my $oldcwd = getcwd;
- chdir($cachedir) || die "bts: chdir $cachedir: $!\n";
+ chdir($cachedir) || die "$progname: chdir $cachedir: $!\n";
# remove the now-defunct live-download file
unlink "live_download.html";
- opendir DIR, '.' or die "bts: opendir $cachedir: $!\n";
+ opendir DIR, '.' or die "$progname: opendir $cachedir: $!\n";
my @cachefiles = grep { ! /^\.\.?$/ } readdir(DIR);
closedir DIR;
@@ -3636,7 +3636,7 @@ sub prunecache {
}
}
- warn "bts: unexpected files/dirs in cache directory $cachedir:\n " .
+ warn "$progname: unexpected files/dirs in cache directory $cachedir:\n " .
join("\n ", keys %weirdfiles) . "\n"
if keys %weirdfiles;
@@ -3649,7 +3649,7 @@ sub prunecache {
# We now remove the oldfiles if they're automatically downloaded
tie (%timestamp, "Devscripts::DB_File_Lock", $timestampdb,
O_RDWR()|O_CREAT(), 0600, $DB_HASH, "write")
- or die "bts: couldn't open DB file $timestampdb for writing: $!\n"
+ or die "$progname: couldn't open DB file $timestampdb for writing: $!\n"
if ! tied %timestamp;
my @unrecognised;
@@ -3668,10 +3668,10 @@ sub prunecache {
untie %timestamp;
if (! -e $prunestamp) {
- open PRUNESTAMP, ">$prunestamp" || die "bts: prune timestamp: $!\n";
+ open PRUNESTAMP, ">$prunestamp" || die "$progname: prune timestamp:
$!\n";
close PRUNESTAMP;
}
- chdir $oldcwd || die "bts: chdir $oldcwd: $!\n";
+ chdir $oldcwd || die "$progname: chdir $oldcwd: $!\n";
utime time, time, $prunestamp;
}
@@ -3688,11 +3688,11 @@ sub runbrowser {
sub runmailreader {
my $file = shift;
my $quotedfile;
- die "bts: could not read mbox file!\n" unless -r $file;
+ die "$progname: could not read mbox file!\n" unless -r $file;
if ($file !~ /\'/) { $quotedfile = qq['$file']; }
elsif ($file !~ /[\"\\\$\'\!]/) { $quotedfile = qq["$file"]; }
- else { die "bts: could not figure out how to quote the mbox filename
\"$file\"\n"; }
+ else { die "$progname: could not figure out how to quote the mbox filename
\"$file\"\n"; }
my $reader = $mailreader;
$reader =~ s/\%([%s])/$1 eq '%' ? '%' : $quotedfile/eg;
@@ -3719,7 +3719,7 @@ sub get_timestamp {
} else {
tie (%timestamp, "Devscripts::DB_File_Lock", $timestampdb,
O_RDONLY(), 0600, $DB_HASH, "read")
- or die "bts: couldn't open DB file $timestampdb for reading: $!\n";
+ or die "$progname: couldn't open DB file $timestampdb for reading:
$!\n";
($timestamp, $versionstamp) = split /;/, $timestamp{$thing.$thgopts}
if exists $timestamp{$thing.$thgopts};
@@ -3741,7 +3741,7 @@ sub set_timestamp {
} else {
tie (%timestamp, "Devscripts::DB_File_Lock", $timestampdb,
O_RDWR()|O_CREAT(), 0600, $DB_HASH, "write")
- or die "bts: couldn't open DB file $timestampdb for writing: $!\n";
+ or die "$progname: couldn't open DB file $timestampdb for writing:
$!\n";
$timestamp{$thing.$thgopts} = "$timestamp;$versionstamp";
@@ -3758,7 +3758,7 @@ sub delete_timestamp {
} else {
tie (%timestamp, "Devscripts::DB_File_Lock", $timestampdb,
O_RDWR()|O_CREAT(), 0600, $DB_HASH, "write")
- or die "bts: couldn't open DB file $timestampdb for writing: $!\n";
+ or die "$progname: couldn't open DB file $timestampdb for writing:
$!\n";
delete $timestamp{$thing.$thgopts};
@@ -3872,7 +3872,7 @@ sub init_agent {
sub opts_done {
if (@_) {
- die "bts: unknown options to '$command[$index]': @_\n";
+ die "$progname: unknown options to '$command[$index]': @_\n";
}
}
@@ -3883,12 +3883,12 @@ sub edit {
SUFFIX => ".mail",
DIR => File::Spec->tmpdir);
open(OUT_MAIL, ">$filename")
- or die "bts: writing to temporary file: $!\n";
+ or die "$progname: writing to temporary file: $!\n";
print OUT_MAIL $message;
close OUT_MAIL;
system("sensible-editor $filename");
open(OUT_MAIL, "<$filename")
- or die "bts: reading from temporary file: $!\n";
+ or die "$progname: reading from temporary file: $!\n";
$message = "";
while(<OUT_MAIL>) {
$message .= $_;
diff --git a/scripts/mass-bug.pl b/scripts/mass-bug.pl
index b1e9fa4..a969529 100755
--- a/scripts/mass-bug.pl
+++ b/scripts/mass-bug.pl
@@ -330,7 +330,7 @@ sub mailbts {
if (! defined $pid) {
die "$progname: Couldn't fork: $!\n";
}
- $SIG{'PIPE'} = sub { die "bts: pipe for $sendmailcmd broke\n"; };
+ $SIG{'PIPE'} = sub { die "$progname: pipe for $sendmailcmd broke\n"; };
if ($pid) {
# parent
print MAIL <<"EOM";
@@ -356,9 +356,9 @@ EOM
}
my $pid = open(MAIL, "|-");
if (! defined $pid) {
- die "bts: Couldn't fork: $!\n";
+ die "$progname: Couldn't fork: $!\n";
}
- $SIG{'PIPE'} = sub { die "bts: pipe for mail broke\n"; };
+ $SIG{'PIPE'} = sub { die "$progname: pipe for mail broke\n"; };
if ($pid) {
# parent
print MAIL $body;
--
Git repository for devscripts
--
To unsubscribe, send mail to [email protected].