From a0ebfd60790ce326fbde74744939588ee6f1d7d7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 10 Aug 2018 14:46:03 +0100 Subject: dgit: Drop an obsolete xxx comment This comment comes originally from a WIP commit e0ebbc5879c01d4c3e802101e146c5fb08bc9d49 I have in before-rebase.2016-11-07. In that commit, @merginputs did not exist. Now it does, and that is how the ref comes out. So this comment is obsolete. Signed-off-by: Ian Jackson --- dgit | 1 - 1 file changed, 1 deletion(-) (limited to 'dgit') diff --git a/dgit b/dgit index dbb23f3..d2f2c0f 100755 --- a/dgit +++ b/dgit @@ -3528,7 +3528,6 @@ sub fork_for_multisuite ($) { fetch_one(); finish 0; }); - # xxx collecte the ref here $csubsuite =~ s/^\Q$cbasesuite\E-/-/; push @csuites, $csubsuite; -- cgit v1.2.3 From e09fe6d115bdd9439abe4d892a6f3ecb181905ee Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 10 Aug 2018 14:50:05 +0100 Subject: dgit: Fix a spelling error `$merginputs' to `$mergeinputs' No functional change. Signed-off-by: Ian Jackson --- dgit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index d2f2c0f..51cac14 100755 --- a/dgit +++ b/dgit @@ -3457,7 +3457,7 @@ END sub multisuite_suite_child ($$$) { - my ($tsuite, $merginputs, $fn) = @_; + my ($tsuite, $mergeinputs, $fn) = @_; # in child, sets things up, calls $fn->(), and returns undef # in parent, returns canonical suite name for $tsuite my $canonsuitefh = IO::File::new_tmpfile; @@ -3484,7 +3484,7 @@ sub multisuite_suite_child ($$$) { return $csuite; } printdebug "multisuite $tsuite ok (canon=$csuite)\n"; - push @$merginputs, { + push @$mergeinputs, { Ref => lrref, Info => $csuite, }; -- cgit v1.2.3 From 027613e7a281123f4512ca4c1b99552cc78ca72b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 11 Aug 2018 21:08:00 +0100 Subject: Dgit.pm: Move make_commit_text from dgit NFC other than the usual change to literal `git'. Signed-off-by: Ian Jackson --- dgit | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 51cac14..6879e54 100755 --- a/dgit +++ b/dgit @@ -1991,28 +1991,6 @@ sub make_commit ($) { return cmdoutput @git, qw(hash-object -w -t commit), $file; } -sub make_commit_text ($) { - my ($text) = @_; - my ($out, $in); - my @cmd = (@git, qw(hash-object -w -t commit --stdin)); - debugcmd "|",@cmd; - print Dumper($text) if $debuglevel > 1; - my $child = open2($out, $in, @cmd) or die $!; - my $h; - eval { - print $in $text or die $!; - close $in or die $!; - $h = <$out>; - $h =~ m/^\w+$/ or die; - $h = $&; - printdebug "=> $h\n"; - }; - close $out; - waitpid $child, 0 == $child or die "$child $!"; - $? and failedcmd @cmd; - return $h; -} - sub clogp_authline ($) { my ($clogp) = @_; my $author = getfield $clogp, 'Maintainer'; -- cgit v1.2.3 From 268663da0b2726d94d54f95299ed2c4a0bd7351b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 11 Aug 2018 21:11:21 +0100 Subject: Dgit.pm: Move reflog_cache_* from dgit We are going to want this for git-debrebase merge resolutions. NFC other than the usual change to literal `git'. Signed-off-by: Ian Jackson --- dgit | 50 ++++++-------------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 6879e54..991fd9a 100755 --- a/dgit +++ b/dgit @@ -5228,29 +5228,7 @@ END my $dgitview = git_rev_parse 'HEAD'; changedir $maindir; - # When we no longer need to support squeeze, use --create-reflog - # instead of this: - ensuredir "$maindir_gitcommon/logs/refs/dgit-intern"; - my $makelogfh = new IO::File "$maindir_gitcommon/logs/refs/$splitbraincache", '>>' - or die $!; - - my $oldcache = git_get_ref "refs/$splitbraincache"; - if ($oldcache eq $dgitview) { - my $tree = cmdoutput qw(git rev-parse), "$dgitview:"; - # git update-ref doesn't always update, in this case. *sigh* - my $dummy = make_commit_text < 1000000000 +0000 -committer Dgit 1000000000 +0000 - -Dummy commit - do not use -END - runcmd @git, qw(update-ref -m), "dgit $our_version - dummy", - "refs/$splitbraincache", $dummy; - } - runcmd @git, qw(update-ref -m), $cachekey, "refs/$splitbraincache", - $dgitview; + reflog_cache_insert "refs/$splitbraincache", $cachekey, $dgitview; changedir "$playground/work"; @@ -5753,26 +5731,12 @@ sub quilt_check_splitbrain_cache ($$) { push @cachekey, $srcshash->hexdigest(); $splitbrain_cachekey = "@cachekey"; - my @cmd = (@git, qw(log -g), '--pretty=format:%H %gs', - $splitbraincache); printdebug "splitbrain cachekey $splitbrain_cachekey\n"; - debugcmd "|(probably)",@cmd; - my $child = open GC, "-|"; defined $child or die $!; - if (!$child) { - chdir $maindir or die $!; - if (!stat "$maindir_gitcommon/logs/refs/$splitbraincache") { - $! == ENOENT or die $!; - printdebug ">(no reflog)\n"; - finish 0; - } - exec @cmd; die $!; - } - while () { - chomp; - printdebug ">| ", $_, "\n" if $debuglevel > 1; - next unless m/^(\w+) (\S.*\S)$/ && $2 eq $splitbrain_cachekey; - - my $cachehit = $1; + + my $cachehit = reflog_cache_lookup + "refs/$splitbraincache", $splitbrain_cachekey; + + if ($cachehit) { unpack_playtree_mkwork($headref); my $saved = maybe_split_brain_save $headref, $cachehit, "cache-hit"; if ($cachehit ne $headref) { @@ -5784,8 +5748,6 @@ sub quilt_check_splitbrain_cache ($$) { progress "dgit view: found cached, no changes required"; return ($headref, $splitbrain_cachekey); } - die $! if GC->error; - failedcmd unless close GC; printdebug "splitbrain cache miss\n"; return (undef, $splitbrain_cachekey); -- cgit v1.2.3 From 7ade597c2d0bd7f63eff7f36448c3d705cfee73a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 20 Aug 2018 01:10:26 +0100 Subject: dgit: Remove a spurious space Signed-off-by: Ian Jackson --- dgit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dgit') diff --git a/dgit b/dgit index 991fd9a..42813f1 100755 --- a/dgit +++ b/dgit @@ -5916,7 +5916,7 @@ END my @failsuggestion; if (!($diffbits->{O2H} & $diffbits->{O2A})) { push @failsuggestion, "This might be a patches-unapplied branch."; - } elsif (!($diffbits->{H2A} & $diffbits->{O2A})) { + } elsif (!($diffbits->{H2A} & $diffbits->{O2A})) { push @failsuggestion, "This might be a patches-applied branch."; } push @failsuggestion, "Maybe you need to specify one of". -- cgit v1.2.3 From fc195d8bd6b54576347318605c7091b526dbdfc6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 20 Aug 2018 01:22:01 +0100 Subject: dgit: quilt fixup error messages: Change hint emphasis * No longer hint --quilt=smash or dpkg source --commit. These are rarely the right thing. * Hint about bad origs, instead. This is fairly common. Signed-off-by: Ian Jackson --- dgit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 42813f1..ab61805 100755 --- a/dgit +++ b/dgit @@ -5373,8 +5373,7 @@ sub quiltify ($$$$) { } print STDERR "$us: $_\n" foreach @$failsuggestion; fail - "quilt history linearisation failed. Search \`quilt fixup' in dgit(7).\n". - "Use dpkg-source --commit by hand; or, --quilt=smash for one ugly patch"; + "quilt history linearisation failed. Search \`quilt fixup' in dgit(7).\n"; } elsif ($quilt_mode eq 'smash') { } elsif ($quilt_mode eq 'auto') { progress "quilt fixup cannot be linear, smashing..."; @@ -5920,7 +5919,8 @@ END push @failsuggestion, "This might be a patches-applied branch."; } push @failsuggestion, "Maybe you need to specify one of". - " --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?"; + " --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?", + "Or, maybe orig tarball(s) are not identical to git representation?"; if (quiltmode_splitbrain()) { quiltify_splitbrain($clogp, $unapplied, $headref, $oldtiptree, -- cgit v1.2.3 From 3553a7c60866f392445d7bbf2ed028f3f92da33d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 20 Aug 2018 01:41:03 +0100 Subject: dgit: quilt fixup: @failsuggestion: Include a machine-readable reason Each entry is now an arrayref. This will let quilt_fiuxp filter them later. Signed-off-by: Ian Jackson --- dgit | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index ab61805..2a3d9ac 100755 --- a/dgit +++ b/dgit @@ -5371,7 +5371,7 @@ sub quiltify ($$$$) { foreach my $notp (@nots) { print STDERR "$us: ", $reportnot->($notp), "\n"; } - print STDERR "$us: $_\n" foreach @$failsuggestion; + print STDERR "$us: $_->[1]\n" foreach @$failsuggestion; fail "quilt history linearisation failed. Search \`quilt fixup' in dgit(7).\n"; } elsif ($quilt_mode eq 'smash') { @@ -5914,13 +5914,16 @@ END my @failsuggestion; if (!($diffbits->{O2H} & $diffbits->{O2A})) { - push @failsuggestion, "This might be a patches-unapplied branch."; + push @failsuggestion, [ 'unapplied', + "This might be a patches-unapplied branch." ]; } elsif (!($diffbits->{H2A} & $diffbits->{O2A})) { - push @failsuggestion, "This might be a patches-applied branch."; + push @failsuggestion, [ 'applied', + "This might be a patches-applied branch." ]; } - push @failsuggestion, "Maybe you need to specify one of". - " --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?", - "Or, maybe orig tarball(s) are not identical to git representation?"; + push @failsuggestion, [ 'quilt-mode', "Maybe you need to specify one of". + " --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?" ], + [ 'origs', + "Or, maybe orig tarball(s) are not identical to git representation?" ]; if (quiltmode_splitbrain()) { quiltify_splitbrain($clogp, $unapplied, $headref, $oldtiptree, -- cgit v1.2.3 From eef842fb0e323b265071e751bcb704a1ce79e950 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 20 Aug 2018 01:41:59 +0100 Subject: dgit: quilt fiuxp: linearisation failure: Add a blank line The `stopped at' commit report can be long, if there are several, or complicated, commits. Add a blank line. Signed-off-by: Ian Jackson --- dgit | 1 + 1 file changed, 1 insertion(+) (limited to 'dgit') diff --git a/dgit b/dgit index 2a3d9ac..83d1d09 100755 --- a/dgit +++ b/dgit @@ -5371,6 +5371,7 @@ sub quiltify ($$$$) { foreach my $notp (@nots) { print STDERR "$us: ", $reportnot->($notp), "\n"; } + print STDERR "\n"; print STDERR "$us: $_->[1]\n" foreach @$failsuggestion; fail "quilt history linearisation failed. Search \`quilt fixup' in dgit(7).\n"; -- cgit v1.2.3 From 1bc7acac1e13f58de74e7e07b0f3c3741f4ef405 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 20 Aug 2018 01:42:47 +0100 Subject: dgit: quilt fixup: Do not suggest quilt modes if we see gdr If `stopped at' is a git-debrebase commit, then a non-default quilt mode is probably not the answer. Signed-off-by: Ian Jackson --- dgit | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'dgit') diff --git a/dgit b/dgit index 83d1d09..6377e32 100755 --- a/dgit +++ b/dgit @@ -5368,10 +5368,17 @@ sub quiltify ($$$$) { }; if ($quilt_mode eq 'linear') { print STDERR "\n$us: error: quilt fixup cannot be linear. Stopped at:\n"; + my $all_gdr = !!@nots; foreach my $notp (@nots) { print STDERR "$us: ", $reportnot->($notp), "\n"; + $all_gdr &&= $notp->{Child} && + (git_cat_file $notp->{Child}{Commit}, 'commit') + =~ m{^\[git-debrebase.*\]$}m; } print STDERR "\n"; + $failsuggestion = + [ grep { $_->[0] ne 'quilt-mode' } @$failsuggestion ] + if $all_gdr; print STDERR "$us: $_->[1]\n" foreach @$failsuggestion; fail "quilt history linearisation failed. Search \`quilt fixup' in dgit(7).\n"; @@ -5924,7 +5931,7 @@ END push @failsuggestion, [ 'quilt-mode', "Maybe you need to specify one of". " --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?" ], [ 'origs', - "Or, maybe orig tarball(s) are not identical to git representation?" ]; + "Maybe orig tarball(s) are not identical to git representation?" ]; if (quiltmode_splitbrain()) { quiltify_splitbrain($clogp, $unapplied, $headref, $oldtiptree, -- cgit v1.2.3 From 5e1146ab267afe371d108582671546c7fe096a50 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 20 Aug 2018 01:48:04 +0100 Subject: dgit: quilt fixup errors: Refactor and reword very slightly Make this two calls to push so we can put things in between. Also remove `to specify'; now the message fits in 80 columns. Signed-off-by: Ian Jackson --- dgit | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 6377e32..a2ca2db 100755 --- a/dgit +++ b/dgit @@ -5928,9 +5928,9 @@ END push @failsuggestion, [ 'applied', "This might be a patches-applied branch." ]; } - push @failsuggestion, [ 'quilt-mode', "Maybe you need to specify one of". - " --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?" ], - [ 'origs', + push @failsuggestion, [ 'quilt-mode', + "Maybe you need one of --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?" ]; + push @failsuggestion, [ 'origs', "Maybe orig tarball(s) are not identical to git representation?" ]; if (quiltmode_splitbrain()) { -- cgit v1.2.3 From b8effc17a1aadcfdf3524157555a8656cc94369f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 20 Aug 2018 01:59:08 +0100 Subject: dgit: quilt fixup: Maybe mention gitattributes These are a potential cause of quilt linearisation failure. Closes:#906199. Signed-off-by: Ian Jackson --- dgit | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dgit') diff --git a/dgit b/dgit index a2ca2db..e752108 100755 --- a/dgit +++ b/dgit @@ -5930,6 +5930,11 @@ END } push @failsuggestion, [ 'quilt-mode', "Maybe you need one of --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?" ]; + + push @failsuggestion, [ 'gitattrs', + "Warning: Tree has .gitattributes. See GITATTRIBUTES in dgit(7)." ] + if stat_exists '.gitattributes'; + push @failsuggestion, [ 'origs', "Maybe orig tarball(s) are not identical to git representation?" ]; -- cgit v1.2.3 From 6f3e3449c7f62594e48df4f5851b08b7366fb5dc Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 21 Aug 2018 02:08:39 +0100 Subject: dgit: do not crash on push of a new gdr package. Closes:#906784. Signed-off-by: Ian Jackson --- dgit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dgit') diff --git a/dgit b/dgit index e752108..f06087d 100755 --- a/dgit +++ b/dgit @@ -311,7 +311,7 @@ sub branch_is_gdr_unstitched_ff ($$$) { my ($symref, $head, $ancestor) = @_; my ($ffq_prev, $gdrlast) = branch_gdr_info($symref, $head); return 0 unless $ffq_prev; - return 0 unless is_fast_fwd $ancestor, $ffq_prev; + return 0 unless !defined $ancestor or is_fast_fwd $ancestor, $ffq_prev; return 1; } -- cgit v1.2.3 From c0b9db3fad908bcf3b02a5179fbd2288f3d44a4d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 21 Aug 2018 13:40:31 +0100 Subject: dgit: Remove unsubstituted $changesfile from message Closes:#906787. Signed-off-by: Ian Jackson --- dgit | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index f06087d..1f1b0f5 100755 --- a/dgit +++ b/dgit @@ -4476,9 +4476,8 @@ END supplementary_message(<<'END'); Push failed, while obtaining signatures on the .changes and .dsc. If it was just that the signature failed, you may try again by using -debsign by hand to sign the changes - $changesfile -and then dput to complete the upload. +debsign by hand to sign the changes file (see the command dgit tried, +above), and then dput that changes file to complete the upload. If you need to change the package, you must use a new version number. END if ($we_are_responder) { -- cgit v1.2.3 From b9ef2453ea950bd60ddb52e2253cdf762f34534d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 24 Aug 2018 21:41:55 +0100 Subject: git-debrebase: Do not try split brain gdr make-patches Print a helpful error message instead. Closes: #906908. Signed-off-by: Ian Jackson --- dgit | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dgit') diff --git a/dgit b/dgit index 1f1b0f5..5e9d711 100755 --- a/dgit +++ b/dgit @@ -4235,6 +4235,15 @@ END my $actualhead = git_rev_parse('HEAD'); if (branch_is_gdr_unstitched_ff($symref, $actualhead, $archive_hash)) { + if (quiltmode_splitbrain()) { + my ($ffq_prev, $gdrlast) = branch_gdr_info($symref, $actualhead); + fail < Date: Sat, 25 Aug 2018 00:44:51 +0100 Subject: git-debrebase: Do not abandon quilt fixup at gdr split commits One of these might well be in the delta queue somehow. Signed-off-by: Ian Jackson --- dgit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dgit') diff --git a/dgit b/dgit index 5e9d711..0374b47 100755 --- a/dgit +++ b/dgit @@ -5381,7 +5381,7 @@ sub quiltify ($$$$) { print STDERR "$us: ", $reportnot->($notp), "\n"; $all_gdr &&= $notp->{Child} && (git_cat_file $notp->{Child}{Commit}, 'commit') - =~ m{^\[git-debrebase.*\]$}m; + =~ m{^\[git-debrebase(?! split[: ]).*\]$}m; } print STDERR "\n"; $failsuggestion = -- cgit v1.2.3 From 683ef14506d9907dfa102b5e228637415c4922b6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Aug 2018 00:57:59 +0100 Subject: dgit: Introduce get_tree_of_commit NFC Signed-off-by: Ian Jackson --- dgit | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 0374b47..3438f62 100755 --- a/dgit +++ b/dgit @@ -289,6 +289,14 @@ sub bpd_abs () { return $r; } +sub get_tree_of_commit ($) { + my ($commitish) = @_; + my $cdata = cmdoutput @git, qw(cat-file commit), $commitish; + $cdata =~ m/\n\n/; $cdata = $`; + $cdata =~ m/^tree (\w+)$/m or confess "cdata $cdata ?"; + return $1; +} + sub branch_gdr_info ($$) { my ($symref, $head) = @_; my ($status, $msg, $current, $ffq_prev, $gdrlast) = @@ -3164,10 +3172,7 @@ END # here we go, then: my $tree_commit = $mergeinputs[0]{Commit}; - my $tree = cmdoutput @git, qw(cat-file commit), $tree_commit; - $tree =~ m/\n\n/; $tree = $`; - $tree =~ m/^tree (\w+)$/m or die "$dsc_hash tree ?"; - $tree = $1; + my $tree = get_tree_of_commit $tree_commit;; # We use the changelog author of the package in question the # author of this pseudo-merge. This is (roughly) correct if -- cgit v1.2.3 From 2da6bc9c434e12dd33e4506c3eaf605b87ec30d8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Aug 2018 01:05:22 +0100 Subject: dgit: Replace branch_is_gdr with a history walker The debrebase-last approach is fundamentally wrong, because, for example, cloning a stitched laundered gdr branch from a git server does not establish debrebase-last, so dgit would make patches itself (slowly). So, instead, use git-debrebase make-patches in situations where it will succeed. We could just run it but that's slower, and it is a bit awkward because we have to consider whether gdr is installed. So provide our own implementation. It can be simpler because it only has to handle the easy cases; On testing of the new algorithm: we want to be confident that this doesn't misfire; otherwise dgit users could be inconvenienced. And we want it to work for gdr users of course. We can analyse the test coverage of the logic in branch_is_gdr by running the whole test suite and then comparing this: cat tests/tmp/*.log |perl -ne 'next unless s/^branch_is_gdr \w+ //; print' |sort -u |less with this: git-grep 'branch_is_gdr ' | perl -pe 's/^^dgit:\s+//' |sort |less Noting that we should ideally have one each of all the gdr kinds we try to recognise. Currently that shows that we are missing only: gdr merged-breakwater unmarked BreakwaterStart YES Closes: #907208. Signed-off-by: Ian Jackson --- dgit | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 8 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 3438f62..2774f7e 100755 --- a/dgit +++ b/dgit @@ -308,13 +308,6 @@ sub branch_gdr_info ($$) { return ($ffq_prev, $gdrlast); } -sub branch_is_gdr ($$) { - my ($symref, $head) = @_; - my ($ffq_prev, $gdrlast) = branch_gdr_info($symref, $head); - return 0 unless $ffq_prev || $gdrlast; - return 1; -} - sub branch_is_gdr_unstitched_ff ($$$) { my ($symref, $head, $ancestor) = @_; my ($ffq_prev, $gdrlast) = branch_gdr_info($symref, $head); @@ -323,6 +316,78 @@ sub branch_is_gdr_unstitched_ff ($$$) { return 1; } +sub branch_is_gdr ($) { + my ($head) = @_; + # This is quite like git-debrebase's keycommits. + # We have our own implementation because: + # - our algorighm can do fewer tests so is faster + # - it saves testing to see if gdr is installed + my $walk = $head; + local $Debian::Dgit::debugcmd_when_debuglevel = 3; + printdebug "branch_is_gdr $head...\n"; + my $get_patches = sub { + my $t = git_cat_file "$_[0]:debian/patches", [qw(missing tree)]; + return $t // ''; + }; + my $tip_patches = $get_patches->($head); + WALK: + for (;;) { + my $cdata = git_cat_file $walk, 'commit'; + my ($hdrs,$msg) = $cdata =~ m{\n\n} ? ($`,$') : ($cdata,''); + if ($msg =~ m{^\[git-debrebase\ ( + anchor | pseudomerge | changelog | + make-patches | merged-breakwater + ) [: ] }mx) { + # no need to analyse this - it's sufficient + # (gdr classifications: Anchor, MergedBreakwaters) + # (made by gdr: Pseudomerge, Changelog) + printdebug "branch_is_gdr $walk gdr $1 YES\n"; + return 1; + } + my @parents = ($hdrs =~ m/^parent (\w+)$/gm); + if (@parents==2) { + my $walk_tree = get_tree_of_commit $walk; + foreach my $p (@parents) { + my $p_tree = get_tree_of_commit $p; + if ($p_tree eq $walk_tree) { # pseudomerge contriburor + # (gdr classification: Pseudomerge; not made by gdr) + printdebug "branch_is_gdr $walk unmarked pseudomerge\n" + if $debuglevel >= 2; + $walk = $p; + next WALK; + } + } + # some other non-gdr merge + # (gdr classification: VanillaMerge, DgitImportUnpatched, ?) + printdebug "branch_is_gdr $walk ?-2-merge NO\n"; + return 0; + } + if (@parents>2) { + # (gdr classification: ?) + printdebug "branch_is_gdr $walk ?-octopus NO\n"; + return 0; + } + if ($get_patches->($walk) ne $tip_patches) { + # Our parent added, removed, or edited patches, and wasn't + # a gdr make-patches commit. gdr make-patches probably + # won't do that well, then. + # (gdr classification of parent: AddPatches or ?) + printdebug "branch_is_gdr $walk ?-patches NO\n"; + return 0; + } + if ($tip_patches eq '' and + !defined git_cat_file "$walk:debian") { + # (gdr classification of parent: BreakwaterStart + printdebug "branch_is_gdr $walk unmarked BreakwaterStart YES\n"; + return 1; + } + # (gdr classification: Upstream Packaging Mixed Changelog) + printdebug "branch_is_gdr $walk plain\n" + if $debuglevel >= 2; + $walk = $parents[0]; + } +} + #---------- remote protocol support, common ---------- # remote push initiator/responder protocol: @@ -5548,7 +5613,7 @@ END if ($quilt_mode eq 'linear' && !$fopts->{'single-debian-patch'} - && branch_is_gdr($symref, $headref)) { + && branch_is_gdr($headref)) { # This is much faster. It also makes patches that gdr # likes better for future updates without laundering. # -- cgit v1.2.3 From 788c71b25686960edf9cf80b2f4d3223951959ec Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Aug 2018 12:48:03 +0100 Subject: dgit: branch_is_gdr: Put gdr commit annotations in alphabetical order This makes it slightly easier to see our test coverage. Signed-off-by: Ian Jackson --- dgit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 2774f7e..1f42dd3 100755 --- a/dgit +++ b/dgit @@ -335,8 +335,8 @@ sub branch_is_gdr ($) { my $cdata = git_cat_file $walk, 'commit'; my ($hdrs,$msg) = $cdata =~ m{\n\n} ? ($`,$') : ($cdata,''); if ($msg =~ m{^\[git-debrebase\ ( - anchor | pseudomerge | changelog | - make-patches | merged-breakwater + anchor | changelog | make-patches | + merged-breakwater | pseudomerge ) [: ] }mx) { # no need to analyse this - it's sufficient # (gdr classifications: Anchor, MergedBreakwaters) -- cgit v1.2.3 From 9de02f9d56e123144548a556e1ce32e9ced24f0f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Aug 2018 13:53:34 +0100 Subject: dgit: branch_is_gdr: Add a cautionary comment Signed-off-by: Ian Jackson --- dgit | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'dgit') diff --git a/dgit b/dgit index 1f42dd3..3962134 100755 --- a/dgit +++ b/dgit @@ -322,6 +322,11 @@ sub branch_is_gdr ($) { # We have our own implementation because: # - our algorighm can do fewer tests so is faster # - it saves testing to see if gdr is installed + + # NB we use this jsut for deciding whether to run gdr make-patches + # Before reusing this algorithm for somthing else, its + # suitability should be reconsidered. + my $walk = $head; local $Debian::Dgit::debugcmd_when_debuglevel = 3; printdebug "branch_is_gdr $head...\n"; -- cgit v1.2.3 From b307adcedaf7ae391d106f397ff27c560fbc7d38 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 26 Aug 2018 12:20:44 +0100 Subject: dgit: build: Squash $buildproductsdir Things malfunction, because some things end up in .. and some in bpd. Overriding this at least makes `dgit build' produce correct results, albeit in the wrong place. Closes: #906786. Signed-off-by: Ian Jackson --- dgit | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index 3962134..d38d914 100755 --- a/dgit +++ b/dgit @@ -6324,9 +6324,10 @@ sub postbuild_mergechanges_vanilla ($) { sub cmd_build { build_prep_early(); $buildproductsdir eq '..' or print STDERR < Date: Sun, 26 Aug 2018 13:28:28 +0100 Subject: dgit: build-*: Cope with new-style --build= specifications Previously, we would generally bomb out. Signed-off-by: Ian Jackson --- dgit | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'dgit') diff --git a/dgit b/dgit index d38d914..695f2b7 100755 --- a/dgit +++ b/dgit @@ -6226,16 +6226,27 @@ sub massage_dbp_args ($;$) { my $dmode = '-F'; foreach my $l ($cmd, $xargs) { next unless $l; - @$l = grep { !(m/^-[SgGFABb]$/s and $dmode=$_) } @$l; + @$l = grep { !(m/^-[SgGFABb]$|^--build=/s and $dmode=$_) } @$l; } push @$cmd, '-nc'; #print STDERR "MASS1 ",Dumper($cmd, $xargs, $dmode); my $r = WANTSRC_BUILDER; printdebug "massage split $dmode.\n"; - $r = $dmode =~ m/[S]/ ? WANTSRC_SOURCE : - $dmode =~ y/gGF/ABb/ ? WANTSRC_SOURCE | WANTSRC_BUILDER : - $dmode =~ m/[ABb]/ ? WANTSRC_BUILDER : - die "$dmode ?"; + if ($dmode =~ s/^--build=//) { + $r = 0; + my @d = split /,/, $dmode; + $r |= WANTSRC_SOURCE if grep { s/^full$/binary/ } @d; + $r |= WANTSRC_SOURCE if grep { s/^source$// } @d; + $r |= WANTSRC_BUILDER if grep { m/./ } @d; + fail "Wanted to build nothing!" unless $r; + $dmode = '--build='. join ',', grep m/./, @d; + } else { + $r = + $dmode =~ m/[S]/ ? WANTSRC_SOURCE : + $dmode =~ y/gGF/ABb/ ? WANTSRC_SOURCE | WANTSRC_BUILDER : + $dmode =~ m/[ABb]/ ? WANTSRC_BUILDER : + die "$dmode ?"; + } printdebug "massage done $r $dmode.\n"; push @$cmd, $dmode; #print STDERR "MASS2 ",Dumper($cmd, $xargs, $r); -- cgit v1.2.3 From 0a6ed24d826439ab82b17087bb6fcdf7b4415291 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 26 Aug 2018 13:41:22 +0100 Subject: dgit: Pass --no-source to sbuild (always) Closes: #904966. Signed-off-by: Ian Jackson --- dgit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dgit') diff --git a/dgit b/dgit index 695f2b7..ea74cad 100755 --- a/dgit +++ b/dgit @@ -113,7 +113,7 @@ our (@curl) = (qw(curl --proto-redir), '-all,http,https', qw(-L)); our (@dput) = qw(dput); our (@debsign) = qw(debsign); our (@gpg) = qw(gpg); -our (@sbuild) = qw(sbuild); +our (@sbuild) = (qw(sbuild --no-source)); our (@ssh) = 'ssh'; our (@dgit) = qw(dgit); our (@git_debrebase) = qw(git-debrebase); -- cgit v1.2.3