[PATCH] tests: add compatibility layer
Mikhail
mp39590 at gmail.com
Wed Dec 21 06:56:27 PST 2016
David wrote 21.12.2016, 1:24:45:
> mp39590 at gmail.com writes:
>>
>> +# OS independent functions
>> +#
>> +# Alias native BSD utilities to usable GNU equivalents.
>> +case `uname` in
>> +FreeBSD)
>> + # allow using aliases in scripts
>> + shopt -s expand_aliases
>> +
>> + alias date=gdate
>> + alias base64=gbase64
>> + alias gdb=$BSD_GDB
>> + alias wc=gwc
>> + alias sed="gsed"
>> + alias sha256sum=gsha256sum
>> + ;;
>> +esac
>> +
> What about adding (most of) this to sh.config by the configure script?
> I'd like to centralize all hacky platform detection there.
Do you mean something like this? - Checking $platform and
conditionally adding shopt and aliases. But one must be sure that
every script that source sh.config is a bash script.
diff --git a/configure b/configure
index 72db26df..ef6f657f 100755
--- a/configure
+++ b/configure
@@ -1205,6 +1205,23 @@ NOTMUCH_PYTHON=${python}
NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
EOF
+# Alias native BSD utilities to usable GNU equivalents.
+if [ $platform == FREEBSD ]; then
+ cat >> sh.config <<EOF
+
+# Allow using aliases in bash test scripts
+shopt -s expand_aliases
+
+# Substitute BSD utils with GNU ones (sysutils/coreutils required)
+alias date=gdate
+alias base64=gbase64
+alias gdb=\$BSD_GDB
+alias wc=gwc
+alias sed=gsed
+alias sha256sum=gsha256sum
+EOF
+fi
+
# Finally, after everything configured, inform the user how to continue.
cat <<EOF
> Also, why is gsed in quotes but none of the others are?
Fixed, thanks.
More information about the notmuch
mailing list