chiark / gitweb /
dgit: Allow -p with various push modes
[dgit.git] / dgit
diff --git a/dgit b/dgit
index e9b2cd54e90a6d29d4d91552dba88516b6d6b713..1fa1f529561f3e45d871eb4bf3116e6ef2842a9a 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -104,7 +104,6 @@ our %forceopts = map { $_=>0 }
 
 our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
 
-our $suite_re = '[-+.0-9a-z]+';
 our $cleanmode_re = qr{(?: dpkg-source (?: -d )? (?: ,no-check | ,all-check )?
                      | (?: git | git-ff ) (?: ,always )?
                          | check (?: ,ignores )?
@@ -4385,6 +4384,10 @@ END
 %s release %s for %s (%s) [dgit]
 ENDT
                or confess "$!";
+           unshift @dtxinfo, "--quilt=$quilt_mode" if madformat($format);
+           unshift @dtxinfo, do_split_brain() ? "split" : "no-split"
+               # rpush protocol 5 and earlier don't tell us
+               unless $we_are_initiator && $protovsn < 6;
            my $dtxinfo = join(" ", "",@dtxinfo);
            print TO <<END or confess "$!";
 [dgit distro=$declaredistro$dtxinfo]
@@ -6572,12 +6575,15 @@ sub WANTSRC_BUILDER () { 02; } # caller should run dpkg-buildpackage
 sub build_or_push_prep_early () {
     our $build_or_push_prep_early_done //= 0;
     return if $build_or_push_prep_early_done++;
-    badusage f_ "-p is not allowed with dgit %s", $subcommand
-       if defined $package;
     my $clogp = parsechangelog();
     $isuite = getfield $clogp, 'Distribution';
-    $package = getfield $clogp, 'Source';
+    my $gotpackage = getfield $clogp, 'Source';
     $version = getfield $clogp, 'Version';
+    $package //= $gotpackage;
+    if ($package ne $gotpackage) {
+       fail f_ "-p specified package %s, but changelog says %s",
+           $package, $gotpackage;
+    }
     $dscfn = dscfn($version);
 }