scripts/functions
changeset 1901 bdb3a98e064b
parent 1896 7e81cd6ca0b6
child 1903 0ad4469a2ae1
     1.1 --- a/scripts/functions	Fri Apr 09 21:04:27 2010 +0200
     1.2 +++ b/scripts/functions	Sun Apr 11 23:18:10 2010 +0200
     1.3 @@ -708,10 +708,15 @@
     1.4  
     1.5  # Patches the specified component
     1.6  # See CT_Extract, above, for explanations on 'nochdir'
     1.7 -# Usage: CT_Patch [nochdir] <basename>
     1.8 +# Usage: CT_Patch [nochdir] <packagename> <packageversion>
     1.9 +# If the package directory is *not* packagename-packageversion, then
    1.10 +# the caller must cd into the proper directory first, and call us
    1.11 +# with nochdir
    1.12  CT_Patch() {
    1.13      local nochdir="$1"
    1.14 -    local basename
    1.15 +    local pkgname
    1.16 +    local version
    1.17 +    local pkgdir
    1.18      local base_file
    1.19      local ver_file
    1.20      local d
    1.21 @@ -719,40 +724,40 @@
    1.22      local bundled_patch_dir
    1.23      local local_patch_dir
    1.24  
    1.25 +    pkgname="$1"
    1.26 +    version="$2"
    1.27 +    pkgdir="${pkgname}-${version}"
    1.28 +
    1.29      if [ "${nochdir}" = "nochdir" ]; then
    1.30          shift
    1.31          nochdir="$(pwd)"
    1.32      else
    1.33 -        nochdir="${CT_SRC_DIR}/${1}"
    1.34 +        nochdir="${CT_SRC_DIR}/${pkgdir}"
    1.35      fi
    1.36  
    1.37 -    basename="$1"
    1.38 -    base_file="${basename%%-*}"
    1.39 -    ver_file="${basename#*-}"
    1.40 -
    1.41      # Check if already patched
    1.42 -    if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then
    1.43 -        CT_DoLog DEBUG "Already patched '${basename}'"
    1.44 +    if [ -e "${CT_SRC_DIR}/.${pkgdir}.patched" ]; then
    1.45 +        CT_DoLog DEBUG "Already patched '${pkgdir}'"
    1.46          return 0
    1.47      fi
    1.48  
    1.49      # Check if already partially patched
    1.50 -    if [ -e "${CT_SRC_DIR}/.${basename}.patching" ]; then
    1.51 -        CT_DoLog ERROR "The '${basename}' sources were partially patched."
    1.52 +    if [ -e "${CT_SRC_DIR}/.${pkgdir}.patching" ]; then
    1.53 +        CT_DoLog ERROR "The '${pkgdir}' sources were partially patched."
    1.54          CT_DoLog ERROR "Please remove first:"
    1.55 -        CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'"
    1.56 -        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'"
    1.57 -        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patching'"
    1.58 +        CT_DoLog ERROR " - the source dir for '${pkgdir}', in '${CT_SRC_DIR}'"
    1.59 +        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.extracted'"
    1.60 +        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.patching'"
    1.61          CT_Abort "I'll stop now to avoid any carnage..."
    1.62      fi
    1.63 -    touch "${CT_SRC_DIR}/.${basename}.patching"
    1.64 +    touch "${CT_SRC_DIR}/.${pkgdir}.patching"
    1.65  
    1.66      CT_Pushd "${nochdir}"
    1.67  
    1.68 -    CT_DoLog EXTRA "Patching '${basename}'"
    1.69 +    CT_DoLog EXTRA "Patching '${pkgdir}'"
    1.70  
    1.71 -    bundled_patch_dir="${CT_LIB_DIR}/patches/${base_file}/${ver_file}"
    1.72 -    local_patch_dir="${CT_LOCAL_PATCH_DIR}/${base_file}/${ver_file}"
    1.73 +    bundled_patch_dir="${CT_LIB_DIR}/patches/${pkgname}/${version}"
    1.74 +    local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkgname}/${version}"
    1.75  
    1.76      case "${CT_PATCH_ORDER}" in
    1.77          bundled)        patch_dirs=("${bundled_patch_dir}");;
    1.78 @@ -787,8 +792,8 @@
    1.79          done
    1.80      fi
    1.81  
    1.82 -    CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched"
    1.83 -    CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.patching"
    1.84 +    CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${pkdir}.patched"
    1.85 +    CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${pkdir}.patching"
    1.86  
    1.87      CT_Popd
    1.88  }