[CalendarServer-changes] [3256] CalendarServer/trunk/run

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 29 10:04:16 PDT 2008


Revision: 3256
          http://trac.macosforge.org/projects/calendarserver/changeset/3256
Author:   wsanchez at apple.com
Date:     2008-10-29 10:04:16 -0700 (Wed, 29 Oct 2008)
Log Message:
-----------
Add cache for svn as well

Modified Paths:
--------------
    CalendarServer/trunk/run

Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run	2008-10-29 16:38:33 UTC (rev 3255)
+++ CalendarServer/trunk/run	2008-10-29 17:04:16 UTC (rev 3256)
@@ -353,7 +353,7 @@
   local revision="$1"; shift;
 
   if [ -d "${path}" ]; then
-    wc_uri="$(svn info --xml "${path}" 2> /dev/null | sed -n 's|^.*<url>\(.*\)</url>.*$|\1|p')";
+    local wc_uri="$(svn info --xml "${path}" 2> /dev/null | sed -n 's|^.*<url>\(.*\)</url>.*$|\1|p')";
 
     if "${force_setup}"; then
       # Verify that we have a working copy checked out from the correct URI
@@ -385,7 +385,7 @@
 
           apply_patches "${name}" "${path}";
         else
-          svnversion="$(svnversion "${path}")";
+          local svnversion="$(svnversion "${path}")";
           if [ "${svnversion%%[M:]*}" != "${revision}" ]; then
             echo "";
             echo "Updating ${name}...";
@@ -397,9 +397,31 @@
       fi;
     fi;
   else
-    echo "Checking out ${name}...";
-    svn checkout -r "${revision}" "${uri}@${revision}" "${path}";
+    echo "";
 
+    checkout () {
+      echo "Checking out ${name}...";
+      svn checkout -r "${revision}" "${uri}@${revision}" "${path}";
+    }
+
+    if [ "${revision}" != "HEAD" ] && [ -n "${cache_deps}" ]; then
+      local cache_file="${cache_deps}/${name}-$(echo "${uri}" | md5)@r${revision}.tgz";
+
+      mkdir -p "${cache_deps}";
+
+      if [ -f "${cache_file}" ]; then
+	echo "Unpacking ${name} from cache...";
+	mkdir -p "${path}";
+	tar -C "${path}" -xvzf "${cache_file}";
+      else
+	checkout;
+	echo "Caching ${name}...";
+	tar -C "${path}" -cvzf "${cache_file}" .;
+      fi;
+    else
+      checkout;
+    fi;
+
     apply_patches "${name}" "${path}";
   fi;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081029/98fe08d5/attachment.html>


More information about the calendarserver-changes mailing list