[CalendarServer-dev] small compatibility fixes (for svn as of today)
Thomas Klausner
tk at giga.or.at
Tue Dec 9 03:39:05 PST 2014
Hi!
The scripts in bin/ claim to be /bin/sh compatible, but use bashisms.
In particular, run, test, and testserver use the test(1) '=='
comparison operator which is only supported by bash, not even by GNU
coreutils. Use '=' instead.
bin/caldavd has
if [ "${py_version/./}" -lt "24" ]; then return 1; fi;
which gives
bin/caldavd: 50: Syntax error: Bad substitution
on NetBSD. I don't know what the portable version of this is, so I've
just used bash for that script.
bin/_build.sh uses 'type -P' which NetBSD's /bin/sh doesn't support
either; and the whitespace in 'Cyrus SASL' causes whitespace quoting
issues for me sometime during the build of cyrus-sasl.
The diff I'm using to get to 'bin/run -n' is attached.
(It's still not working, but the current problem is in twistd.)
Cheers,
Thomas
-------------- next part --------------
Index: bin/_build.sh
===================================================================
--- bin/_build.sh (revision 14210)
+++ bin/_build.sh (working copy)
@@ -512,7 +512,7 @@
local p="${n}-${v}";
c_dependency -m "a7f4e5e559a0e37b3ffc438c9456e425" \
- "Cyrus SASL" "${p}" \
+ "Cyrus_SASL" "${p}" \
"ftp://ftp.cyrusimap.org/cyrus-sasl/${p}.tar.gz" \
--disable-macos-framework;
fi;
@@ -519,7 +519,7 @@
ruler;
- if type -P memcached > /dev/null; then
+ if type memcached > /dev/null; then
using_system "memcached";
else
local v="2.0.21-stable";
@@ -541,7 +541,7 @@
ruler;
- if type -P postgres > /dev/null; then
+ if type postgres > /dev/null; then
using_system "Postgres";
else
local v="9.3.1";
@@ -548,7 +548,7 @@
local n="postgresql";
local p="${n}-${v}";
- if type -P dtrace > /dev/null; then
+ if type dtrace > /dev/null; then
local enable_dtrace="--enable-dtrace";
else
local enable_dtrace="";
Index: bin/run
===================================================================
--- bin/run (revision 14210)
+++ bin/run (working copy)
@@ -80,7 +80,7 @@
echo " -P Select the twistd plugin name [${plugin_name}]";
echo " -R Twisted Reactor plugin to execute [${reactor}]";
- if [ "${1-}" == "-" ]; then
+ if [ "${1-}" = "-" ]; then
return 0;
fi;
exit 64;
@@ -184,7 +184,7 @@
mkdir "${wd}/data";
fi;
- if [ "$(uname -s)" == "Darwin" ] && [ "$(uname -r | cut -d . -f 1)" -ge 9 ]; then
+ if [ "$(uname -s)" = "Darwin" ] && [ "$(uname -r | cut -d . -f 1)" -ge 9 ]; then
caldavd_wrapper_command="launchctl bsexec /";
else
caldavd_wrapper_command="";
Index: bin/test
===================================================================
--- bin/test (revision 14210)
+++ bin/test (working copy)
@@ -46,7 +46,7 @@
numjobs="";
reactor="";
-if [ "$(uname -s)" == "Darwin" ]; then
+if [ "$(uname -s)" = "Darwin" ]; then
reactor="--reactor=kqueue";
fi;
@@ -65,7 +65,7 @@
echo " -u Run until the tests fail.";
echo " -c Generate coverage reports.";
- if [ "${1-}" == "-" ]; then return 0; fi;
+ if [ "${1-}" = "-" ]; then return 0; fi;
exit 64;
}
Index: bin/testserver
===================================================================
--- bin/testserver (revision 14210)
+++ bin/testserver (working copy)
@@ -57,7 +57,7 @@
echo " -z Use SSL.";
echo " -D Turn on CalDAVTester debugging";
- if [ "${1-}" == "-" ]; then return 0; fi;
+ if [ "${1-}" = "-" ]; then return 0; fi;
exit 64;
}
@@ -79,7 +79,7 @@
shift $((${OPTIND} - 1));
-if [ $# == 0 ]; then
+if [ $# = 0 ]; then
set - "--all";
fi;
More information about the calendarserver-dev
mailing list