The following commit has been merged in the master branch:
commit a7500e84a96ad7e5196f4b179931447d7025fa5b
Author: Bdale Garbee <[email protected]>
Date:   Sun Feb 20 11:33:07 2011 -0700

    cowpoke: add a --return option that copies build results to a directory
    
    Closes: #614268
    Signed-off-by: Ron <[email protected]>

diff --git a/cowpoke.conf b/cowpoke.conf
index 7a80a7f..2a2a7cc 100644
--- a/cowpoke.conf
+++ b/cowpoke.conf
@@ -6,7 +6,7 @@
 # ------------------------------------------------------------------
 
 # The hostname of the machine where cowbuilder is installed
-# eg. BUILDD_HOST="buildd.your.com"
+# eg. BUILDD_HOST="buildd.your.org"
 BUILDD_HOST=
 
 # The username for unprivileged operations on BUILDD_HOST
@@ -56,6 +56,11 @@ BUILDD_HOST=
 # debootstrap or cdebootstrap.
 #DEBOOTSTRAP="cdebootstrap"
 
+# If set, package files resulting from the build will be copied to the path
+# (local or remote) that this is set to, after the build completes.  It is
+# unset by default and can be overridden with --return or --no-return.
+# The given path must exist, it will not be created.
+#RETURN_DIR="."
 
 # =============================================================================
 #
diff --git a/debian/changelog b/debian/changelog
index 33cd57a..90fd139 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,13 @@
 devscripts (2.10.72) UNRELEASED; urgency=low
 
+  [ James Vega ]
   * debuild: Use 3-argument form of open to suppress warnings about unused
     symbols.  (Closes: #606054)
 
+  [ Ron Lee ]
+  * cowpoke: add a --return option that copies the build results back to a
+    directory somewhere.  (Closes: #614268)
+
  -- James Vega <[email protected]>  Wed, 02 Mar 2011 00:07:34 -0500
 
 devscripts (2.10.71) unstable; urgency=low
diff --git a/scripts/cowpoke.1 b/scripts/cowpoke.1
index c149d4f..d99db4c 100644
--- a/scripts/cowpoke.1
+++ b/scripts/cowpoke.1
@@ -60,6 +60,16 @@ is not passed it is an error for the specified 
\fB\-\-dist\fP or \fB\-\-arch\fP
 to not have an existing cowbuilder root in the expected location.
 
 .TP
+.BI \-\-return= [path]
+Copy results of the build to \fIpath\fP.  If path is not specified, then return
+them to the current directory. The given path must exist, it will not be 
created.
+
+.TP
+.B \-\-no\-return
+Do not copy results of the build to RETURN_DIR (overriding a path set for it in
+the config files).
+
+.TP
 .BI \-\-dpkg\-opts= "'opt1 opt2 ...'"
 Specify additional options to be passed to \fBdpkg-buildpackage\fP(1).  
Multiple
 options are delimited with spaces.  This will override any options specified in
@@ -156,6 +166,13 @@ here due to its quoting requirements being different from 
all the rest.
 The utility to use when creating a new build root.  Alternatives are
 .BR debootstrap " or " cdebootstrap .
 
+.TP
+.B RETURN_DIR
+If set, package files resulting from the build will be copied to the path
+(local or remote) that this is set to, after the build completes.  The path
+must exist, it will not be created.  This option is unset by default and can
+be overridden with --return or --no-return.
+
 
 .SS Arch and dist specific options
 These are variables of the form: $arch_$dist_VAR which apply only for a
diff --git a/scripts/cowpoke.sh b/scripts/cowpoke.sh
index 60a81ac..ea361ef 100755
--- a/scripts/cowpoke.sh
+++ b/scripts/cowpoke.sh
@@ -80,6 +80,10 @@ cowpoke [options] package.dsc
    --buildd="host"       Specify the remote host to build on.
    --buildd-user="name"  Specify the remote user to build as.
    --create              Create the remote cowbuilder root if necessary.
+   --return[="path"]     Copy results of the build to 'path'.  If path is
+                         not specified, return them to the current directory.
+   --no-return           Do not copy results of the build to RETURN_DIR
+                         (overriding a path set for it in the config files).
 
   The current default configuration is:
 
@@ -87,6 +91,7 @@ cowpoke [options] package.dsc
    BUILDD_USER = $BUILDD_USER
    BUILDD_ARCH = $BUILDD_ARCH
    BUILDD_DIST = $BUILDD_DIST
+   RETURN_DIR  = $RETURN_DIR
 
   The expected remote paths are:
 
@@ -130,6 +135,18 @@ for arg; do
            CREATE_COW="yes"
            ;;
 
+       --return=*)
+           RETURN_DIR="${arg#*=}"
+           ;;
+
+       --return)
+           RETURN_DIR=.
+           ;;
+
+       --no-return)
+           RETURN_DIR=
+           ;;
+
        --dpkg-opts=*)
            DEBBUILDOPTS="--debbuildopts \"${arg#*=}\""
            ;;
@@ -367,6 +384,37 @@ if [ -n "$SIGN_KEYID" ]; then
     done
 fi
 
+if [ -n "$RETURN_DIR" ]; then
+    for arch in $BUILDD_ARCH; do
+      CHANGES="$arch.changes"
+      for dist in $BUILDD_DIST; do
+
+       RESULT_DIR=$(eval echo "\$${arch}_${dist}_RESULT_DIR")
+       [ -n "$RESULT_DIR" ] || RESULT_DIR="$PBUILDER_BASE/$arch/$dist/result"
+
+
+       cache_dir="./cowpoke-return-cache"
+       mkdir -p $cache_dir
+
+       scp "$BUILDD_USER$BUILDD_HOST:$RESULT_DIR/${PACKAGE}_$CHANGES" 
$cache_dir
+
+       for f in $(cd $cache_dir && dcmd ${PACKAGE}_$CHANGES); do
+           RESULTS="$RESULTS $RESULT_DIR/$f"
+       done
+
+       rm -f $cache_dir/${PACKAGE}_$CHANGES
+       rmdir $cache_dir
+
+
+       if ! rsync -vP "$BUILDD_USER$BUILDD_HOST:$RESULTS" "$RETURN_DIR" ;
+       then
+           scp "$BUILDD_USER$BUILDD_HOST:$RESULTS" "$RETURN_DIR"
+       fi
+
+      done
+    done
+fi
+
 rm -f "$REMOTE_SCRIPT"
 
 # vi:sts=4:sw=4:noet:foldmethod=marker

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to