X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=8d13d15a4e305238bea9b621cc39f8e0bf809c08;hp=e05c57436d7f06d9c6f298d5039436e4d1544601;hb=934524a7a8f9fbcd193f0b21bac392e9444912e4;hpb=573bb223c92c66b367114a0d1238be35013cdba2 diff --git a/dgit b/dgit index e05c5743..8d13d15a 100755 --- a/dgit +++ b/dgit @@ -97,7 +97,8 @@ our (@dpkgbuildpackage) = qw(dpkg-buildpackage -i\.git/ -I.git); our (@dpkgsource) = qw(dpkg-source -i\.git/ -I.git); our (@dpkggenchanges) = qw(dpkg-genchanges); our (@mergechanges) = qw(mergechanges -f); -our (@gbp) = qw(gbp); +our (@gbp_build) = (''); +our (@gbp_pq) = ('gbp pq'); our (@changesopts) = (''); our %opts_opt_map = ('dget' => \@dget, # accept for compatibility @@ -112,7 +113,8 @@ our %opts_opt_map = ('dget' => \@dget, # accept for compatibility 'dpkg-source' => \@dpkgsource, 'dpkg-buildpackage' => \@dpkgbuildpackage, 'dpkg-genchanges' => \@dpkggenchanges, - 'gbp' => \@gbp, + 'gbp-build' => \@gbp_build, + 'gbp-pq' => \@gbp_pq, 'ch' => \@changesopts, 'mergechanges' => \@mergechanges); @@ -246,6 +248,17 @@ sub quiltmode_splitbrain () { $quilt_mode =~ m/gbp|dpm|unapplied/; } +sub opts_opt_multi_cmd { + my @cmd; + push @cmd, split /\s+/, shift @_; + push @cmd, @_; + @cmd; +} + +sub gbp_pq { + return opts_opt_multi_cmd @gbp_pq; +} + #---------- remote protocol support, common ---------- # remote push initiator/responder protocol: @@ -1553,6 +1566,7 @@ sub check_for_vendor_patches () { sub generate_commits_from_dsc () { # See big comment in fetch_from_archive, below. + # See also README.dsc-import. prep_ud(); changedir $ud; @@ -1711,8 +1725,11 @@ sub generate_commits_from_dsc () { my $clogp; my $r1clogp; + printdebug "import clog search...\n"; + for (;;) { my $stanzatext = do { local $/=""; ; }; + printdebug "import clogp ".Dumper($stanzatext) if $debuglevel>1; last if !defined $stanzatext; my $desc = "package changelog, entry no.$."; @@ -1720,6 +1737,8 @@ sub generate_commits_from_dsc () { my $thisstanza = parsecontrolfh $stanzafh, $desc, 1; $clogp //= $thisstanza; + printdebug "import clog $thisstanza->{version} $desc...\n"; + last if !$any_orig; # we don't need $r1clogp # We look for the first (most recent) changelog entry whose @@ -1744,8 +1763,12 @@ sub generate_commits_from_dsc () { # versions were created in a non-monotic order rather than # that the changelog entries have been misordered. + printdebug "import clog $thisstanza->{version} vs $upstreamv...\n"; + last if version_compare($thisstanza->{version}, $upstreamv) < 0; $r1clogp = $thisstanza; + + printdebug "import clog $r1clogp->{version} becomes r1\n"; } die $! if CLOGS->error; close CLOGS or $?==(SIGPIPE<<8) or failedcmd @clogcmd; @@ -1762,7 +1785,12 @@ sub generate_commits_from_dsc () { # Strictly, r1authline might now be wrong if it's going to be # unused because !$any_orig. Whatever. + printdebug "import tartrees authline $authline\n"; + printdebug "import tartrees r1authline $r1authline\n"; + foreach my $tt (@tartrees) { + printdebug "import tartree $tt->{F} $tt->{Tree}\n"; + $tt->{Commit} = make_commit_text($tt->{Orig} ? <{Tree} author $r1authline @@ -1783,6 +1811,8 @@ END_T } } + printdebug "import main commit\n"; + open C, ">../commit.tmp" or die $!; print C <{format}) { + printdebug "import apply patches...\n"; + # regularise the state of the working tree so that # the checkout of $rawimport_hash works nicely. my $dappliedcommit = make_commit_text(</dev/null 2>../../gbp-pq-output', + gbp_pq, qw(import); + }; + if ($@) { + { local $@; eval { runcmd qw(cat ../../gbp-pq-output); }; } + die $@; + } - runcmd @git, qw(checkout -b unpa), $rawimport_hash; - runcmd shell_cmd 'exec >/dev/null', @gbp, qw(pq import); my $gapplied = git_rev_parse('HEAD'); my $gappliedtree = cmdoutput @git, qw(rev-parse HEAD:); $gappliedtree eq $dappliedtree or @@ -2387,7 +2437,7 @@ END } else { $hash = $mergeinputs[0]{Commit}; } - progress "fetch hash=$hash\n"; + printdebug "fetch hash=$hash\n"; my $chkff = sub { my ($lasth, $what) = @_; @@ -2580,7 +2630,11 @@ sub commit_quilty_patch () { } my @adds = map { s/[][*?\\]/\\$&/g; $_; } sort keys %adds; runcmd_ordryrun_local @git, qw(add -f), @adds; - commit_admin "Commit Debian 3.0 (quilt) metadata"; + commit_admin <', $descfn or die "$descfn: $!"; - $msg =~ s/\s+$//g; - $msg =~ s/\n/\n /g; - $msg =~ s/^\s+$/ ./mg; + $msg =~ s/\n+/\n\n/; print O <{H2O} & 01)) { my $msg = @@ -3684,7 +3738,7 @@ END ($diffbits->{O2A} & 01)) { # some patches quiltify_splitbrain_needed(); progress "dgit view: creating patches-applied version using gbp pq"; - runcmd shell_cmd 'exec >/dev/null', @gbp, qw(pq import); + runcmd shell_cmd 'exec >/dev/null', gbp_pq, qw(import); # gbp pq import creates a fresh branch; push back to dgit-view runcmd @git, qw(update-ref refs/heads/dgit-view HEAD); runcmd @git, qw(checkout -q dgit-view); @@ -3714,7 +3768,7 @@ The Debian packaging git branch contains these updates to the upstream .gitignore file(s). This patch is autogenerated, to provide these updates to users of the official Debian archive view of the package. -[dgit version $our_version] +[dgit ($our_version) update-gitignore] --- END close GIPATCH or die "$gipatch: $!"; @@ -3728,7 +3782,11 @@ END print SERIES "auto-gitignore\n" or die $!; close SERIES or die $!; runcmd @git, qw(add -- debian/patches/series), $gipatch; - commit_admin "Commit patch to update .gitignore"; + commit_admin <(); + my $title = $1; my $patchname = $title; $patchname =~ s/[.:]$//; @@ -3949,6 +4013,7 @@ sub quiltify ($$$$) { runcmd @git, qw(checkout -q), $target, qw(debian/changelog); quiltify_dpkg_commit "$patchname$index", $author, $msg, + "Date: $commitdate\n". "X-Dgit-Generated: $clogp->{Version} $cc\n"; runcmd @git, qw(checkout -q), $cc, qw(debian/changelog); @@ -4024,7 +4089,11 @@ sub quilt_fixup_linkorigs ($$) { sub quilt_fixup_delete_pc () { runcmd @git, qw(rm -rqf .pc); - commit_admin "Commit removal of .pc (quilt series tracking data)"; + commit_admin < 0) {