X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=f724369ab36d40381eaceb9884a4383e1cc84919;hp=da4e57c3d9f3542b83ebb60c526307a83241193f;hb=c49ed487a8eba41e990e483dc1851c817ed5237a;hpb=204dfaf210b11dd980970166ef7fc2c2456d245c diff --git a/dgit b/dgit index da4e57c3..f724369a 100755 --- a/dgit +++ b/dgit @@ -42,6 +42,7 @@ our (@git) = qw(git); our (@dget) = qw(dget); our (@dput) = qw(dput); our (@debsign) = qw(debsign); +our (@cleancmd) = qw(debian/rules clean); our $keyid; our $debug = 0; @@ -563,13 +564,37 @@ sub check_not_dirty () { } } +sub commit_quilty_patch () { + my $output = cmdoutput @git, qw(status --porcelain); + my $vsn = $dsc->{Version}; + my %fixups = map {$_=>1} + (".pc/debian-changes-$vsn/","debian/patches/debian-changes-2.8-5"); + my @files; + foreach my $l (split /\n/, $output) { + next unless $l =~ s/^\?\? //; + next unless $fixups{$l}; + push @files, $l; + } + print DEBUG "checking for quilty\n", Dumper(\@files); + if (@files == 2) { + runcmd_ordryrun @git, qw(add), @files; + runcmd_ordryrun + @git, qw(commit -m), "Commit Debian 3.0 (quilt) metadata"; + } +} + sub dopush () { - runcmd @git, qw(diff --quiet HEAD); + print DEBUG "actually entering push\n"; + runcmd @cleancmd; my $clogp = parsechangelog(); $package = $clogp->{Source}; my $dscfn = "${package}_$clogp->{Version}.dsc"; stat "../$dscfn" or die "$dscfn $!"; $dsc = parsecontrol("../$dscfn"); + print DEBUG "format $dsc->{Format}\n"; + if ($dsc->{Format} eq '3.0 (quilt)') { + commit_quilty_patch(); + } check_not_dirty(); prep_ud(); chdir $ud or die $!; @@ -710,6 +735,7 @@ sub cmd_build { my $clogp = parsechangelog(); $suite = $clogp->{Distribution}; $package = $clogp->{Source}; + canonicalise_suite() unless grep { m/^--git-debian-branch/ } @ARGV; runcmd_ordryrun qw(git-buildpackage -us -uc --git-no-sign-tags), '--git-builder=dpkg-buildpackage -i\.git/ -I.git', @@ -736,6 +762,8 @@ sub parseopts () { push @$om, $2; } elsif (m/^--existing-package=(.*)/s) { $existing_package = $1; + } elsif (m/^--clean-command=(.*)/s) { + @cleancmd = split /\s+/, $1; } else { die "$_ ?"; }