Hi Joachim,

Thanks again for another nice tweak to improve this (:

I was tempted to make this an option, but given how hard it was to find
a machine that didn't have rsync on it to run some tests, that sort of
seems like overkill.  How about the following patch then, which tries
rsync first, then if that fails (because it's not available on the local
or remote machine) just automatically falls back to trying scp.

This way we can leave it to the discretion of the usual devscripts
maintainers as to whether they want to explicitly recommend rsync,
(since at least one of its existing recommends will likely bring it
in anyway), and this script will still work without it.

Sorry for the slow reply, I'm not usually subscribed to devscripts bugs
and only got pointed at it this week.

Cheers,
Ron


>From 0dfd58359d8014300cf4071828585114fc316b1b Mon Sep 17 00:00:00 2001
From: Ron <r...@debian.org>
Date: Sun, 13 Feb 2011 04:39:04 +1030
Subject: [PATCH] cowpoke: try to rsync the source files to the build host

If rsync isn't available, then fall back to scp.  If it is, this can save
repeatedly copying the orig.tar.* when building subsequent debian revisions.

Thanks to Joachim Breitner for the idea and initial patch.

Closes: #610072
Signed-off-by: Ron Lee <r...@debian.org>
---
 scripts/cowpoke.1  |    3 +++
 scripts/cowpoke.sh |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/scripts/cowpoke.1 b/scripts/cowpoke.1
index bf6b2b3..c149d4f 100644
--- a/scripts/cowpoke.1
+++ b/scripts/cowpoke.1
@@ -213,6 +213,9 @@ post-build sanity checking.  Upon completion, the build log and the results of
 automated checks will be recorded in the \fBINCOMING_DIR\fP.  If you wish to
 upload signed packages the build machine will also need \fBdput\fP(1) installed
 and configured to use the 'host' alias specified by \fBUPLOAD_QUEUE\fP.
+If \fBrsync\fP(1) is available on both the local and build machine, then it will
+be used to transfer the source package (this may save on some transfers of the
+orig.tar.* when building subsequent debian revisions).
 
 The user executing \fBcowpoke\fP must have ssh access to the build machine as
 the \fBBUILDD_USER\fP.  That user must be able to invoke cowbuilder as root by
diff --git a/scripts/cowpoke.sh b/scripts/cowpoke.sh
index b5fe70f..60a81ac 100755
--- a/scripts/cowpoke.sh
+++ b/scripts/cowpoke.sh
@@ -301,7 +301,11 @@ EOF
 chmod 755 "$REMOTE_SCRIPT"
 
 
-dcmd scp $DSC "$REMOTE_SCRIPT" "$BUILDD_USER$BUILDD_HOST:$INCOMING_DIR"
+if ! dcmd rsync -vP $DSC "$REMOTE_SCRIPT" "$BUILDD_USER$BUILDD_HOST:$INCOMING_DIR";
+then
+    dcmd scp $DSC "$REMOTE_SCRIPT" "$BUILDD_USER$BUILDD_HOST:$INCOMING_DIR"
+fi
+
 ssh -t "$BUILDD_USER$BUILDD_HOST" "\"$INCOMING_DIR/$REMOTE_SCRIPT\" && rm -f \"$INCOMING_DIR/$REMOTE_SCRIPT\""
 
 echo
-- 
1.7.2.3

Reply via email to