The following commit has been merged in the master branch:
commit dc0216b93a4927335635149b4d9581f40c263612
Author: James Vega <[email protected]>
Date:   Sat Apr 3 18:27:07 2010 -0400

    debuild: Expose two new variables (epoch-less source version, and upstream 
version) to hooks.  Thanks to gregor herrmann for the patch.  (Closes: 573092)

diff --git a/debian/changelog b/debian/changelog
index ead4f5a..98d5e27 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,9 @@ devscripts (2.10.62) UNRELEASED; urgency=low
     (Closes: #570138)
   * debchange: Add maverick as a valid distribution.  Thanks to Benjamin Drung
     for the patch.  (Closes: #576287)
+  * debuild: Expose two new variables (epoch-less source version, and upstream
+    version) to hooks.  Thanks to gregor herrmann for the patch.  (Closes:
+    573092)
 
   [ Patrick Schoenfeld ]
   * nmudiff: Fix "[nmudiff] please include --tagpending option" by applying the
diff --git a/scripts/debuild.1 b/scripts/debuild.1
index 2dae442..40d41c2 100644
--- a/scripts/debuild.1
+++ b/scripts/debuild.1
@@ -197,13 +197,15 @@ 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
-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
-with, so it can include redirections and stuff.  For example, to only
-run the dpkg-source hook if dpkg-source is to be run, the hook could
-be something like: "if [ %a \-eq 1 ]; then ...; fi".
+package name, %v by the package version number, %s by the source
+version number, %u by the upstream version number.  Neither %s nor %u
+will contain an epoch.  %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 with, so it can
+include redirections and stuff.  For example, to only run the
+dpkg-source hook if dpkg-source is to be run, the hook could be
+something like: "if [ %a \-eq 1 ]; then ...; fi".
 .PP
 \fBPlease take care with hooks\fR, as misuse of them can lead to
 packages which FTBFS (fail to build from source).  They can be useful
diff --git a/scripts/debuild.pl b/scripts/debuild.pl
index 446c8b2..63ce75c 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 {
@@ -975,8 +976,6 @@ if ($command_version eq 'dpkg') {
        fatal "couldn't determine host architecture!?" if ! $arch;
     }
 
-    ($sversion=$version) =~ s/^\d+://;
-    ($uversion=$sversion) =~ s/-[a-z0-9+\.]+$//i;
     $dsc = "${pkg}_${sversion}.dsc";
     my $orig_prefix = "${pkg}_${uversion}.orig.tar";
     my $origdir = basename(cwd()) . ".orig";
@@ -1344,7 +1343,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;
 

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to