summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2019-10-01 06:38:45 -0500
committerathenian200 <athenian200@outlook.com>2019-10-21 04:53:39 -0500
commit9d449ce614ef70479228dd119f6361624d4a6b88 (patch)
treeda851b3f6ebf1a6b5abbc94c8a3eb5752929fb2b /python
parentafc187cc3f907947453b428f857acf16b2b0774e (diff)
downloaduxp-9d449ce614ef70479228dd119f6361624d4a6b88.tar.gz
MoonchildProductions#1251 - Part 2: Make the mozconfig loader POSIX-compliant.
https://bugzilla.mozilla.org/show_bug.cgi?id=1360571 Solaris uses ksh as the default shell, and furthermore bash doesn't seem to support the 'local' keyword feature when invoked as sh on OpenIndiana. We could just change the script to use bash (it is an option even on Solaris), but this fix is available and Mozilla has been using it since Firefox 55 with no issues on any other platforms. It was specfically done this way to avoid any need to change existing mozconfig files, so I feel confident saying the change is totally benign and if anything the way it is now is technically a POSIX compliance issue inherited from Mozilla that we'll hit if we ever try to compile this on any Unix platform where bash isn't sh.
Diffstat (limited to 'python')
-rwxr-xr-xpython/mozbuild/mozbuild/mozconfig_loader38
1 files changed, 18 insertions, 20 deletions
diff --git a/python/mozbuild/mozbuild/mozconfig_loader b/python/mozbuild/mozbuild/mozconfig_loader
index 6b1e05dce3..6c3df47acf 100755
--- a/python/mozbuild/mozbuild/mozconfig_loader
+++ b/python/mozbuild/mozbuild/mozconfig_loader
@@ -10,49 +10,46 @@
set -e
ac_add_options() {
- local opt
- for opt; do
- case "$opt" in
+ for _mozconfig_opt; do
+ case "$_mozconfig_opt" in
--target=*)
echo "------BEGIN_MK_OPTION"
- echo $opt | sed s/--target/CONFIG_GUESS/
+ echo $_mozconfig_opt | sed s/--target/CONFIG_GUESS/
echo "------END_MK_OPTION"
;;
esac
echo "------BEGIN_AC_OPTION"
- echo $opt
+ echo $_mozconfig_opt
echo "------END_AC_OPTION"
done
}
ac_add_app_options() {
- local app
- app=$1
+ _mozconfig_app=$1
shift
echo "------BEGIN_AC_APP_OPTION"
- echo $app
+ echo $_mozconfig_app
echo "$*"
echo "------END_AC_APP_OPTION"
}
mk_add_options() {
- local opt name op value
- for opt; do
+ for _mozconfig_opt; do
echo "------BEGIN_MK_OPTION"
- echo $opt
+ echo $_mozconfig_opt
# Remove any leading "export"
- opt=${opt#export}
- case "$opt" in
- *\?=*) op="?=" ;;
- *:=*) op=":=" ;;
- *+=*) op="+=" ;;
- *=*) op="=" ;;
+ opt=${_mozconfig_opt#export}
+ case "$_mozconfig_opt" in
+ *\?=*) _mozconfig_op="?=" ;;
+ *:=*) _mozconfig_op=":=" ;;
+ *+=*) _mozconfig_op="+=" ;;
+ *=*) _mozconfig_op="=" ;;
esac
# Remove the operator and the value that follows
- name=${opt%%${op}*}
- # Note: $(echo ${name}) strips the variable from any leading and trailing
+ _mozconfig_name=${_mozconfig_opt%%${_mozconfig_op}*}
+ # Note: $(echo ${_mozconfig_name}) strips the variable from any leading and trailing
# whitespaces.
- eval "$(echo ${name})_IS_SET=1"
+ eval "$(echo ${_mozconfig_name})_IS_SET=1"
echo "------END_MK_OPTION"
done
}
@@ -77,4 +74,5 @@ echo "------END_AFTER_SOURCE"
echo "------BEGIN_ENV_AFTER_SOURCE"
$3 $4
+
echo "------END_ENV_AFTER_SOURCE"