X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=031380c52e8ef51853d4c4871b694c3dcab89f16;hp=36afdaf04b7ca0961785fc61150f08ab6999c30c;hb=dad4b4972a5716cbafb9b9347cec5d7e90a55b80;hpb=dbee6afd429a8cf4136a040d95ea10fe3a38520e diff --git a/dgit b/dgit index 36afdaf0..031380c5 100755 --- a/dgit +++ b/dgit @@ -2,8 +2,8 @@ # dgit # Integration between git and Debian-style archives # -# Copyright (C)2013-2017 Ian Jackson -# Copyright (C)2017 Sean Whitton +# Copyright (C)2013-2018 Ian Jackson +# Copyright (C)2017-2018 Sean Whitton # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -275,14 +275,16 @@ sub quiltmode_splitbrain () { } sub opts_opt_multi_cmd { + my $extra = shift; my @cmd; push @cmd, split /\s+/, shift @_; + push @cmd, @$extra; push @cmd, @_; @cmd; } sub gbp_pq { - return opts_opt_multi_cmd @gbp_pq; + return opts_opt_multi_cmd [], @gbp_pq; } sub dgit_privdir () { @@ -4756,30 +4758,6 @@ sub cmd_push { dopush(); } -our $sourcechanges; - -sub cmd_push_source { - prep_push(); - fail "dgit push-source: --include-dirty/--ignore-dirty does not make". - "sense with push-source!" if $includedirty; - clean_tree(); - build_maybe_quilt_fixup(); - if ($changesfile) { - my $changes = parsecontrol("$buildproductsdir/$changesfile", - "source changes file"); - unless (test_source_only_changes($changes)) { - fail "user-specified changes file is not source-only"; - } - } else { - # Building a source package is very fast, so just do it - build_source(); - die "er, patches are applied dirtily but shouldn't be.." - if $patches_applied_dirtily; - $changesfile = $sourcechanges; - } - dopush(); -} - #---------- remote commands' implementation ---------- sub pre_remote_push_build_host { @@ -5069,6 +5047,7 @@ sub i_want_signed_dsc_changes { #---------- building etc. ---------- our $version; +our $sourcechanges; our $dscfn; #----- `3.0 (quilt)' handling ----- @@ -6126,6 +6105,7 @@ sub build_or_push_prep_early () { $isuite = getfield $clogp, 'Distribution'; $package = getfield $clogp, 'Source'; $version = getfield $clogp, 'Version'; + $dscfn = dscfn($version); } sub build_prep_early () { @@ -6374,7 +6354,7 @@ sub cmd_gbp_build { $gbp_build[0] = 'gbp buildpackage'; } } - my @cmd = opts_opt_multi_cmd @gbp_build; + my @cmd = opts_opt_multi_cmd [], @gbp_build; push @cmd, (qw(-us -uc --git-no-sign-tags), "--git-builder=".(shellquote @dbp)); @@ -6416,22 +6396,6 @@ sub cmd_gbp_build { } sub cmd_git_build { cmd_gbp_build(); } # compatibility with <= 1.0 -sub move_dsc_to_bpd ($) { - my ($dscfn) = @_; - printdebug "moving $dscfn and all referenced files to ".bpd_abs()."\n"; - $dsc = parsecontrol($dscfn, "source package"); - foreach my $l (split /\n/, getfield $dsc, 'Files') { - $l =~ m/\S+$/ or next; - $l =~ s/.* //; - printdebug "found $l - renaming\n"; - rename "$l", bpd_abs()."/$l" - or fail "put in place new source file ($l): $!"; - } - printdebug "moving $dscfn to ".bpd_abs()."/$dscfn\n"; - rename "$dscfn", bpd_abs()."/$dscfn" - or fail "put in place new source file ($dscfn): $!"; -} - sub building_source_in_playtree { # If $includedirty, we have to build the source package from the # working tree, not a playtree, so that uncommitted changes are @@ -6451,7 +6415,6 @@ sub build_source { unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT or fail "remove $sourcechanges: $!"; } - $dscfn = dscfn($version); my @cmd = (@dpkgsource, qw(-b --)); my $leafdir; if (building_source_in_playtree()) { @@ -6479,9 +6442,23 @@ sub build_source { 'exec >../$1; shift; exec "$@"','x', $sourcechanges, @dpkggenchanges, qw(-S), changesopts(); changedir '..'; - move_dsc_to_bpd($dscfn); - rename "$sourcechanges", bpd_abs()."/$sourcechanges" - or fail "put in place source changes file ($sourcechanges): $!"; + + printdebug "moving $dscfn, $sourcechanges, etc. to ".bpd_abs()."\n"; + $dsc = parsecontrol($dscfn, "source package"); + + my $mv = sub { + my ($why, $l) = @_; + printdebug " renaming ($why) $l\n"; + rename "$l", bpd_abs()."/$l" + or fail "put in place new built file ($l): $!"; + }; + foreach my $l (split /\n/, getfield $dsc, 'Files') { + $l =~ m/\S+$/ or next; + $mv->('Files', $&); + } + $mv->('dsc', $dscfn); + $mv->('changes', $sourcechanges); + changedir $maindir; } @@ -6493,26 +6470,53 @@ sub cmd_build_source { printdone "source built, results in $dscfn and $sourcechanges"; } +sub cmd_push_source { + prep_push(); + fail "dgit push-source: --include-dirty/--ignore-dirty does not make". + "sense with push-source!" if $includedirty; + build_maybe_quilt_fixup(); + if ($changesfile) { + my $changes = parsecontrol("$buildproductsdir/$changesfile", + "source changes file"); + unless (test_source_only_changes($changes)) { + fail "user-specified changes file is not source-only"; + } + } else { + # Building a source package is very fast, so just do it + build_source(); + die "er, patches are applied dirtily but shouldn't be.." + if $patches_applied_dirtily; + $changesfile = $sourcechanges; + } + dopush(); +} + sub cmd_sbuild { - build_prep(WANTSRC_SOURCE); # not BUILDER because sbuild uses the .dsc + build_prep_early(); + build_with_binary_builder(\@sbuild, <