chiark / gitweb /
WIP before only some args then --
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 16 Nov 2016 21:47:49 +0000 (21:47 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 18 Jul 2017 20:39:48 +0000 (21:39 +0100)
dgit

diff --git a/dgit b/dgit
index 9c7ec734e9f52c4371a31e817a3a392981c0f399..51a8271b8b9163ac97008b0bb56e8ceac085840e 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6208,7 +6208,8 @@ sub cmd_build_source {
     printdone "source built, results in $dscfn and $sourcechanges";
 }
 
-sub cmd_sbuild {
+sub external_binbuilder (&$) {
+    my ($fn, $postbuild_msg) = @_;
     build_source();
     midbuild_checkchanges();
     in_parent {
@@ -6216,16 +6217,57 @@ sub cmd_sbuild {
            stat_exists $dscfn or fail "$dscfn (in parent directory): $!";
            stat_exists $sourcechanges
                or fail "$sourcechanges (in parent directory): $!";
+           $fn->();
        }
-       runcmd_ordryrun_local @sbuild, qw(-d), $isuite, @ARGV, $dscfn;
     };
     maybe_unapply_patches_again();
     in_parent {
-       postbuild_mergechanges(<<END);
+       postbuild_mergechanges $postbuild_msg;
+    };
+}
+
+sub cmd_sbuild {
+    external_binbuilder {
+       runcmd_ordryrun_local @sbuild, qw(-d), $isuite, @ARGV, $dscfn;
+    }, <<END;
 perhaps you need to pass -A ?  (sbuild's default is to build only
 arch-specific binaries; dgit 1.4 used to override that.)
 END
-    };
+}    
+
+our $pbuild_opt;
+our $pbuild_arg;
+
+sub pb_arg_val ($) {
+    my ($r) = @_;
+    if (m/^$r$/) {
+       badusage "missing value for pbuilder option $_" unless @ARGV;
+       $pbuild_opt = $&;
+       $pbuild_arg = shift @ARGV;
+       return 1;
+    }
+    if (m/^($r)=/) {
+       $pbuild_opt = $1;
+       $pbuild_arg = $';
+       return 1;
+    }
+    return 0;
+}
+
+sub cmd_pbuild {
+    my $ar = qr{(?:=(.*))?$};
+    while (@ARGV) {
+       $_ = shift @ARGV;
+       if (m/^--/) {
+           if (pb_arg_val qr{basetgz|buildplace}) {
+               push @pb_opts, $pbuild_opt, $pbuild_arg;
+           } elsif (m/^--buildresult$ar/o) {
+               $buildproductsdir //= $pbuild_arg;
+           } 
+               
+    external_binbuilder {
+       runcmd_ordryrun_local @sbuild, qw(-d), $isuite, @pbuild_opts, $dscfn;
+    }, "";
 }    
 
 sub cmd_quilt_fixup {