From 95cce6041df774f7909b28c110417881f1d4792a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 19 Jan 2014 00:16:38 +0000 Subject: Provide --build-products-dir option (and corresponding semantics for -C) to specify where to find the files to upload. Closes:#731633. --- dgit | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 19d6b01..5b99ed1 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) { -- cgit v1.2.3