scripts/functions: change handling of nochdir

- 'nochdir' must be the first option
- have systematic pushd/popd, even if nochdir
This commit is contained in:
Yann E. MORIN" 2010-01-12 19:24:03 +01:00
parent 5280cd71be
commit e3a4063ac6
6 changed files with 43 additions and 21 deletions

View File

@ -29,7 +29,7 @@ do_cloog_extract() {
*) _t="-${CT_CLOOG_VERSION}";; *) _t="-${CT_CLOOG_VERSION}";;
esac esac
CT_Pushd "${CT_SRC_DIR}/cloog-ppl${_t}" 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 CT_Popd
} }

View File

@ -16,7 +16,7 @@ do_debug_duma_extract() {
# name from the version in order to find the appropriate patches # 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}" # 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_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 CT_Popd
} }

View File

@ -101,7 +101,7 @@ do_libc_extract() {
# NPTL addon is not to be extracted, in any case # NPTL addon is not to be extracted, in any case
[ "${addon}" = "nptl" ] && continue || true [ "${addon}" = "nptl" ] && continue || true
CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" 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 # Some addons have the 'long' name, while others have the
# 'short' name, but patches are non-uniformly built with # 'short' name, but patches are non-uniformly built with
# either the 'long' or 'short' name, whatever the addons name # either the 'long' or 'short' name, whatever the addons name
@ -110,7 +110,7 @@ do_libc_extract() {
# directory, returns true! # directory, returns true!
[ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}" [ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
[ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}" [ -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 CT_Popd
done done

View File

@ -38,13 +38,13 @@ do_libc_extract() {
CT_Extract "glibc-${CT_LIBC_VERSION}" CT_Extract "glibc-${CT_LIBC_VERSION}"
CT_Pushd "${CT_SRC_DIR}/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 # C library addons
for addon in "${addons_list[@]}"; do for addon in "${addons_list[@]}"; do
# NPTL addon is not to be extracted, in any case # NPTL addon is not to be extracted, in any case
[ "${addon}" = "nptl" ] && continue || true [ "${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 # Some addons have the 'long' name, while others have the
# 'short' name, but patches are non-uniformly built with # 'short' name, but patches are non-uniformly built with
@ -54,7 +54,7 @@ do_libc_extract() {
# directory, returns true! # directory, returns true!
[ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}" [ -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}" [ -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 done
# The configure files may be older than the configure.in files # The configure files may be older than the configure.in files

View File

@ -27,8 +27,8 @@ do_libc_extract() {
# uClibc locales # uClibc locales
if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale" CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale"
CT_Extract "uClibc-locale-030818" nochdir CT_Extract nochdir "uClibc-locale-030818"
CT_Patch "uClibc-locale-030818" nochdir CT_Patch nochdir "uClibc-locale-030818"
CT_Popd CT_Popd
fi fi

View File

@ -566,12 +566,22 @@ CT_GetSVN() {
# in the extra/locale sub-directory of uClibc. This is taken into account # 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 # by the caller, that did a 'cd' into the correct path before calling us
# and sets nochdir to 'nochdir'. # and sets nochdir to 'nochdir'.
# Usage: CT_Extract <basename> [nochdir] # Usage: CT_Extract [nochdir] <basename>
CT_Extract() { CT_Extract() {
local basename="$1" local nochdir="$1"
local nochdir="$2" local basename
local ext local ext
if [ "${nochdir}" = "nochdir" ]; then
shift
nochdir="$(pwd)"
else
nochdir="${CT_SRC_DIR}"
fi
basename="$1"
shift
if ! ext="$(CT_GetFileExtension "${basename}")"; then if ! ext="$(CT_GetFileExtension "${basename}")"; then
CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}" CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
fi fi
@ -593,7 +603,7 @@ CT_Extract() {
fi fi
CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracting" CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracting"
[ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}" CT_Pushd "${nochdir}"
CT_DoLog EXTRA "Extracting '${basename}'" CT_DoLog EXTRA "Extracting '${basename}'"
case "${ext}" in case "${ext}" in
@ -611,21 +621,33 @@ CT_Extract() {
CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracted" CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracted"
CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.extracting" CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.extracting"
[ "${nochdir}" = "nochdir" ] || CT_Popd CT_Popd
} }
# Patches the specified component # Patches the specified component
# Usage: CT_Patch <basename> [nochdir] # See CT_Extract, above, for explanations on 'nochdir'
# Usage: CT_Patch [nochdir] <basename>
CT_Patch() { CT_Patch() {
local basename="$1" local nochdir="$1"
local nochdir="$2" local basename
local base_file="${basename%%-*}" local base_file
local ver_file="${basename#*-}" local ver_file
local d local d
local -a patch_dirs local -a patch_dirs
local bundled_patch_dir local bundled_patch_dir
local local_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 # Check if already patched
if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then
CT_DoLog DEBUG "Already patched '${basename}'" CT_DoLog DEBUG "Already patched '${basename}'"
@ -643,7 +665,7 @@ CT_Patch() {
fi fi
touch "${CT_SRC_DIR}/.${basename}.patching" touch "${CT_SRC_DIR}/.${basename}.patching"
[ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}/${basename}" CT_Pushd "${nochdir}"
CT_DoLog EXTRA "Patching '${basename}'" CT_DoLog EXTRA "Patching '${basename}'"
@ -686,7 +708,7 @@ CT_Patch() {
CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched" CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched"
CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.patching" 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. # Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.