X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=5b99ed1cde43acf7e58f89886542bda82fd0005f;hp=9b895b0350a7bc0cbf8b635b6c60779e648a1b24;hb=95cce6041df774f7909b28c110417881f1d4792a;hpb=c2d43f9859a861f8522c32bb42e9f74fd229b6bf diff --git a/dgit b/dgit index 9b895b03..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; @@ -636,7 +637,7 @@ sub madison_parse ($) { $l =~ m{^ \s*( [^ \t|]+ )\s* \| \s*( [^ \t|]+ )\s* \| \s*( [^ \t|/]+ )(?:/([^ \t|/]+))? \s* \| - \s*( [^ \t|]+ )\s* }x or die "$rmad $?"; + \s*( [^ \t|]+ )\s* }x or die "$rmad ?"; $1 eq $package or die "$rmad $package ?"; my $vsn = $2; my $newsuite = $3; @@ -676,7 +677,7 @@ sub sshpsql ($$) { printdebug("$debugprefix>|$_|\n"); push @rows, $_; } - $!=0; $?=0; close P or die "$! $?"; + $!=0; $?=0; close P or failedcmd @cmd; @rows or die; my $nrows = pop @rows; $nrows =~ s/^\((\d+) rows?\)$/$1/ or die "$nrows ?"; @@ -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; @@ -1803,7 +1809,7 @@ sub changesopts () { my @vsns = archive_query('archive_query'); if (@vsns) { @vsns = map { $_->[0] } @vsns; - @vsns = sort { version_compare_string($a, $b) } @vsns; + @vsns = sort { -version_compare_string($a, $b) } @vsns; $changes_since_version = $vsns[0]; progress "changelog will contain changes since $vsns[0]"; } else { @@ -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) {