chiark / gitweb /
get_source_format returns the debian/source/options, too (nfc since no users yet)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 21 Aug 2015 09:37:11 +0000 (10:37 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 21 Aug 2015 10:11:04 +0000 (11:11 +0100)
dgit

diff --git a/dgit b/dgit
index c1c8b6453206e1ec135907f0970716f8077c1bcf..d6f37ffd3116122222dfee1d61cc7272fd936747 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 ($) {
@@ -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