summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2014-10-29 17:53:13 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2014-11-09 15:30:06 +0000
commit3b8d3ae177321d340de16b1dced5c9d262e56f72 (patch)
tree5cdbee279ce1d58bd1029347eef0b589c705e428
parent1b2c10f57b0257aac61a696378e9c8c05df8bf4f (diff)
quilt patchification: Break out quiltify() (nfc)
-rwxr-xr-xdgit60
1 files changed, 33 insertions, 27 deletions
diff --git a/dgit b/dgit
index 6d34620..87a0380 100755
--- a/dgit
+++ b/dgit
@@ -2031,6 +2031,38 @@ our $dscfn;
our $fakeeditorenv = 'DGIT_FAKE_EDITOR_QUILT';
+sub quiltify ($$) {
+ my ($clogp,$headref) = @_;
+
+ my $author = getfield $clogp, 'Maintainer';
+ my $time = time;
+ my $ncommits = 3;
+ my $patchname = "auto-$version-$headref-$time";
+ my $msg = cmdoutput @git, qw(log), "-n$ncommits";
+ mkpath '.git/dgit';
+ my $descfn = ".git/dgit/quilt-description.tmp";
+ open O, '>', $descfn or die "$descfn: $!";
+ $msg =~ s/\n/\n /g;
+ $msg =~ s/^\s+$/ ./mg;
+ print O <<END or die $!;
+Description: Automatically generated patch ($clogp->{Version})
+ Last (up to) $ncommits git changes, FYI:
+ .
+ $msg
+Author: $author
+
+---
+
+END
+ close O or die $!;
+ {
+ local $ENV{'EDITOR'} = cmdoutput qw(realpath --), $0;
+ local $ENV{'VISUAL'} = $ENV{'EDITOR'};
+ local $ENV{$fakeeditorenv} = cmdoutput qw(realpath --), $descfn;
+ runcmd_ordryrun_local @dpkgsource, qw(--commit .), $patchname;
+ }
+}
+
sub build_maybe_quilt_fixup () {
my $format=get_source_format;
return unless madformat $format;
@@ -2149,33 +2181,7 @@ END
rename '../fake/.pc','.pc' or die $!;
}
- my $author = getfield $clogp, 'Maintainer';
- my $time = time;
- my $ncommits = 3;
- my $patchname = "auto-$version-$headref-$time";
- my $msg = cmdoutput @git, qw(log), "-n$ncommits";
- mkpath '.git/dgit';
- my $descfn = ".git/dgit/quilt-description.tmp";
- open O, '>', $descfn or die "$descfn: $!";
- $msg =~ s/\n/\n /g;
- $msg =~ s/^\s+$/ ./mg;
- print O <<END or die $!;
-Description: Automatically generated patch ($clogp->{Version})
- Last (up to) $ncommits git changes, FYI:
- .
- $msg
-Author: $author
-
----
-
-END
- close O or die $!;
- {
- local $ENV{'EDITOR'} = cmdoutput qw(realpath --), $0;
- local $ENV{'VISUAL'} = $ENV{'EDITOR'};
- local $ENV{$fakeeditorenv} = cmdoutput qw(realpath --), $descfn;
- runcmd_ordryrun_local @dpkgsource, qw(--commit .), $patchname;
- }
+ quiltify($clogp,$headref);
if (!open P, '>>', ".pc/applied-patches") {
$!==&ENOENT or die $!;