retitle 482587 [mass-bug] provide patterns for epoch, upstream version and
debian revision
tags 482587 + patch
thanks
Please find attached a patch for this and a new --no-wrap option. The
word-wrapping sucks when you want to give a command-line output in the
template.
Cheers,
--
Raphaël Hertzog
Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/
--- /usr/bin/mass-bug 2008-05-19 21:06:12.000000000 +0200
+++ /home/rhertzog/bin/mass-bug 2008-05-23 22:01:22.000000000 +0200
@@ -45,12 +45,17 @@
The template file is the body of the message that will be sent for each bug
report, excluding the BTS pseudo-headers. In the template, #PACKAGE# is
replaced with the name of the package. If a version was specified for
-the package, #VERSION# will be replaced by that version.
+the package, #VERSION# will be replaced by that version. You can also
+use #EPOCH#, #UPSTREAM_VERSION# and #REVISION#: they correspond to the
+respective part of the version number. #EPOCH# includes the trailing
+colon and #REVISION# the leading dash so that
+#EPOCH#UPSTREAM_VERSION##REVISION# is always the same as #VERSION#.
Note that text in the template will be automatically word-wrapped to 70
columns, up to the start of a signature (indicated by S<'-- '> at the
start of a line on its own). This is another reason to avoid including
-BTS pseudo-headers in your template.
+BTS pseudo-headers in your template. You can disable this behaviour
+with --no-wrap.
=head1 OPTIONS
@@ -96,6 +101,10 @@
Specify the sendmail command. The command will be split on white
space and will not be passed to a shell. Default is '/usr/sbin/sendmail'.
+=item --no-wrap
+
+Do not wrap the template to lines of 70 characters.
+
=item --no-conf, --noconf
Do not read any configuration files. This can only be used as the
@@ -171,6 +180,7 @@
--usertags=usertags Set the BTS pseudo-header for usertags
--sendmail=cmd Sendmail command to use (default /usr/sbin/sendmail)
+ --no-wrap Don't wrap the template to 70 chars.
--no-conf, --noconf Don\'t read devscripts config files;
must be the first option given
--help Display this message
@@ -268,21 +278,28 @@
my $tags=shift;
my $user=shift;
my $usertags=shift;
+ my $nowrap=shift;
my $version="";
my $bugtext;
$version = $versions{$package} || "";
+ my ($epoch, $upstream, $revision) = ($version =~
/^(\d+:)?(.+?)(-[^-]+)?$/);
$template_text=~s/#PACKAGE#/$package/g;
$template_text=~s/#VERSION#/$version/g;
+ $template_text=~s/#EPOCH#/$epoch/g;
+ $template_text=~s/#UPSTREAM_VERSION#/$upstream/g;
+ $template_text=~s/#REVISION#/$revision/g;
$version = "Version: $version\n" if $version;
- if ($template_text =~ /\A(.*?)(^-- $)(.*)/ms) { # there's a sig involved
- my ($presig, $sig) = ($1, $2 . $3);
- $template_text=fill("", "", $presig) . "\n" . $sig;
- } else {
- $template_text=fill("", "", $template_text);
+ unless ($nowrap) {
+ if ($template_text =~ /\A(.*?)(^-- $)(.*)/ms) { # there's a sig involved
+ my ($presig, $sig) = ($1, $2 . $3);
+ $template_text=fill("", "", $presig) . "\n" . $sig;
+ } else {
+ $template_text=fill("", "", $template_text);
+ }
}
$bugtext = "Package: $package\n$version" . "Severity:
$severity\n$tags$user$usertags\n$template_text";
return $bugtext;
@@ -352,6 +369,7 @@
my $user="";
my $usertags="";
my $opt_sendmail;
+my $nowrap="";
if (! GetOptions(
"display" => sub { $mode="display" },
"send" => sub { $mode="send" },
@@ -363,6 +381,7 @@
"sendmail=s" => \$opt_sendmail,
"help" => sub { usage(); exit 0; },
"version" => sub { version(); exit 0; },
+ "no-wrap" => sub { $nowrap=1; },
)) {
usageerror();
}
@@ -442,7 +461,7 @@
print "To: $submission_email\n";
print "Subject: ".gen_subject($subject, $package)."\n";
print "\n";
- print gen_bug($template_text, $package, $severity, $tags, $user,
$usertags)."\n";
+ print gen_bug($template_text, $package, $severity, $tags, $user,
$usertags, $nowrap)."\n";
}
if ($mode eq 'display') {
@@ -474,7 +493,7 @@
foreach my $package (@packages) {
print "Sending bug for $package ...\n";
mailbts(gen_subject($subject, $package),
- gen_bug($template_text, $package, $severity, $tags, $user,
$usertags),
+ gen_bug($template_text, $package, $severity, $tags, $user,
$usertags, $nowrap),
$submission_email, $from);
}
print "All bugs sent.\n";