X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=d6a632682574d4096fb45dd346289f4a12c3d47f;hp=f821299f4d06e129de1be4ba6093fac50c867789;hb=69c8de09ff5cb507a7628282d346c2c8fd487a86;hpb=05db7ab051736bb106467e7f83b9e45684dd227c diff --git a/dgit b/dgit index f821299f..d6a63268 100755 --- a/dgit +++ b/dgit @@ -74,7 +74,11 @@ 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 + import-gitapply-absurd + import-gitapply-no-absurd); our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)"); @@ -236,6 +240,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 +1320,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; @@ -1964,9 +1978,15 @@ END $path = "$absurdity:$path"; progress "$us: trying slow absurd-git-apply..."; rename "../../gbp-pq-output","../../gbp-pq-output.0" + or $!==ENOENT or die $!; } eval { + die "forbid absurd git-apply\n" if $use_absurd + && forceing [qw(import-gitapply-no-absurd)]; + die "only absurd git-apply!\n" if !$use_absurd + && forceing [qw(import-gitapply-absurd)]; + local $ENV{PATH} = $path if $use_absurd; my @showcmd = (gbp_pq, qw(import)); @@ -3288,7 +3308,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: @@ -4870,6 +4891,64 @@ sub massage_dbp_args ($;$) { return $r; } +sub in_parent (&) { + my ($fn) = @_; + my $wasdir = must_getcwd(); + changedir ".."; + $fn->(); + changedir $wasdir; +} + +sub postbuild_mergechanges ($) { # must run with CWD=.. (eg in in_parent) + my ($msg_if_onlyone) = @_; + # If there is only one .changes file, fail with $msg_if_onlyone, + # or if that is undef, be a no-op. + # Returns the changes file to report to the user. + my $pat = changespat $version; + my @changesfiles = glob $pat; + @changesfiles = sort { + ($b =~ m/_source\.changes$/ <=> $a =~ m/_source\.changes$/) + or $a cmp $b + } @changesfiles; + my $result; + if (@changesfiles==1) { + fail < $a =~ m/_source\.changes$/) - or $a cmp $b - } @changesfiles; - fail <