[109264] contrib/buildbot/deploy_archives.sh

jmr at macports.org jmr at macports.org
Sun Aug 11 12:18:37 PDT 2013


Revision: 109264
          https://trac.macports.org/changeset/109264
Author:   jmr at macports.org
Date:     2013-08-11 12:18:37 -0700 (Sun, 11 Aug 2013)
Log Message:
-----------
buildbot: only use lockfile when needed in deploy_archives.sh

Modified Paths:
--------------
    contrib/buildbot/deploy_archives.sh

Modified: contrib/buildbot/deploy_archives.sh
===================================================================
--- contrib/buildbot/deploy_archives.sh	2013-08-11 18:45:14 UTC (rev 109263)
+++ contrib/buildbot/deploy_archives.sh	2013-08-11 19:18:37 UTC (rev 109264)
@@ -15,8 +15,10 @@
     # workaround for buildbot not accepting WithProperties in env
     if [[ -n "$1" ]]; then
         ULPATH="$1"
+        # assume a unique path is used per builder so no locking is needed
     else
         ULPATH="./archive_staging"
+        NEED_LOCK=1
     fi
 fi
 
@@ -27,15 +29,20 @@
 
 # buildbot apparently doesn't run jobs on the master in different dirs or
 # prevent them from running simultaneously
-if [[ -z "$LOCKFILE" ]]; then
-    LOCKFILE="./deploy.lock"
+if [[ -n "$NEED_LOCK" ]]; then
+    if [[ -z "$LOCKFILE" ]]; then
+        LOCKFILE="./deploy.lock"
+    fi
+
+    echo Acquiring lock...
+    lockfile $LOCKFILE -r -1
 fi
 
-lockfile $LOCKFILE.$$ -r -1
-
 if [[ ! -d $ULPATH ]]; then
     echo $ULPATH does not exist!
-    rm $LOCKFILE
+    if [[ -n "$NEED_LOCK" ]]; then
+        rm -f $LOCKFILE
+    fi
     exit 1
 fi
 
@@ -50,7 +57,9 @@
                 chmod a+r ${ULPATH}/${portname}/${aname}.rmd160
             else
                 rm -rf $ULPATH
-                rm $LOCKFILE
+                if [[ -n "$NEED_LOCK" ]]; then
+                    rm -f $LOCKFILE
+                fi
                 exit 1
             fi
         fi
@@ -67,6 +76,8 @@
 fi
 
 # clean up after ourselves
-rm -f $LOCKFILE.$$
+if [[ -n "$NEED_LOCK" ]]; then
+    rm -f $LOCKFILE
+fi
 rm -rf $ULPATH
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130811/18c1f4e5/attachment.html>


More information about the macports-changes mailing list