chiark / gitweb /
dgit: Allow -p with various push modes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Jul 2019 11:14:18 +0000 (12:14 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 6 Jul 2019 14:57:24 +0000 (15:57 +0100)
This checks the supplied package name against the changelog.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 6febb07aa45ef0e69b0a8283a9b5f0afcbe29565..1fa1f529561f3e45d871eb4bf3116e6ef2842a9a 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6575,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);
 }