chiark / gitweb /
In --dry-run mode, _do_ actually run dpkg-source --commit so that we actually do...
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 2434f6a2fb5c2e23d67aa3cd6e02633449a11f9a..ce858ab98057bd770095ecf2b16b8e322e126922 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1246,7 +1246,7 @@ sub mktree_in_ud_from_only_subdir () {
 
     remove_stray_gits();
     mktree_in_ud_here();
-    my $format=get_source_format();
+    my ($format, $fopts) = get_source_format();
     if (madformat($format)) {
        rmtree '.pc';
     }
@@ -1793,6 +1793,26 @@ sub commit_quilty_patch () {
 }
 
 sub get_source_format () {
+    my %options;
+    if (open F, "debian/source/options") {
+       while (<F>) {
+           next if m/^\s*\#/;
+           next unless m/\S/;
+           s/\s+$//; # ignore missing final newline
+           if (m/\s*\#\s*/) {
+               my ($k, $v) = ($`, $'); #');
+               $v =~ s/^"(.*)"$/$1/;
+               $options{$k} = $v;
+           } else {
+               $options{$_} = 1;
+           }
+       }
+       F->error and die $!;
+       close F;
+    } else {
+       die $! unless $!==&ENOENT;
+    }
+
     if (!open F, "debian/source/format") {
        die $! unless $!==&ENOENT;
        return '';
@@ -1800,7 +1820,7 @@ sub get_source_format () {
     $_ = <F>;
     F->error and die $!;
     chomp;
-    return $_;
+    return ($_, \%options);
 }
 
 sub madformat ($) {
@@ -2473,7 +2493,7 @@ END
        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;
+       runcmd @dpkgsource, qw(--commit .), $patchname;
     }
 }
 
@@ -2718,7 +2738,7 @@ sub quiltify ($$) {
 }
 
 sub build_maybe_quilt_fixup () {
-    my $format=get_source_format;
+    my ($format,$fopts) = get_source_format;
     return unless madformat $format;
     # sigh
 
@@ -2747,7 +2767,7 @@ sub build_maybe_quilt_fixup () {
     # can work.  We do this as follows:
     #     1. Collect all relevant .orig from parent directory
     #     2. Generate a debian.tar.gz out of
-    #         debian/{patches,rules,source/format}
+    #         debian/{patches,rules,source/format,source/options}
     #     3. Generate a fake .dsc containing just these fields:
     #          Format Source Version Files
     #     4. Extract the fake .dsc
@@ -2808,7 +2828,7 @@ END
     }
 
     my @files=qw(debian/source/format debian/rules);
-    foreach my $maybe (qw(debian/patches)) {
+    foreach my $maybe (qw(debian/patches debian/source/options)) {
         next unless stat_exists "../../../$maybe";
         push @files, $maybe;
     }
@@ -2854,7 +2874,8 @@ END
     }
 
     changedir '../../../..';
-    runcmd @git, qw(pull --ff-only -q .git/dgit/unpack/work master);
+    runcmd_ordryrun_local
+        @git, qw(pull --ff-only -q .git/dgit/unpack/work master);
 }
 
 sub quilt_fixup_editor () {