summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-01-12 18:24:03 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-01-12 18:24:03 (GMT)
commite3a4063ac61b336d96e4c43589e43ab42f9991b6 (patch)
tree5693326f9d6e08b7f025fac7a748fc0f738e0be0 /scripts/functions
parent5280cd71beeedfff4d980487e91455405de4e1d2 (diff)
scripts/functions: change handling of nochdir
- 'nochdir' must be the first option - have systematic pushd/popd, even if nochdir
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions46
1 files changed, 34 insertions, 12 deletions
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 <basename> [nochdir]
+# Usage: CT_Extract [nochdir] <basename>
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 <basename> [nochdir]
+# See CT_Extract, above, for explanations on 'nochdir'
+# Usage: CT_Patch [nochdir] <basename>
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.