From d88139021717eeb85131c1e62b23bfb8ec1ca6c5 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 21 Aug 2015 10:37:11 +0100 Subject: [PATCH] get_source_format returns the debian/source/options, too (nfc since no users yet) --- dgit | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/dgit b/dgit index c1c8b645..d6f37ffd 100755 --- 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 () { + 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->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 -- 2.30.2