Package: devscripts
Version: 2.10.61
Severity: wishlist
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

It would be nice to have more variables available in debuild's hook
scripts. Today I wanted an epoch-less version -- and since $sversion
is already in the script it might as well be exposed :)

Find attached a quick patch against the version in git that make
$sversion and $uversion availbale for hooks.

Cheers,
gregor


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCAAGBQJLlWU8AAoJELs6aAGGSaoG1FAQAKDwfl+BRSM2ACcKeMc78YxW
eJ0DMc8cOqjMp6LB0Nc4bDC5LKNM4sf8Jdep7Clh87Ax+p7vfygwacUB3hqTDWMv
lGvqji2+lUuR3WnqDYF0rbsCVYviV9XXzJtK9FEc6oaeP21rvQeUXEIFtu1qF4H3
cjV+eszYhssaYOnVAQY0U7Y49UB9CU1muLjgKYir1JMgUJhANOrR22rk0REMlaFm
rn9oHIkEAF3gluBZWKeejQ1dSvicJJyqHboVmvprKKJe4KfBFAu5gqnkDVMxdqMQ
eO0urmqH7iq+pOxoW+E3acZ0ihSF0ghwoB9eHGzw8DEJyFghbXLXnuOlYQlXGnmb
pfSeCdEXoUX/a84KL/JziWnAaA7x+P8NI26lmFTG+QSB4KZiNnNAffr/t6/yl4+x
1ZaoicQt+wCCSxlF74GlJJI1Gu2DoITREO6j1YWymlVIHfZz7nBuA6ABstqMPsB4
NY0VAEmkew9LA9ASU/ylzVngFsZK/dxjObR2dq1BiwqMiDybvTYykEAbJ0q/LmKk
1+MHWP/1UmmrMfoFX0qblDJfaRdR3IeB3jyz+trYL86CsxCAF6kjbraCjeggC+pq
CtkiaYcw5WA6P4cmYOoIAQwjebETZFJeZ4DdNBsBtkVrecJIMGnzzkj5lCGPKggy
SUlCuyoVW91j0xLfVWL6
=xkng
-----END PGP SIGNATURE-----
diff --git a/scripts/debuild.1 b/scripts/debuild.1
index 2dae442..1749c41 100644
--- a/scripts/debuild.1
+++ b/scripts/debuild.1
@@ -197,7 +197,8 @@ for example, DEBUILD_SIGNING_HOOK='foo' (note the hyphens change into
 underscores!) or as a command line option \fB\-\-signing\-hook-foo\fR.
 The command will have certain percent substitutions made on it: %%
 will be replaced by a single % sign, %p will be replaced by the
-package name, %v by the package version number, %a will be 1 if the
+package name, %v by the package version number, %s by the source version
+number, %u by the upstream version number. %a will be 1 if the
 immediately following action is to be performed and 0 if not (for
 example, in the dpkg-source hook, %a will become 1 if dpkg-source is
 to be run and 0 if not).  Then it will be handed to the shell to deal
diff --git a/scripts/debuild.pl b/scripts/debuild.pl
index 446c8b2..56f91b7 100755
--- a/scripts/debuild.pl
+++ b/scripts/debuild.pl
@@ -654,6 +654,8 @@ my $pkg = $changelog{'Source'};
 fatal "no version number in changelog!"
     unless exists $changelog{'Version'};
 my $version = $changelog{'Version'};
+(my $sversion=$version) =~ s/^\d+://;
+(my $uversion=$sversion) =~ s/-[a-z0-9+\.]+$//i;
 
 # Is the directory name acceptable?
 if ($check_dirname_level ==  2 or
@@ -963,10 +965,9 @@ if ($command_version eq 'dpkg') {
 	/^(.*)=(.*)$/ and $ENV{$1} = $2;
     }
 
-    # We need to do the arch, sversion, pv, pva stuff to figure out
+    # We need to do the arch, pv, pva stuff to figure out
     # what the changes file will be called,
-    my ($sversion, $uversion, $dsc, $changes, $build);
-    my $arch;
+    my ($arch, $dsc, $changes, $build);
     if ($sourceonly) {
 	$arch = 'source';
     } else {
@@ -1344,7 +1345,7 @@ sub run_hook ($$) {
     print STDERR " Running $hook-hook\n";
     my $hookcmd = $hook{$hook};
     $act = $act ? 1 : 0;
-    my %per=("%"=>"%", "p"=>$pkg, "v"=>$version, "a"=>$act);
+    my %per=("%"=>"%", "p"=>$pkg, "v"=>$version, "s"=>$sversion, "u"=>$uversion, "a"=>$act);
     $hookcmd =~ s/\%(.)/exists $per{$1} ? $per{$1} :
 	(warn ("Unrecognised \% substitution in hook: \%$1\n"), "\%$1")/eg;
 

Reply via email to