diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2018-07-27 12:35:12 +0800 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2018-07-28 18:18:11 +0800 |
commit | 7d91c1c8dc443ac42873e9833a909e47c63a49a1 (patch) | |
tree | 9bd80dd14a9baff7bc1161b9c734ebd4b10c5679 /dgit | |
parent | 0fff95723de605e7239934f05b506a01bfec9ec9 (diff) |
dgit: new 'pbuilder' and 'cowbuilder' subcommands
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 42 |
1 files changed, 39 insertions, 3 deletions
@@ -129,6 +129,8 @@ our (@mergechanges) = qw(mergechanges -f); our (@gbp_build) = (''); our (@gbp_pq) = ('gbp pq'); our (@changesopts) = (''); +our (@pbuilder) = ("sudo -E pbuilder"); +our (@cowbuilder) = ("sudo -E cowbuilder"); our %opts_opt_map = ('dget' => \@dget, # accept for compatibility 'curl' => \@curl, @@ -148,7 +150,9 @@ our %opts_opt_map = ('dget' => \@dget, # accept for compatibility 'gbp-build' => \@gbp_build, 'gbp-pq' => \@gbp_pq, 'ch' => \@changesopts, - 'mergechanges' => \@mergechanges); + 'mergechanges' => \@mergechanges, + 'pbuilder' => \@pbuilder, + 'cowbuilder' => \@cowbuilder); our %opts_opt_cmdonly = ('gpg' => 1, 'git' => 1); our %opts_cfg_insertpos = map { @@ -571,6 +575,7 @@ main usages: dgit [dgit-opts] fetch|pull [dgit-opts] [suite] dgit [dgit-opts] build [dpkg-buildpackage-opts] dgit [dgit-opts] sbuild [sbuild-opts] + dgit [dgit-opts] pbuilder|cowbuilder [debbuildopts] dgit [dgit-opts] push [dgit-opts] [suite] dgit [dgit-opts] push-source [dgit-opts] [suite] dgit [dgit-opts] rpush build-host:build-dir ... @@ -6475,13 +6480,13 @@ sub cmd_push_source { sub cmd_sbuild { build_prep_early(); - build_with_binary_builder(\@sbuild, <<END, qw(-d), $isuite, @ARGV, $dscfn); + binary_builder(\@sbuild, <<END, qw(-d), $isuite, @ARGV, $dscfn); perhaps you need to pass -A ? (sbuild's default is to build only arch-specific binaries; dgit 1.4 used to override that.) END } -sub build_with_binary_builder ($$$) { +sub binary_builder { my ($bbuilder, $pbmc_msg, @args) = @_; build_prep(WANTSRC_SOURCE); build_source(); @@ -6500,6 +6505,37 @@ sub build_with_binary_builder ($$$) { }; } +sub pbuilder ($) { + my ($pbuilder) = @_; + build_prep_early(); + # @ARGV is allowed to contain only things that should be passed to + # pbuilder under debbuildopts; just massage those + my $wantsrc = massage_dbp_args \@ARGV; + fail "you asked for a builder but your debbuildopts didn't ask for". + " any binaries -- is this really what you meant?" + unless $wantsrc & WANTSRC_BUILDER; + fail "we must build a .dsc to pass to the builder but your debbuiltopts". + " forbids the building of a source package; cannot continue" + unless $wantsrc & WANTSRC_SOURCE; + # We do not want to include the verb "build" in @pbuilder because + # the user can customise @pbuilder and they shouldn't be required + # to include "build" in their customised value. However, if the + # user passes any additional args to pbuilder using the dgit + # option --pbuilder:foo, such args need to come after the "build" + # verb. opts_opt_multi_cmd does all of that. + binary_builder([opts_opt_multi_cmd ["build"], @$pbuilder], undef, + qw(--debbuildopts), "@ARGV", qw(--distribution), $isuite, + $dscfn); +} + +sub cmd_pbuilder { + pbuilder(\@pbuilder); +} + +sub cmd_cowbuilder { + pbuilder(\@cowbuilder); +} + sub cmd_quilt_fixup { badusage "incorrect arguments to dgit quilt-fixup" if @ARGV; build_prep_early(); |