From 8e9303a546371cfa631ff5f16ea4d7fdcfa6fad8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Oct 2016 21:02:03 +0100 Subject: dgit: --force-*: Provide framework Signed-off-by: Ian Jackson --- dgit | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'dgit') diff --git a/dgit b/dgit index ae07145..33306da 100755 --- a/dgit +++ b/dgit @@ -73,6 +73,8 @@ our $tagformat_want; our $tagformat; our $tagformatfn; +our %forceopts = map { $_=>0 } (); + our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)"); our $suite_re = '[-+.0-9a-z]+'; @@ -222,6 +224,12 @@ END { sub badcfg { print STDERR "$us: invalid configuration: @_\n"; exit 12; } +sub forceable_fail ($$) { + my ($forceoptsl, $msg) = @_; + fail $msg unless grep { $forceopts{$_} } @$forceoptsl; + print STDERR "warning: overriding problem due to --force:\n". $msg; +} + sub no_such_package () { print STDERR "$us: package $package does not exist in suite $isuite\n"; exit 4; @@ -5176,6 +5184,10 @@ sub parseopts () { } elsif (m/^--deliberately-($deliberately_re)$/s) { push @ropts, $_; push @deliberatelies, $&; + } elsif (m/^--force-(.*)/ && defined $forceopts{$1}) { + push @ropts, $&; + $forceopts{$1} = 1; + $_=''; } elsif (m/^--dgit-tag-format=(old|new)$/s) { # undocumented, for testing push @ropts, $_; -- cgit v1.2.3