Add support for remote build (option --remote)
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 20 Aug 2010 11:44:56 +0000 (13:44 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 20 Aug 2010 11:44:56 +0000 (13:44 +0200)
For example, --remote=idpbuilder@squeeze will build as user
idpbuilder on squeeze. Before rebuild remove old output (not
when doing --upload of course).

id-deb-build/id-pbuild.sh

index cab6efa..03e48f0 100755 (executable)
@@ -43,6 +43,9 @@ while test $# -gt 0; do
         --upload)
            upload=true
            ;;
+        --remote=*)
+           REMOTE=$optarg
+           ;;
        -*)
            do_help=yes
            ;;
@@ -54,6 +57,24 @@ if test "$do_help" = "yes"; then
     usage 1 1>&2
 fi
 
+if test "$REMOTE"; then
+    if test ! -d deb-src; then
+       echo "deb-src not in current directory"
+       exit 1
+    fi
+    cd deb-src
+    PRODUCT=`echo *.dsc|sed 's/_.*//g'`
+    cd ..
+    ssh $REMOTE "mkdir -p $PRODUCT/deb-src"
+    scp IDMETA $REMOTE:$PRODUCT
+    scp deb-src/*.gz deb-src/*.dsc $REMOTE:$PRODUCT/deb-src
+    if $upload; then
+       ssh $REMOTE "cd $PRODUCT; \$HOME/proj/git-tools/id-deb-build/id-pbuild.sh --upload"
+    else
+       ssh $REMOTE "cd $PRODUCT; sudo \$HOME/proj/git-tools/id-deb-build/id-pbuild.sh"
+    fi
+    exit 0
+fi
 if test -d deb-src; then
     cd deb-src
 fi
@@ -94,6 +115,14 @@ if $upload; then
     echo "./update-archive.sh"
     exit 0
 fi
+# remove existing package directories
+for f in [a-z]*; do
+       if test -d $f; then
+               rm -fr $f
+       fi
+done
+rm -f *.log
+
 i=0
 date