chiark / gitweb /
gbp options: Provide --gbp-build
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Oct 2016 21:28:33 +0000 (22:28 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Oct 2016 22:05:47 +0000 (23:05 +0100)
And, provide the sub opts_opt_multi_cmd to help with options of this
kind.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 2ff76ae..653f4ce 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -98,6 +98,7 @@ our (@dpkgsource) = qw(dpkg-source -i\.git/ -I.git);
 our (@dpkggenchanges) = qw(dpkg-genchanges);
 our (@mergechanges) = qw(mergechanges -f);
 our (@gbp) = qw(gbp);
+our (@gbp_build) = ('');
 our (@changesopts) = ('');
 
 our %opts_opt_map = ('dget' => \@dget, # accept for compatibility
@@ -113,6 +114,7 @@ our %opts_opt_map = ('dget' => \@dget, # accept for compatibility
                      'dpkg-buildpackage' => \@dpkgbuildpackage,
                      'dpkg-genchanges' => \@dpkggenchanges,
                      'gbp' => \@gbp,
+                     'gbp-build' => \@gbp_build,
                      'ch' => \@changesopts,
                      'mergechanges' => \@mergechanges);
 
@@ -246,6 +248,13 @@ sub quiltmode_splitbrain () {
     $quilt_mode =~ m/gbp|dpm|unapplied/;
 }
 
+sub opts_opt_multi_cmd {
+    my @cmd;
+    push @cmd, split /\s+/, shift @_;
+    push @cmd, @_;
+    @cmd;
+}
+
 sub gbp_pq {
     return (@gbp, qw(pq));
 }
@@ -4606,12 +4615,15 @@ sub cmd_gbp_build {
 
     my $wantsrc = massage_dbp_args \@dbp, \@ARGV;
 
-    my @cmd;
-    if (length executable_on_path('git-buildpackage')) {
-       @cmd = qw(git-buildpackage);
-    } else {
-       @cmd = qw(gbp buildpackage);
+    if (!length $gbp_build[0]) {
+       if (length executable_on_path('git-buildpackage')) {
+           $gbp_build[0] = qw(git-buildpackage);
+       } else {
+           $gbp_build[0] = 'gbp buildpackage';
+       }
     }
+    my @cmd = opts_opt_multi_cmd @gbp_build;
+
     push @cmd, (qw(-us -uc --git-no-sign-tags), "--git-builder=@dbp");
 
     if ($wantsrc > 0) {