[tbb-commits] [tor-browser-bundle/hardened-builds] Allow multiple uploads and clean up a bit.

gk at torproject.org gk at torproject.org
Fri Feb 5 08:29:35 UTC 2016


commit faceb24289975308fc5bb5e4f469e6dd2cf8287e
Author: Linus Nordberg <linus at torproject.org>
Date:   Fri Feb 5 08:57:43 2016 +0100

    Allow multiple uploads and clean up a bit.
    
    Use UTC for all dates.
    Have do_check() not changing directory.
    Use a unique staging directory, for allowing multiple simultaneous uploads.
    Clean up staging dir when done.
---
 tools/continuous-builds/park-nightly.sh | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/continuous-builds/park-nightly.sh b/tools/continuous-builds/park-nightly.sh
index 0f418b2..63967c9 100755
--- a/tools/continuous-builds/park-nightly.sh
+++ b/tools/continuous-builds/park-nightly.sh
@@ -11,15 +11,18 @@ fi
 DIR=$1
 [ -z "$DIR" ] && DIR=~/public_html/builds
 
-DSTDIR=tbb-nightly-$(date +%F)
-[ -z "$V" ] || echo "Aiming to fill up $DSTDIR"
+DSTDIR=tbb-nightly-$(date -u +%F) # Must be the same as at source.
+[ -z "$V" ] || echo "Aiming to fill up $DIR/$DSTDIR"
 
 do_check() {
+    SAVEDPWD=$PWD
     [ -z "$1" ] || cd $1 || exit 5
     [ -z "$V" ] || echo "Verifying sha256sums-unsigned-build.txt"
-    gpg -q --verify sha256sums-unsigned-build.txt.asc sha256sums-unsigned-build.txt > /dev/null || exit 3
+    gpg -q --verify sha256sums-unsigned-build.txt.asc \
+        sha256sums-unsigned-build.txt > /dev/null || exit 3
     [ -z "$V" ] || echo "Checking sha256sums-unsigned-build.txt"
     sha256sum --strict --quiet -c sha256sums-unsigned-build.txt || exit 4
+    cd $SAVEDPWD
 }
 
 if [ -d $DIR/$DSTDIR ] && [ -e $DIR/$DSTDIR/tbb-nightly.stamp ]; then
@@ -28,8 +31,11 @@ if [ -d $DIR/$DSTDIR ] && [ -e $DIR/$DSTDIR/tbb-nightly.stamp ]; then
     exit
 fi
 
-[ -d .staging ] || mkdir .staging
-chmod 700 .staging; cd .staging
+STAGINGDIR=.staging.$(date -u +%s)
+[ -z "$V" ] || echo "Temporary staging dir is $STAGINGDIR"
+[ -d $STAGINGDIR ] || mkdir $STAGINGDIR
+chmod 700 $STAGINGDIR; cd $STAGINGDIR || exit 7
+
 [ -z "$V" ] || echo "Saving files to disk"
 TAROPT=x
 [ -z "$V" ] || TAROPT=${TAROPT}v
@@ -37,8 +43,11 @@ tar $TAROPT -f - || exit 6
 touch $DSTDIR/tbb-nightly.stamp
 
 do_check $DSTDIR || exit 2
-[ -d $DIR/$DSTDIR ] && [ -e $DIR/$DSTDIR/tbb-nightly.stamp ] && rm -rf $DIR/$DSTDIR
-cd ..; mv $DSTDIR $DIR/ || exit 1
+[ -d $DIR/$DSTDIR ] && [ -e $DIR/$DSTDIR/tbb-nightly.stamp ] && \
+    rm -rf $DIR/$DSTDIR
+[ -z "$V" ] || echo "Moving $DSTDIR to $DIR/"
+mv $DSTDIR $DIR/ || exit 1
 [ -z "$V" ] || echo "All good, all good"
 
-[ -x ~/usr/bin/prune-old-builds ] && ~/usr/bin/prune-old-builds ~/public_html/builds
+cd ..; rmdir $STAGINGDIR
+[ -x ~/usr/bin/prune-old-builds ] && ~/usr/bin/prune-old-builds $DIR



More information about the tbb-commits mailing list