X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=2d235a633fa9433d5febcf8b78ba2c9d7a62a4ec;hb=cc82deecc83f936e98401aef4a2471da8988cb07;hp=0d31724b549a8b2e803460239158808f668dd850;hpb=a1d908d84d83f9e8ec1363002b3339f96a0c10b9;p=dgit.git diff --git a/dgit b/dgit index 0d31724b..2d235a63 100755 --- a/dgit +++ b/dgit @@ -82,7 +82,7 @@ our $quilt_mode; our $quilt_upstream_commitish; our $quilt_upstream_commitish_used; our $quilt_upstream_commitish_message; -our $quilt_options_re = 'gbp|dpm|baredebian'; +our $quilt_options_re = 'gbp|dpm|baredebian(?:\+tarball|\+git)?'; our $quilt_modes_re = "linear|smash|auto|nofix|nocheck|unapplied|$quilt_options_re"; our $splitview_mode; our $splitview_modes_re = qr{auto|always|never}; @@ -2290,7 +2290,6 @@ sub import_tarball_tartrees ($$) { my $f = $fi->{Filename}; printdebug "import considering $f "; - (printdebug "only one dfi\n"), next if @$dfi == 1; (printdebug "not tar\n"), next unless $f =~ m/\.tar(\.\w+)?$/; (printdebug "signature\n"), next if $f =~ m/$orig_f_sig_re$/o; my $compr_ext = $1; @@ -2368,6 +2367,7 @@ sub import_tarball_tartrees ($$) { Sort => (!$orig_f_part ? 2 : $orig_f_part =~ m/-/g ? 1 : 0), + OrigPart => $orig_f_part, # 'orig', 'orig-XXX', or undef F => $f, Tree => $tree, }; @@ -2443,9 +2443,10 @@ sub import_tarball_commits ($$) { $changes =~ s/^\n//; # Changes: \n my $cversion = getfield $clogp, 'Version'; + my $r1authline; if (@$tartrees) { $r1clogp //= $clogp; # maybe there's only one entry; - my $r1authline = clogp_authline $r1clogp; + $r1authline = clogp_authline $r1clogp; # Strictly, r1authline might now be wrong if it's going to be # unused because !$any_orig. Whatever. @@ -2455,7 +2456,8 @@ sub import_tarball_commits ($$) { foreach my $tt (@$tartrees) { printdebug "import tartree $tt->{F} $tt->{Tree}\n"; - my $mbody = f_ "Import %s", $tt->{F}; + # untranslated so that different people's imports are identical + my $mbody = sprintf "Import %s", $tt->{F}; $tt->{Commit} = hash_commit_text($tt->{Orig} ? <{Tree} author $r1authline @@ -2476,7 +2478,7 @@ END_T } } - return ($authline, $clogp, $changes); + return ($authline, $r1authline, $clogp, $changes); } sub generate_commits_from_dsc () { @@ -2536,7 +2538,9 @@ sub generate_commits_from_dsc () { } } - my @tartrees = import_tarball_tartrees($upstreamv, \@dfi); + my @tartrees; + @tartrees = import_tarball_tartrees($upstreamv, \@dfi) + unless @dfi == 1; # only one file in .dsc my $dscfn = "$package.dsc"; @@ -2567,7 +2571,7 @@ sub generate_commits_from_dsc () { $dappliedtree = git_add_write_tree(); } - my ($authline, $clogp, $changes) = + my ($authline, $r1authline, $clogp, $changes) = import_tarball_commits(\@tartrees, $upstreamv); my $cversion = getfield $clogp, 'Version'; @@ -2691,7 +2695,10 @@ END if ($vcmp < 0) { @output = ($rawimport_mergeinput, $lastpush_mergeinput, { ReverseParents => 1, - Message => (f_ < (sprintf < 0) { @@ -6064,6 +6071,30 @@ sub quilt_check_splitbrain_cache ($$) { return (undef, $splitbrain_cachekey); } +sub baredebian_origtarballs_scan ($$$) { + my ($fakedfi, $upstreamversion, $dir) = @_; + if (!opendir OD, $dir) { + return if $! == ENOENT; + fail "opendir $dir (origs): $!"; + } + + while ($!=0, defined(my $leaf = readdir OD)) { + { + local ($debuglevel) = $debuglevel-1; + printdebug "BDOS $dir $leaf ?\n"; + } + next unless is_orig_file_of_vsn $leaf, $upstreamversion; + next if grep { $_->{Filename} eq $leaf } @$fakedfi; + push @$fakedfi, { + Filename => $leaf, + Path => "$dir/$leaf", + }; + } + + die "$dir; $!" if $!; + closedir OD; +} + sub quilt_fixup_multipatch ($$$) { my ($clogp, $headref, $upstreamversion, $splitbrain_cachekey) = @_; @@ -6217,7 +6248,74 @@ END my $uheadref = $headref; my $uhead_whatshort = 'HEAD'; - if ($quilt_mode =~ m/baredebian/) { + if ($quilt_mode =~ m/baredebian\+tarball/) { + # We need to make a tarball import. Yuk. + # We want to do this here so that we have a $uheadref value + + my @fakedfi; + baredebian_origtarballs_scan \@fakedfi, $upstreamversion, bpd_abs(); + baredebian_origtarballs_scan \@fakedfi, $upstreamversion, + "$maindir/.." unless $buildproductsdir eq '..'; + changedir '..'; + + my @tartrees = import_tarball_tartrees $upstreamversion, \@fakedfi; + + fail __ "baredebian quilt fixup: could not find any origs" + unless @tartrees; + + changedir 'work'; + my ($authline, $r1authline, $clogp,) = + import_tarball_commits \@tartrees, $upstreamversion; + + if (@tartrees == 1) { + $uheadref = $tartrees[0]{Commit}; + # TRANSLATORS: this translation must fit in the ASCII art + # quilt differences display. The untranslated display + # says %9.9s, so with that display it must be at most 9 + # characters. + $uhead_whatshort = __ 'tarball'; + } else { + # on .dsc import we do not make a separate commit, but + # here we need to do so + rm_subdir_cached '.'; + my $parents; + foreach my $ti (@tartrees) { + my $c = $ti->{Commit}; + if ($ti->{OrigPart} eq 'orig') { + runcmd qw(git read-tree), $c; + } elsif ($ti->{OrigPart} =~ m/orig-/) { + read_tree_subdir $', $c; + } else { + confess "$ti->OrigPart} ?" + } + $parents .= "parent $c\n"; + } + my $tree = git_write_tree(); + my $mbody = f_ 'Combine orig tarballs for %s %s', + $package, $upstreamversion; + $uheadref = hash_commit_text <