summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rwxr-xr-xdgit24
2 files changed, 21 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog
index 3dd38e4..d89b41e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ dgit (0.22~experimental1) experimental; urgency=low
Minor improvements:
* Include canonicalised suite name in signed tag message.
* Mention cross-version dgit rpush incompatibility in manpage.
+ * Check for rpush protocol version incompatibility and crash early
+ if incompatible.
* New script tests/using-intree for running tests on the source tree.
* Do not spew diff output to terminal (by default). Print sensible
message instead. Closes:#736526.
diff --git a/dgit b/dgit
index 4095387..53ca56c 100755
--- a/dgit
+++ b/dgit
@@ -34,6 +34,8 @@ use Config;
our $our_version = 'UNRELEASED'; ###substituted###
+our $rpushprotovsn = 2;
+
our $isuite = 'unstable';
our $idistro;
our $package;
@@ -1727,12 +1729,15 @@ sub cmd_push {
#---------- remote commands' implementation ----------
-sub cmd_remote_push_responder {
+sub cmd_remote_push_build_host {
my ($nrargs) = shift @ARGV;
my (@rargs) = @ARGV[0..$nrargs-1];
@ARGV = @ARGV[$nrargs..$#ARGV];
die unless @rargs;
- my ($dir) = @rargs;
+ my ($dir,$vsnwant) = @rargs;
+ # vsnwant is a comma-separated list; we report which we have
+ # chosen in our ready response (so other end can tell if they
+ # offered several)
$debugprefix = ' ';
$we_are_responder = 1;
@@ -1743,12 +1748,21 @@ sub cmd_remote_push_responder {
open STDOUT, ">&STDERR" or die $!;
autoflush STDOUT 1;
- responder_send_command("dgit-remote-push-ready");
+ $vsnwant //= 1;
+ fail "build host has dgit rpush protocol version".
+ " $rpushprotovsn but invocation host has $vsnwant"
+ unless grep { $rpushprotovsn eq $_ } split /,/, $vsnwant;
+
+ responder_send_command("dgit-remote-push-ready $rpushprotovsn");
changedir $dir;
&cmd_push;
}
+sub cmd_remote_push_responder { cmd_remote_push_build_host(); }
+# ... for compatibility with proto vsn.1 dgit (just so that user gets
+# a good error message)
+
our $i_tmp;
sub i_cleanup {
@@ -1784,11 +1798,11 @@ sub cmd_rpush {
$dir = nextarg;
}
$dir =~ s{^-}{./-};
- my @rargs = ($dir);
+ my @rargs = ($dir,$rpushprotovsn);
my @rdgit;
push @rdgit, @dgit;
push @rdgit, @ropts;
- push @rdgit, qw(remote-push-responder), (scalar @rargs), @rargs;
+ push @rdgit, qw(remote-push-build-host), (scalar @rargs), @rargs;
push @rdgit, @ARGV;
my @cmd = (@ssh, $host, shellquote @rdgit);
printcmd \*DEBUG,$debugprefix."+",@cmd;