X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=4c80280523bd9f3506220622d61eef2a847a9cdb;hb=7e481fcf4e2802d1743717a77270a01c76456559;hp=b4b6d9cd4ea79467a9d86cb9b3df7e5d5f997af8;hpb=0eac80b3d8464d1b476cb27bb5d4f286d56dd422;p=dgit.git diff --git a/dgit b/dgit index b4b6d9cd..4c802805 100755 --- a/dgit +++ b/dgit @@ -77,6 +77,9 @@ our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)"); our $suite_re = '[-+.0-9a-z]+'; our $cleanmode_re = 'dpkg-source(?:-d)?|git|git-ff|check|none'; +our $orig_f_comp_re = 'orig(?:-[-0-9a-z]+)?'; +our $orig_f_sig_re = '\\.(?:asc|gpg|pgp)'; +our $orig_f_tail_re = "$orig_f_comp_re\\.tar(?:\\.\\w+)?(?:$orig_f_sig_re)?"; our $git_authline_re = '^([^<>]+) \<(\S+)\> (\d+ [-+]\d+)$'; our $splitbraincache = 'dgit-intern/quilt-cache'; @@ -1434,14 +1437,14 @@ sub is_orig_file_in_dsc ($$) { return 0 if @$dsc_files_info <= 1; # One file means no origs, and the filename doesn't have a "what # part of dsc" component. (Consider versions ending `.orig'.) - return 0 unless $f =~ m/\.orig(?:-\w+)?\.tar(?:\.\w+)?$/; + return 0 unless $f =~ m/\.$orig_f_tail_re$/o; return 1; } sub is_orig_file_of_vsn ($$) { my ($f, $upstreamvsn) = @_; my $base = srcfn $upstreamvsn, ''; - return 0 unless $f =~ m/^\Q$base\E\.orig(?:-\w+)?\.tar(?:\.\w+)?$/; + return 0 unless $f =~ m/^\Q$base\E\.$orig_f_tail_re$/; return 1; } @@ -1591,6 +1594,7 @@ sub generate_commits_from_dsc () { 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; my ($orig_f_part) = @@ -1707,8 +1711,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.$."; @@ -1716,6 +1723,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 @@ -1740,8 +1749,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; @@ -1758,7 +1771,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 @@ -1779,6 +1797,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', @gbp, qw(pq import); my $gapplied = git_rev_parse('HEAD'); my $gappliedtree = cmdoutput @git, qw(rev-parse HEAD:); @@ -2383,7 +2405,7 @@ END } else { $hash = $mergeinputs[0]{Commit}; } - progress "fetch hash=$hash\n"; + printdebug "fetch hash=$hash\n"; my $chkff = sub { my ($lasth, $what) = @_;