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

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 17 20:31:48 PST 2009


Revision: 3679
          http://trac.macosforge.org/projects/calendarserver/changeset/3679
Author:   wsanchez at apple.com
Date:     2009-02-17 20:31:48 -0800 (Tue, 17 Feb 2009)
Log Message:
-----------
Use one of a number of hashing commands rather than fixating on md5.

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

Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run	2009-02-18 04:14:59 UTC (rev 3678)
+++ CalendarServer/trunk/run	2009-02-18 04:31:48 UTC (rev 3679)
@@ -227,6 +227,21 @@
 
 export PYTHONPATH="${caldav}";
 
+# Find a command that can hash up a string for us
+if type -t openssl > /dev/null; then
+  hash="hash"; hash () { openssl dgst -md5; }
+elif type -t md5 > /dev/null; then
+  hash="md5";
+elif type -t md5sum > /dev/null; then
+  hash="md5sum";
+elif type -t cksum > /dev/null; then
+  hash="hash"; hash () { cksum | cut -f 1 -d " "; }
+elif type -t sum > /dev/null; then
+  hash="hash"; hash () { sum | cut -f 1 -d " "; }
+else
+  hash="";
+fi;
+
 ##
 # Download and set up dependancies
 ##
@@ -315,10 +330,10 @@
 
     echo "";
 
-    if [ -n "${cache_deps}" ]; then
+    if [ -n "${cache_deps}" ] && [ -n "${hash}" ]; then
       mkdir -p "${cache_deps}";
 
-      cache_file="${cache_deps}/${name}-$(echo "${url}" | md5)-$(basename "${url}")";
+      cache_file="${cache_deps}/${name}-$(echo "${url}" | "${hash}")-$(basename "${url}")";
 
       if [ ! -f "${cache_file}" ]; then
 	echo "Downloading ${name}...";
@@ -400,8 +415,8 @@
       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";
+    if [ "${revision}" != "HEAD" ] && [ -n "${cache_deps}" ] && [ -n "${hash}" ]; then
+      local cache_file="${cache_deps}/${name}-$(echo "${uri}" | "${hash}")@r${revision}.tgz";
 
       mkdir -p "${cache_deps}";
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090217/a2a24c25/attachment.html>


More information about the calendarserver-changes mailing list