diff options
-rw-r--r-- | config/global/ct-behave.in | 2 | ||||
-rw-r--r-- | config/global/extract.in | 2 | ||||
-rw-r--r-- | scripts/crosstool-NG.sh.in | 32 | ||||
-rw-r--r-- | scripts/functions | 2 | ||||
-rw-r--r-- | scripts/override/__default | 3 | ||||
-rw-r--r-- | scripts/override/install | 35 |
6 files changed, 61 insertions, 15 deletions
diff --git a/config/global/ct-behave.in b/config/global/ct-behave.in index ba723cf6..a57c7984 100644 --- a/config/global/ct-behave.in +++ b/config/global/ct-behave.in @@ -102,7 +102,7 @@ config DEBUG_CT_SAVE_STEPS_GZIP further doesn't gain much, and takes far more time (believe me, I've got figures here! :-) ). -config NO_OVERIDE_LC_MESSAGES +config NO_OVERRIDE_LC_MESSAGES bool prompt "Do *not* overide LC_MESSAGES (EXPERIMENTAL)" depends on EXPERIMENTAL diff --git a/config/global/extract.in b/config/global/extract.in index 2599faaf..b7547757 100644 --- a/config/global/extract.in +++ b/config/global/extract.in @@ -11,7 +11,7 @@ config FORCE_EXTRACT Useful if you suspect a previous extract did not complete (eg. broken tarball), or you added a new set of patches for this component. -config OVERIDE_CONFIG_GUESS_SUB +config OVERRIDE_CONFIG_GUESS_SUB bool prompt "Override config.{guess,sub}" default y diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 4aa39758..b39dee4f 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -1,4 +1,3 @@ -#!@@CT_bash@@ # Copyright 2007 Yann E. MORIN # Licensed under the GPL v2. See COPYING in the root of this package. @@ -42,7 +41,7 @@ if [ "${CT_DEBUG_INTERACTIVE}" = "y" -a ! \( -t 0 -a -t 6 -a -t 2 \) ]; then fi # Override the locale early, in case we ever translate crosstool-NG messages -if [ -z "${CT_NO_OVERIDE_LC_MESSAGES}" ]; then +if [ -z "${CT_NO_OVERRIDE_LC_MESSAGES}" ]; then export LC_ALL=C export LANG=C fi @@ -104,19 +103,28 @@ CT_TestOrAbort "The CONFIG_SHELL '${CT_CONFIG_SHELL}' is not valid" -f "${CT_CON # Contains symlinks to the tools found by ./configure # Note: CT_DoLog and CT_DoExecLog do not use any of those tool, so # they can be safely used -CT_TOOLS_OVERIDE_DIR="${CT_WORK_DIR}/tools" -CT_DoLog DEBUG "Creating bin-override for tools in '${CT_TOOLS_OVERIDE_DIR}'" -CT_DoExecLog DEBUG mkdir -p "${CT_TOOLS_OVERIDE_DIR}/bin" +CT_TOOLS_OVERRIDE_DIR="${CT_WORK_DIR}/tools" +CT_DoLog DEBUG "Creating bin-override for tools in '${CT_TOOLS_OVERRIDE_DIR}'" +CT_DoExecLog DEBUG mkdir -p "${CT_TOOLS_OVERRIDE_DIR}/bin" cat "${CT_LIB_DIR}/paths.sh" |while read trash line; do tool="${line%%=*}" - path="${line#*=}" - CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}'" - # Note: we need to supress the " in the path because - # there can be arguments in there (thanks autostuff...) - printf "#${BANG}${CT_CONFIG_SHELL}\nexec ${path//\"/} \"\${@}\"\n" >"${CT_TOOLS_OVERIDE_DIR}/bin/${tool}" - CT_DoExecLog ALL chmod 700 "${CT_TOOLS_OVERIDE_DIR}/bin/${tool}" + # Suppress extra quoting + eval path=${line#*=} + if [ -r "${CT_LIB_DIR}/scripts/override/$tool" ]; then + tmpl="${CT_LIB_DIR}/scripts/override/$tool" + else + tmpl="${CT_LIB_DIR}/scripts/override/__default" + fi + CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}' using '${tmpl}' template" + CT_DoExecLog ALL cp "${tmpl}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}" + CT_DoExecLog ALL ${sed} -i -r \ + -e "s#@CONFIG_SHELL@#${CT_CONFIG_SHELL}#g" \ + -e "s#@TOOL_PATH@#${path}#g" \ + -e "s#@TOOLS_OVERRIDE_DIR@#${CT_TOOLS_OVERRIDE_DIR}#g" \ + "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}" + CT_DoExecLog ALL chmod 700 "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}" done -export PATH="${CT_TOOLS_OVERIDE_DIR}/bin:${PATH}" +export PATH="${CT_TOOLS_OVERRIDE_DIR}/bin:${PATH}" # Start date. Can't be done until we know the locale # Also requires the bin-override tools diff --git a/scripts/functions b/scripts/functions index 4e2d67f9..9489f186 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1289,7 +1289,7 @@ CT_Patch() { fi done - if [ "${CT_OVERIDE_CONFIG_GUESS_SUB}" = "y" ]; then + if [ "${CT_OVERRIDE_CONFIG_GUESS_SUB}" = "y" ]; then CT_DoLog ALL "Overiding config.guess and config.sub" for cfg in config_guess config_sub; do eval ${cfg}="${CT_LIB_DIR}/scripts/${cfg/_/.}" diff --git a/scripts/override/__default b/scripts/override/__default new file mode 100644 index 00000000..977b1f52 --- /dev/null +++ b/scripts/override/__default @@ -0,0 +1,3 @@ +#!@CONFIG_SHELL@ + +exec @TOOL_PATH@ "$@" diff --git a/scripts/override/install b/scripts/override/install new file mode 100644 index 00000000..e3954fb6 --- /dev/null +++ b/scripts/override/install @@ -0,0 +1,35 @@ +#!@CONFIG_SHELL@ + +# Do the most common case first +if [ -z "${__PORTAGE_HELPER_PATH}" ]; then + exec @TOOL_PATH@ "$@" +fi + +# Not so simple case: Gentoo uses *two* wrappers around install script +# to deal with extended attributes: +# - /usr/lib/portage/python*/ebuild-helpers/xattr/install +# This sets __PORTAGE_HELPER_PATH (see the check above) and +# invokes either C- or Python-based wrapper (they do the same +# thing anyway). E.g., let it be /usr/bin/install-xattrs... +# - /usr/bin/install-xattrs +# This now analyzes $PATH and invokes 'install' in the first directory +# in $PATH where it is found, but not the __PORTAGE_HELPER_PATH +# This scheme breaks if we interject another install wrapper, resulting +# in a fork bomb. Hence, if we detected a loop, we need to remove our +# own directory from $PATH and try again. Ironically, the very code below +# based on that portage helper. +IFS=: +set -f +path= +for x in ${PATH}; do + case "${x}" in + @TOOLS_OVERRIDE_DIR@/bin) continue;; + esac + if test -n "${path}"; then + path="${path}:${x}" + else + path="${x}" + fi +done +PATH="${path}" +exec @TOOL_PATH@ "$@" |