From e3a4063ac61b336d96e4c43589e43ab42f9991b6 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Tue, 12 Jan 2010 19:24:03 +0100 Subject: scripts/functions: change handling of nochdir - 'nochdir' must be the first option - have systematic pushd/popd, even if nochdir diff --git a/scripts/build/companion_libs/cloog.sh b/scripts/build/companion_libs/cloog.sh index f6eb68a..bfba0f9 100644 --- a/scripts/build/companion_libs/cloog.sh +++ b/scripts/build/companion_libs/cloog.sh @@ -29,7 +29,7 @@ do_cloog_extract() { *) _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 --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh index 225d00c..de0c5c1 100644 --- a/scripts/build/debug/200-duma.sh +++ b/scripts/build/debug/200-duma.sh @@ -16,7 +16,7 @@ do_debug_duma_extract() { # 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 --git a/scripts/build/libc/eglibc.sh b/scripts/build/libc/eglibc.sh index bea789f..b36201c 100644 --- a/scripts/build/libc/eglibc.sh +++ b/scripts/build/libc/eglibc.sh @@ -101,7 +101,7 @@ do_libc_extract() { # 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 @@ do_libc_extract() { # 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 --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index c77cfee..c6a5dc1 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -38,13 +38,13 @@ do_libc_extract() { 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 @@ do_libc_extract() { # 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 --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh index 0d4775e..009fd14 100644 --- a/scripts/build/libc/uClibc.sh +++ b/scripts/build/libc/uClibc.sh @@ -27,8 +27,8 @@ do_libc_extract() { # 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 --git a/scripts/functions b/scripts/functions index 6477eff..f185ce7 100644 --- a/scripts/functions +++ b/scripts/functions @@ -566,12 +566,22 @@ CT_GetSVN() { # 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 @@ CT_Extract() { 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_Extract() { 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 @@ CT_Patch() { 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_Patch() { 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. -- cgit v0.10.2-6-g49f6