[CalendarServer-changes] [5943] CalendarServer/trunk/support/build.sh
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jul 26 14:04:55 PDT 2010
Revision: 5943
http://trac.macosforge.org/projects/calendarserver/changeset/5943
Author: wsanchez at apple.com
Date: 2010-07-26 14:04:54 -0700 (Mon, 26 Jul 2010)
Log Message:
-----------
Clean up $hash/hash and use hash if $hash is md5.
Modified Paths:
--------------
CalendarServer/trunk/support/build.sh
Modified: CalendarServer/trunk/support/build.sh
===================================================================
--- CalendarServer/trunk/support/build.sh 2010-07-26 19:45:31 UTC (rev 5942)
+++ CalendarServer/trunk/support/build.sh 2010-07-26 21:04:54 UTC (rev 5943)
@@ -85,20 +85,23 @@
# Find a command that can hash up a string for us
if type -t openssl > /dev/null; then
- hash="hash";
- hash () { openssl dgst -md5; }
+ hash="md5";
+ hash () { openssl dgst -md5 "$@"; }
elif type -t md5 > /dev/null; then
hash="md5";
+ hash () { md5 "$@"; }
elif type -t md5sum > /dev/null; then
- hash="md5sum";
+ hash="md5";
+ hash () { md5sum "$@"; }
elif type -t cksum > /dev/null; then
hash="hash";
- hash () { cksum | cut -f 1 -d " "; }
+ hash () { cksum "$@" | cut -f 1 -d " "; }
elif type -t sum > /dev/null; then
hash="hash";
- hash () { sum | cut -f 1 -d " "; }
+ hash () { sum "$@" | cut -f 1 -d " "; }
else
hash="";
+ hash () { echo "INTERNAL ERROR: No hash function."; exit 1; }
fi;
if [ -n "${install}" ] && ! echo "${install}" | grep '^/' > /dev/null; then
@@ -190,16 +193,16 @@
if [ -n "${cache_deps}" ] && [ -n "${hash}" ]; then
mkdir -p "${cache_deps}";
- cache_file="${cache_deps}/${name}-$(echo "${url}" | "${hash}")-$(basename "${url}")";
+ cache_file="${cache_deps}/${name}-$(echo "${url}" | hash)-$(basename "${url}")";
if [ ! -f "${cache_file}" ]; then
echo "Downloading ${name}...";
curl -L "${url}" -o "${cache_file}";
fi;
- if [ -n "${md5}" ]; then
+ if [ -n "${md5}" ] && [ "${hash}" == "md5" ]; then
echo "Checking MD5 sum for ${name}...";
- local sum="$(md5 "${cache_file}" | perl -pe 's|^.*([0-9a-f]{32}).*$|\1|')";
+ local sum="$(hash "${cache_file}" | perl -pe 's|^.*([0-9a-f]{32}).*$|\1|')";
if [ "${md5}" != "${sum}" ]; then
echo "ERROR: MD5 sum for cache file ${cache_file} ${sum} != ${md5}. Corrupt file?";
exit 1;
@@ -279,7 +282,7 @@
}
if [ "${revision}" != "HEAD" ] && [ -n "${cache_deps}" ] && [ -n "${hash}" ]; then
- local cache_file="${cache_deps}/${name}-$(echo "${uri}" | "${hash}")@r${revision}.tgz";
+ 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/20100726/0de69d65/attachment.html>
More information about the calendarserver-changes
mailing list