Hello Ian, On Mon 23 Jul 2018 at 11:16AM +0100, Ian Jackson wrote:
> Why does the setting of $buildproductsdir need to be done in > build_or_push_prep_early, before pushing or notpushing ? I guess it > wouldn't make sense to have different settings, but the business with > localising $access_forpush is a wrinkle which is best avoided where > possible. > > So I think it might be better to introduce build_or_push_prep, > which I guess would be called in prep_push after pushing and in > build_prep after build_prep_early. Good, I'm happy to avoid localising $access_forpush indeed. > Style: I normally spell: > > + my $bpd_from_cfg = access_cfg('build-products-dir', 'RETURN-UNDEF'); > + $buildproductsdir = $bpd_from_cfg // '..'; > > like this: > > + $buildproductsdir = access_cfg('build-products-dir', 'RETURN-UNDEF') > // '..'; > > And then, > > + if (!defined $buildproductsdir) { > * $buildproductsdir = access_cfg('build-products-dir', 'RETURN-UNDEF') > // '..'; > + } > > could be spelled > > * $buildproductsdir //= access_cfg('build-products-dir', 'RETURN-UNDEF') > // '..'; > > or > > * $buildproductsdir //= access_cfg('build-products-dir', 'RETURN-UNDEF'); > * $buildproductsdir //= '..'; I find this style obscure. But I guess it is good to be consistent with the rest of the script. Changed. > I don't much like the new test case because it's a whole new test case > just for this. I think it would be better to add the configuration > option for a cross-section of existing tests. > > Probably, that would be, > * introduce a new t-buildproductsdir-config subroutine > * add it to the top of a selection of existing tests > > Do you want me to do that ? I've written the routine; it is probably best if you choose where to add it. -- Sean Whitton
From fe2c1726319f0702a5c715f5204e3b64d9d07509 Mon Sep 17 00:00:00 2001 From: Sean Whitton <spwhit...@spwhitton.name> Date: Mon, 23 Jul 2018 12:10:02 +0800 Subject: [PATCH 1/2] dgit: add dgit.default.build-products-dir git configuration key Signed-off-by: Sean Whitton <spwhit...@spwhitton.name> --- dgit | 9 ++++++++- dgit.1 | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dgit b/dgit index 357adc9..a3d3b6b 100755 --- a/dgit +++ b/dgit @@ -63,7 +63,7 @@ our @ropts; our $sign = 1; our $dryrun_level = 0; our $changesfile; -our $buildproductsdir = '..'; +our $buildproductsdir; our $new_package = 0; our $ignoredirty = 0; our $rmonerror = 1; @@ -4715,6 +4715,7 @@ sub prep_push () { parseopts(); build_or_push_prep_early(); pushing(); + build_or_push_prep(); check_not_dirty(); my $specsuite; if (@ARGV==0) { @@ -6088,6 +6089,11 @@ sub cmd_clean () { maybe_unapply_patches_again(); } +sub build_or_push_prep () { + $buildproductsdir //= access_cfg('build-products-dir', 'RETURN-UNDEF'); + $buildproductsdir //= '..'; +} + sub build_or_push_prep_early () { our $build_or_push_prep_early_done //= 0; return if $build_or_push_prep_early_done++; @@ -6106,6 +6112,7 @@ sub build_prep_early () { sub build_prep () { build_prep_early(); + build_or_push_prep(); clean_tree(); build_maybe_quilt_fixup(); if ($rmchanges) { diff --git a/dgit.1 b/dgit.1 index 1460938..ddb0c0a 100644 --- a/dgit.1 +++ b/dgit.1 @@ -842,6 +842,11 @@ regardless of this option. Specifies where to find the built files to be uploaded. By default, dgit looks in the parent directory .RB ( .. ). + +Also see the +.BI dgit.default.build-products-dir +configuration option +(which this command line option overrides). .TP .BI --no-rm-on-error Do not delete the destination directory if clone fails. @@ -1096,6 +1101,12 @@ on the dgit command line. .LP Settings likely to be useful for an end user include: .TP +.BI dgit.default.build-products-dir +Specifies where to find the built files to be uploaded, +when --build-products-dir is not specified. The default is +the parent directory +.RB ( .. ). +.TP .BR dgit-suite. \fIsuite\fR .distro " \fIdistro\fR" Specifies the distro for a suite. dgit keys off the suite name (which appears in changelogs etc.), and uses that to determine the distro -- 2.11.0
From 2551bbde4f9fed0732e10defa7e2ed2191a12775 Mon Sep 17 00:00:00 2001 From: Sean Whitton <spwhit...@spwhitton.name> Date: Tue, 24 Jul 2018 11:15:56 +0800 Subject: [PATCH 2/2] test suite lib: add t-buildproductsdir-config Signed-off-by: Sean Whitton <spwhit...@spwhitton.name> --- tests/lib | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/lib b/tests/lib index 99345ce..3fda1bc 100644 --- a/tests/lib +++ b/tests/lib @@ -1164,3 +1164,8 @@ for import in ${autoimport-gnupg}; do ;; esac done + +t-buildproductsdir-config () { + # use --local, not t-git-config, because the value is relative + git config --local dgit.default.build-products-dir ../bpd +} -- 2.11.0
signature.asc
Description: PGP signature