From: Ian Jackson Date: Sun, 19 Jan 2014 00:16:38 +0000 (+0000) Subject: Provide --build-products-dir option (and corresponding semantics for -C) to specify... X-Git-Tag: debian/0.21~8 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=95cce6041df774f7909b28c110417881f1d4792a Provide --build-products-dir option (and corresponding semantics for -C) to specify where to find the files to upload. Closes:#731633. --- diff --git a/debian/changelog b/debian/changelog index aaf0ead3..18ab7866 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ dgit (0.21~~iwj) unstable; urgency=low * Add `Testsuite: autopkgtest' to debian/control. (This will only have the right effect with recent enought dpkg, and will generate a warning with earlier versions of dpkg. + * Provide --build-products-dir option (and corresponding semantics + for -C) to specify where to find the files to upload. Closes:#731633. -- diff --git a/debian/tests/control b/debian/tests/control index 391ac11c..48dbda1d 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,3 @@ -Tests: clone-nogit fetch-localgitonly fetch-somegit-notlast push-newpackage push-nextdgit quilt +Tests: clone-nogit fetch-localgitonly fetch-somegit-notlast push-newpackage push-nextdgit quilt push-buildproductsdir Tests-Directory: tests/tests Depends: @, devscripts diff --git a/dgit b/dgit index 19d6b011..5b99ed1c 100755 --- a/dgit +++ b/dgit @@ -40,6 +40,7 @@ our @ropts; our $sign = 1; our $dryrun_level = 0; our $changesfile; +our $buildproductsdir = '..'; our $new_package = 0; our $ignoredirty = 0; our $noquilt = 0; @@ -1319,13 +1320,14 @@ sub dopush () { my ($clogp, $cversion, $tag, $dscfn) = push_parse_changelog("$clogpfn"); - stat "../$dscfn" or + my $dscpath = "$buildproductsdir/$dscfn"; + stat $dscpath or fail "looked for .dsc $dscfn, but $!;". " maybe you forgot to build"; - responder_send_file('dsc', "../$dscfn"); + responder_send_file('dsc', $dscpath); - push_parse_dsc("../$dscfn", $dscfn, $cversion); + push_parse_dsc($dscpath, $dscfn, $cversion); my $format = getfield $dsc, 'Format'; printdebug "format $format\n"; @@ -1335,7 +1337,8 @@ sub dopush () { check_not_dirty(); changedir $ud; progress "checking that $dscfn corresponds to HEAD"; - runcmd qw(dpkg-source -x --), "../../../../$dscfn"; + runcmd qw(dpkg-source -x --), + $dscpath =~ m#^/# ? $dscpath : "../../../$dscpath"; my ($tree,$dir) = mktree_in_ud_from_only_subdir(); changedir '../../../..'; my @diffcmd = (@git, qw(diff --exit-code), $tree); @@ -1357,19 +1360,22 @@ sub dopush () { # (uploadbranch()); my $head = rev_parse('HEAD'); if (!$changesfile) { - my $multi = "../${package}_".(stripepoch $cversion)."_multi.changes"; + my $multi = "$buildproductsdir/". + "${package}_".(stripepoch $cversion)."_multi.changes"; if (stat "$multi") { $changesfile = $multi; } else { $!==&ENOENT or die "$multi: $!"; my $pat = "${package}_".(stripepoch $cversion)."_*.changes"; - my @cs = glob "../$pat"; + my @cs = glob "$buildproductsdir/$pat"; fail "failed to find unique changes file". - " (looked for $pat in .., or $multi);". + " (looked for $pat in $buildproductsdir, or $multi);". " perhaps you need to use dgit -C" unless @cs==1; ($changesfile) = @cs; } + } else { + $changesfile = "$buildproductsdir/$changesfile"; } responder_send_file('changes',$changesfile); @@ -1384,7 +1390,7 @@ sub dopush () { } else { $tagobjfn = push_mktag($head,$clogp,$tag, - "../$dscfn", + $dscpath, $changesfile,$changesfile, $tfn); } @@ -1402,16 +1408,16 @@ sub dopush () { if (!$we_are_responder) { if (act_local()) { - rename "../$dscfn.tmp","../$dscfn" or die "$dscfn $!"; + rename "$dscpath.tmp",$dscpath or die "$dscfn $!"; } else { - progress "[new .dsc left in $dscfn.tmp]"; + progress "[new .dsc left in $dscpath.tmp]"; } } if ($we_are_responder) { my $dryrunsuffix = act_local() ? "" : ".tmp"; responder_receive_files('signed-dsc-changes', - "../$dscfn$dryrunsuffix", + "$dscpath$dryrunsuffix", "$changesfile$dryrunsuffix"); } else { sign_changes $changesfile; @@ -1969,6 +1975,9 @@ sub parseopts () { } elsif (m/^--distro=(.*)/s) { push @ropts, $_; $idistro = $1; + } elsif (m/^--build-products-dir=(.*)/s) { + push @ropts, $_; + $buildproductsdir = $1; } elsif (m/^--clean=(dpkg-source|git|none)$/s) { push @ropts, $_; $cleanmode = $1; @@ -2017,6 +2026,9 @@ sub parseopts () { } elsif (s/^-C(.*)//s) { push @ropts, $&; $changesfile = $1; + if ($changesfile =~ s#^(.*)/##) { + $buildproductsdir = $1; + } } elsif (s/^-k(.*)//s) { $keyid=$1; } elsif (s/^-wn//s) { diff --git a/dgit.1 b/dgit.1 index 7e74d5b7..b23a3a85 100644 --- a/dgit.1 +++ b/dgit.1 @@ -359,6 +359,20 @@ Specifies the .changes file which is to be uploaded. By default dgit push looks for single .changes file in the parent directory whose filename suggests it is for the right package and version - or, if there is a _multi.changes file, dgit uses that. + +If the specified +.I changesfile +pathname contains slashes, the directory part is also used as +the value for +.BR --build-products-dir ; +otherwise, the changes file is expected in that directory (by +default, in +.BR .. ). +.TP +.BI --build-products-dir= directory +Specifies where to find the built files to be uploaded. +By default, dgit looks in the parent directory +.BR .. ). .TP .BI --existing-package= package dgit push needs to canonicalise the suite name. Sometimes, dgit diff --git a/tests/tests/push-buildproductsdir b/tests/tests/push-buildproductsdir new file mode 100755 index 00000000..987c0818 --- /dev/null +++ b/tests/tests/push-buildproductsdir @@ -0,0 +1,31 @@ +#!/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 + +t-dgit --build-products-dir=../bpd push + +t-pushed-good dgit/sid + +echo ok.