# HG changeset patch # User "Yann E. MORIN" # Date 1263320643 -3600 # Node ID 88020b2c32467816b27a945517bcc7a1972f0f9c # Parent 19ee61f81c72759cbb75279ecd0220be4f8d6633 scripts/functions: change handling of nochdir - 'nochdir' must be the first option - have systematic pushd/popd, even if nochdir diff -r 19ee61f81c72 -r 88020b2c3246 scripts/build/companion_libs/cloog.sh --- a/scripts/build/companion_libs/cloog.sh Sun Dec 13 22:53:36 2009 +0100 +++ b/scripts/build/companion_libs/cloog.sh Tue Jan 12 19:24:03 2010 +0100 @@ -29,7 +29,7 @@ *) _t="-${CT_CLOOG_VERSION}";; esac CT_Pushd "${CT_SRC_DIR}/cloog-ppl${_t}" - CT_Patch "cloog-ppl-${CT_CLOOG_VERSION}" nochdir + CT_Patch nochdir "cloog-ppl-${CT_CLOOG_VERSION}" CT_Popd } diff -r 19ee61f81c72 -r 88020b2c3246 scripts/build/debug/200-duma.sh --- a/scripts/build/debug/200-duma.sh Sun Dec 13 22:53:36 2009 +0100 +++ b/scripts/build/debug/200-duma.sh Tue Jan 12 19:24:03 2010 +0100 @@ -16,7 +16,7 @@ # name from the version in order to find the appropriate patches # YEM: FIXME: make CT_Patch more intelligent, Eg.: CT_Patch duma _ "${CT_DUMA_VERSION}" CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.duma-${CT_DUMA_VERSION}.extracted" - CT_Patch "duma-${CT_DUMA_VERSION}" nochdir + CT_Patch nochdir "duma-${CT_DUMA_VERSION}" CT_Popd } diff -r 19ee61f81c72 -r 88020b2c3246 scripts/build/libc/eglibc.sh --- a/scripts/build/libc/eglibc.sh Sun Dec 13 22:53:36 2009 +0100 +++ b/scripts/build/libc/eglibc.sh Tue Jan 12 19:24:03 2010 +0100 @@ -101,7 +101,7 @@ # NPTL addon is not to be extracted, in any case [ "${addon}" = "nptl" ] && continue || true CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" - CT_Extract "eglibc-${addon}-${CT_LIBC_VERSION}" nochdir + CT_Extract nochdir "eglibc-${addon}-${CT_LIBC_VERSION}" # Some addons have the 'long' name, while others have the # 'short' name, but patches are non-uniformly built with # either the 'long' or 'short' name, whatever the addons name @@ -110,7 +110,7 @@ # directory, returns true! [ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}" [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}" - CT_Patch "eglibc-${addon}-${CT_LIBC_VERSION}" nochdir + CT_Patch nochdir "eglibc-${addon}-${CT_LIBC_VERSION}" CT_Popd done diff -r 19ee61f81c72 -r 88020b2c3246 scripts/build/libc/glibc.sh --- a/scripts/build/libc/glibc.sh Sun Dec 13 22:53:36 2009 +0100 +++ b/scripts/build/libc/glibc.sh Tue Jan 12 19:24:03 2010 +0100 @@ -38,13 +38,13 @@ CT_Extract "glibc-${CT_LIBC_VERSION}" CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" - CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir + CT_Patch nochdir "glibc-${CT_LIBC_VERSION}" # C library addons for addon in "${addons_list[@]}"; do # NPTL addon is not to be extracted, in any case [ "${addon}" = "nptl" ] && continue || true - CT_Extract "glibc-${addon}-${CT_LIBC_VERSION}" nochdir + CT_Extract nochdir "glibc-${addon}-${CT_LIBC_VERSION}" # Some addons have the 'long' name, while others have the # 'short' name, but patches are non-uniformly built with @@ -54,7 +54,7 @@ # directory, returns true! [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}" [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}" - CT_Patch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir + CT_Patch nochdir "glibc-${addon}-${CT_LIBC_VERSION}" done # The configure files may be older than the configure.in files diff -r 19ee61f81c72 -r 88020b2c3246 scripts/build/libc/uClibc.sh --- a/scripts/build/libc/uClibc.sh Sun Dec 13 22:53:36 2009 +0100 +++ b/scripts/build/libc/uClibc.sh Tue Jan 12 19:24:03 2010 +0100 @@ -27,8 +27,8 @@ # uClibc locales if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale" - CT_Extract "uClibc-locale-030818" nochdir - CT_Patch "uClibc-locale-030818" nochdir + CT_Extract nochdir "uClibc-locale-030818" + CT_Patch nochdir "uClibc-locale-030818" CT_Popd fi diff -r 19ee61f81c72 -r 88020b2c3246 scripts/functions --- a/scripts/functions Sun Dec 13 22:53:36 2009 +0100 +++ b/scripts/functions Tue Jan 12 19:24:03 2010 +0100 @@ -566,12 +566,22 @@ # in the extra/locale sub-directory of uClibc. This is taken into account # by the caller, that did a 'cd' into the correct path before calling us # and sets nochdir to 'nochdir'. -# Usage: CT_Extract [nochdir] +# Usage: CT_Extract [nochdir] CT_Extract() { - local basename="$1" - local nochdir="$2" + local nochdir="$1" + local basename local ext + if [ "${nochdir}" = "nochdir" ]; then + shift + nochdir="$(pwd)" + else + nochdir="${CT_SRC_DIR}" + fi + + basename="$1" + shift + if ! ext="$(CT_GetFileExtension "${basename}")"; then CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}" fi @@ -593,7 +603,7 @@ fi CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracting" - [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}" + CT_Pushd "${nochdir}" CT_DoLog EXTRA "Extracting '${basename}'" case "${ext}" in @@ -611,21 +621,33 @@ CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracted" CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.extracting" - [ "${nochdir}" = "nochdir" ] || CT_Popd + CT_Popd } # Patches the specified component -# Usage: CT_Patch [nochdir] +# See CT_Extract, above, for explanations on 'nochdir' +# Usage: CT_Patch [nochdir] CT_Patch() { - local basename="$1" - local nochdir="$2" - local base_file="${basename%%-*}" - local ver_file="${basename#*-}" + local nochdir="$1" + local basename + local base_file + local ver_file local d local -a patch_dirs local bundled_patch_dir local local_patch_dir + if [ "${nochdir}" = "nochdir" ]; then + shift + nochdir="$(pwd)" + else + nochdir="${CT_SRC_DIR}/${1}" + fi + + basename="$1" + base_file="${basename%%-*}" + ver_file="${basename#*-}" + # Check if already patched if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then CT_DoLog DEBUG "Already patched '${basename}'" @@ -643,7 +665,7 @@ fi touch "${CT_SRC_DIR}/.${basename}.patching" - [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}/${basename}" + CT_Pushd "${nochdir}" CT_DoLog EXTRA "Patching '${basename}'" @@ -686,7 +708,7 @@ CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched" CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.patching" - [ "${nochdir}" = "nochdir" ] || CT_Popd + CT_Popd } # Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.