scripts/functions: change handling of nochdir
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 12 19:24:03 2010 +0100 (2010-01-12)
changeset 176188020b2c3246
parent 1760 19ee61f81c72
child 1762 7c71e1b5e3ab
scripts/functions: change handling of nochdir

- 'nochdir' must be the first option
- have systematic pushd/popd, even if nochdir
scripts/build/companion_libs/cloog.sh
scripts/build/debug/200-duma.sh
scripts/build/libc/eglibc.sh
scripts/build/libc/glibc.sh
scripts/build/libc/uClibc.sh
scripts/functions
     1.1 --- a/scripts/build/companion_libs/cloog.sh	Sun Dec 13 22:53:36 2009 +0100
     1.2 +++ b/scripts/build/companion_libs/cloog.sh	Tue Jan 12 19:24:03 2010 +0100
     1.3 @@ -29,7 +29,7 @@
     1.4          *)      _t="-${CT_CLOOG_VERSION}";;
     1.5      esac
     1.6      CT_Pushd "${CT_SRC_DIR}/cloog-ppl${_t}"
     1.7 -    CT_Patch "cloog-ppl-${CT_CLOOG_VERSION}" nochdir
     1.8 +    CT_Patch nochdir "cloog-ppl-${CT_CLOOG_VERSION}"
     1.9      CT_Popd
    1.10  }
    1.11  
     2.1 --- a/scripts/build/debug/200-duma.sh	Sun Dec 13 22:53:36 2009 +0100
     2.2 +++ b/scripts/build/debug/200-duma.sh	Tue Jan 12 19:24:03 2010 +0100
     2.3 @@ -16,7 +16,7 @@
     2.4      # name from the version in order to find the appropriate patches
     2.5      # YEM: FIXME: make CT_Patch more intelligent, Eg.: CT_Patch duma _ "${CT_DUMA_VERSION}"
     2.6      CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.duma-${CT_DUMA_VERSION}.extracted"
     2.7 -    CT_Patch "duma-${CT_DUMA_VERSION}" nochdir
     2.8 +    CT_Patch nochdir "duma-${CT_DUMA_VERSION}"
     2.9      CT_Popd
    2.10  }
    2.11  
     3.1 --- a/scripts/build/libc/eglibc.sh	Sun Dec 13 22:53:36 2009 +0100
     3.2 +++ b/scripts/build/libc/eglibc.sh	Tue Jan 12 19:24:03 2010 +0100
     3.3 @@ -101,7 +101,7 @@
     3.4          # NPTL addon is not to be extracted, in any case
     3.5          [ "${addon}" = "nptl" ] && continue || true
     3.6          CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
     3.7 -        CT_Extract "eglibc-${addon}-${CT_LIBC_VERSION}" nochdir
     3.8 +        CT_Extract nochdir "eglibc-${addon}-${CT_LIBC_VERSION}"
     3.9          # Some addons have the 'long' name, while others have the
    3.10          # 'short' name, but patches are non-uniformly built with
    3.11          # either the 'long' or 'short' name, whatever the addons name
    3.12 @@ -110,7 +110,7 @@
    3.13          # directory, returns true!
    3.14          [ -d "${addon}" ] || ln -s "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    3.15          [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ] || ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
    3.16 -        CT_Patch "eglibc-${addon}-${CT_LIBC_VERSION}" nochdir
    3.17 +        CT_Patch nochdir "eglibc-${addon}-${CT_LIBC_VERSION}"
    3.18          CT_Popd
    3.19      done
    3.20  
     4.1 --- a/scripts/build/libc/glibc.sh	Sun Dec 13 22:53:36 2009 +0100
     4.2 +++ b/scripts/build/libc/glibc.sh	Tue Jan 12 19:24:03 2010 +0100
     4.3 @@ -38,13 +38,13 @@
     4.4      CT_Extract "glibc-${CT_LIBC_VERSION}"
     4.5  
     4.6      CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
     4.7 -    CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir
     4.8 +    CT_Patch nochdir "glibc-${CT_LIBC_VERSION}"
     4.9  
    4.10      # C library addons
    4.11      for addon in "${addons_list[@]}"; do
    4.12          # NPTL addon is not to be extracted, in any case
    4.13          [ "${addon}" = "nptl" ] && continue || true
    4.14 -        CT_Extract "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
    4.15 +        CT_Extract nochdir "glibc-${addon}-${CT_LIBC_VERSION}"
    4.16  
    4.17          # Some addons have the 'long' name, while others have the
    4.18          # 'short' name, but patches are non-uniformly built with
    4.19 @@ -54,7 +54,7 @@
    4.20          # directory, returns true!
    4.21          [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    4.22          [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
    4.23 -        CT_Patch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
    4.24 +        CT_Patch nochdir "glibc-${addon}-${CT_LIBC_VERSION}"
    4.25      done
    4.26  
    4.27      # The configure files may be older than the configure.in files
     5.1 --- a/scripts/build/libc/uClibc.sh	Sun Dec 13 22:53:36 2009 +0100
     5.2 +++ b/scripts/build/libc/uClibc.sh	Tue Jan 12 19:24:03 2010 +0100
     5.3 @@ -27,8 +27,8 @@
     5.4      # uClibc locales
     5.5      if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
     5.6          CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale"
     5.7 -        CT_Extract "uClibc-locale-030818" nochdir
     5.8 -        CT_Patch "uClibc-locale-030818" nochdir
     5.9 +        CT_Extract nochdir "uClibc-locale-030818"
    5.10 +        CT_Patch nochdir "uClibc-locale-030818"
    5.11          CT_Popd
    5.12      fi
    5.13  
     6.1 --- a/scripts/functions	Sun Dec 13 22:53:36 2009 +0100
     6.2 +++ b/scripts/functions	Tue Jan 12 19:24:03 2010 +0100
     6.3 @@ -566,12 +566,22 @@
     6.4  # in the extra/locale sub-directory of uClibc. This is taken into account
     6.5  # by the caller, that did a 'cd' into the correct path before calling us
     6.6  # and sets nochdir to 'nochdir'.
     6.7 -# Usage: CT_Extract <basename> [nochdir]
     6.8 +# Usage: CT_Extract [nochdir] <basename>
     6.9  CT_Extract() {
    6.10 -    local basename="$1"
    6.11 -    local nochdir="$2"
    6.12 +    local nochdir="$1"
    6.13 +    local basename
    6.14      local ext
    6.15  
    6.16 +    if [ "${nochdir}" = "nochdir" ]; then
    6.17 +        shift
    6.18 +        nochdir="$(pwd)"
    6.19 +    else
    6.20 +        nochdir="${CT_SRC_DIR}"
    6.21 +    fi
    6.22 +
    6.23 +    basename="$1"
    6.24 +    shift
    6.25 +
    6.26      if ! ext="$(CT_GetFileExtension "${basename}")"; then
    6.27        CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
    6.28      fi
    6.29 @@ -593,7 +603,7 @@
    6.30      fi
    6.31      CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracting"
    6.32  
    6.33 -    [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}"
    6.34 +    CT_Pushd "${nochdir}"
    6.35  
    6.36      CT_DoLog EXTRA "Extracting '${basename}'"
    6.37      case "${ext}" in
    6.38 @@ -611,21 +621,33 @@
    6.39      CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracted"
    6.40      CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.extracting"
    6.41  
    6.42 -    [ "${nochdir}" = "nochdir" ] || CT_Popd
    6.43 +    CT_Popd
    6.44  }
    6.45  
    6.46  # Patches the specified component
    6.47 -# Usage: CT_Patch <basename> [nochdir]
    6.48 +# See CT_Extract, above, for explanations on 'nochdir'
    6.49 +# Usage: CT_Patch [nochdir] <basename>
    6.50  CT_Patch() {
    6.51 -    local basename="$1"
    6.52 -    local nochdir="$2"
    6.53 -    local base_file="${basename%%-*}"
    6.54 -    local ver_file="${basename#*-}"
    6.55 +    local nochdir="$1"
    6.56 +    local basename
    6.57 +    local base_file
    6.58 +    local ver_file
    6.59      local d
    6.60      local -a patch_dirs
    6.61      local bundled_patch_dir
    6.62      local local_patch_dir
    6.63  
    6.64 +    if [ "${nochdir}" = "nochdir" ]; then
    6.65 +        shift
    6.66 +        nochdir="$(pwd)"
    6.67 +    else
    6.68 +        nochdir="${CT_SRC_DIR}/${1}"
    6.69 +    fi
    6.70 +
    6.71 +    basename="$1"
    6.72 +    base_file="${basename%%-*}"
    6.73 +    ver_file="${basename#*-}"
    6.74 +
    6.75      # Check if already patched
    6.76      if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then
    6.77          CT_DoLog DEBUG "Already patched '${basename}'"
    6.78 @@ -643,7 +665,7 @@
    6.79      fi
    6.80      touch "${CT_SRC_DIR}/.${basename}.patching"
    6.81  
    6.82 -    [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}/${basename}"
    6.83 +    CT_Pushd "${nochdir}"
    6.84  
    6.85      CT_DoLog EXTRA "Patching '${basename}'"
    6.86  
    6.87 @@ -686,7 +708,7 @@
    6.88      CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched"
    6.89      CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.patching"
    6.90  
    6.91 -    [ "${nochdir}" = "nochdir" ] || CT_Popd
    6.92 +    CT_Popd
    6.93  }
    6.94  
    6.95  # Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.