chiark / gitweb /
Provide --force-dsc-changes-mismatch
[dgit.git] / dgit
diff --git a/dgit b/dgit
index f821299f4d06e129de1be4ba6093fac50c867789..e22036b7d75ca308d3b605217a44ef71839b5505 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -74,7 +74,9 @@ our $tagformat_want;
 our $tagformat;
 our $tagformatfn;
 
-our %forceopts = map { $_=>0 } qw(unrepresentable);
+our %forceopts = map { $_=>0 }
+    qw(unrepresentable unsupported-source-format
+       dsc-changes-mismatch);
 
 our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
 
@@ -236,6 +238,14 @@ sub forceable_fail ($$) {
     print STDERR "warning: overriding problem due to --force:\n". $msg;
 }
 
+sub forceing ($) {
+    my ($forceoptsl) = @_;
+    my @got = grep { $forceopts{$_} } @$forceoptsl;
+    return 0 unless @got;
+    print STDERR
+ "warning: skipping checks or functionality due to --force-$got[0]\n";
+}
+
 sub no_such_package () {
     print STDERR "$us: package $package does not exist in suite $isuite\n";
     exit 4;
@@ -1308,7 +1318,9 @@ sub get_archive_dsc () {
        $dsc = parsecontrolfh($dscfh,$dscurl,1);
        printdebug Dumper($dsc) if $debuglevel>1;
        my $fmt = getfield $dsc, 'Format';
-       fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt};
+       $format_ok{$fmt} or forceable_fail [qw(unsupported-source-format)],
+           "unsupported source format $fmt, sorry";
+           
        $dsc_checked = !!$digester;
        printdebug "get_archive_dsc: Version ".(getfield $dsc, 'Version')."\n";
        return;
@@ -3288,7 +3300,8 @@ END
 
     # Check that changes and .dsc agree enough
     $changesfile =~ m{[^/]*$};
-    files_compare_inputs($dsc, parsecontrol($changesfile,$&));
+    files_compare_inputs($dsc, parsecontrol($changesfile,$&))
+       unless forceing [qw(dsc-changes-mismatch)];
 
     # Checks complete, we're going to try and go ahead: