control: tag -1 +patch

Hello,

On Thu 09 Mar 2017 at 11:58PM +0100, Mattia Rizzolo wrote:

> I build my packages with pbuilder, and it is set up to put the results
> in ~/pbuilder/results/$distribution/$architecture/.  I'd like dgit to go
> look for the .changes to upload there, and I currently accomplish that
> by passing `--build-products-dir ~/pbuilder/result/sid/amd64` to
> `dgit push`.  I'd like to configure that statically, so I don't have to
> keep specifying it.

Here are patches implementing this.

-- 
Sean Whitton
From 90f2e4779ce807671eef958a6c01ed77a5ae485f 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   |  7 ++++++-
 dgit.1 | 11 +++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/dgit b/dgit
index 357adc9..01b5499 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;
@@ -6096,6 +6096,11 @@ sub build_or_push_prep_early () {
     $isuite = getfield $clogp, 'Distribution';
     $package = getfield $clogp, 'Source';
     $version = getfield $clogp, 'Version';
+    if (!defined $buildproductsdir) {
+        local $access_forpush;
+        my $bpd_from_cfg = access_cfg('build-products-dir', 'RETURN-UNDEF');
+        $buildproductsdir = $bpd_from_cfg // '..';
+    }
 }
 
 sub build_prep_early () {
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 247c68ea4610148e89cdaaa50650a4f0c5c63583 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhit...@spwhitton.name>
Date: Mon, 23 Jul 2018 16:42:33 +0800
Subject: [PATCH 2/2] test suite: add push-buildproductsdir-conf

Based on push-buildproductsdir.

Signed-off-by: Sean Whitton <spwhit...@spwhitton.name>
---
 debian/tests/control                   |  2 +-
 tests/tests/push-buildproductsdir-conf | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100755 tests/tests/push-buildproductsdir-conf

diff --git a/debian/tests/control b/debian/tests/control
index dfd73bb..eb76fac 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -60,7 +60,7 @@ Tests: trustingpolicy-replay
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, dput-ng
 
-Tests: absurd-gitapply badcommit-rewrite build-modes build-modes-asplit build-modes-gbp-asplit checkout clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct drs-clone-nogit drs-push-masterupdate drs-push-rejects dsd-clone-nogit dsd-divert fetch-localgitonly fetch-somegit-notlast gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite newtag-clone-nogit oldnewtagalt oldtag-clone-nogit orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version protocol-compat push-buildproductsdir push-newpackage push-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush sourceonlypolicy tag-updates test-list-uptodate unrepresentable version-opt
+Tests: absurd-gitapply badcommit-rewrite build-modes build-modes-asplit build-modes-gbp-asplit checkout clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct drs-clone-nogit drs-push-masterupdate drs-push-rejects dsd-clone-nogit dsd-divert fetch-localgitonly fetch-somegit-notlast gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite newtag-clone-nogit oldnewtagalt oldtag-clone-nogit orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version protocol-compat push-buildproductsdir push-buildproductsdir-conf push-newpackage push-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush sourceonlypolicy tag-updates test-list-uptodate unrepresentable version-opt
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc
 
diff --git a/tests/tests/push-buildproductsdir-conf b/tests/tests/push-buildproductsdir-conf
new file mode 100755
index 0000000..a86b940
--- /dev/null
+++ b/tests/tests/push-buildproductsdir-conf
@@ -0,0 +1,32 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-archive pari-extra 3-1
+t-git pari-extra 3-1
+
+t-dgit clone $p
+
+cd $p
+t-cloned-fetched-good
+
+v=3-2~dummy1
+t-apply-diff 3-1 $v
+debcommit -a
+
+t-refs-same-start
+t-ref-head
+
+t-dgit --dpkg-buildpackage:-d build
+
+cd ..
+mkdir bpd
+mv $p*_* bpd/
+cd $p
+
+git config --local dgit.default.build-products-dir ../bpd
+t-dgit push
+
+t-pushed-good dgit/sid
+
+t-ok
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

Reply via email to