# HG changeset patch # User "Yann E. MORIN" # Date 1271020690 -7200 # Node ID bdb3a98e064b350e16283396ed8e57ce6974215e # Parent 835379d47869bb7b690d452ae4f4ae4f4ac6d40c scripts/functions: make CT_Patch dumber It is the responsibility of the caller to split the package name from its version. It already knows that. diff -r 835379d47869 -r bdb3a98e064b scripts/build/binutils/binutils.sh --- a/scripts/build/binutils/binutils.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/binutils/binutils.sh Sun Apr 11 23:18:10 2010 +0200 @@ -12,7 +12,7 @@ # Extract binutils do_binutils_extract() { CT_Extract "binutils-${CT_BINUTILS_VERSION}" - CT_Patch "binutils-${CT_BINUTILS_VERSION}" + CT_Patch "binutils" "${CT_BINUTILS_VERSION}" } # Build binutils diff -r 835379d47869 -r bdb3a98e064b scripts/build/binutils/elf2flt.sh --- a/scripts/build/binutils/elf2flt.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/binutils/elf2flt.sh Sun Apr 11 23:18:10 2010 +0200 @@ -22,7 +22,7 @@ # Extract elf2flt do_elf2flt_extract() { CT_Extract "elf2flt-cvs-${CT_ELF2FLT_VERSION}" - CT_Patch "elf2flt-cvs-${CT_ELF2FLT_VERSION}" + CT_Patch "elf2flt-cvs" "${CT_ELF2FLT_VERSION}" } # Build elf2flt diff -r 835379d47869 -r bdb3a98e064b scripts/build/cc/gcc.sh --- a/scripts/build/cc/gcc.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/cc/gcc.sh Sun Apr 11 23:18:10 2010 +0200 @@ -28,7 +28,7 @@ # Extract gcc do_cc_extract() { CT_Extract "gcc-${CT_CC_VERSION}" - CT_Patch "gcc-${CT_CC_VERSION}" + CT_Patch "gcc" "${CT_CC_VERSION}" # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \ diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_libs/cloog.sh --- a/scripts/build/companion_libs/cloog.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_libs/cloog.sh Sun Apr 11 23:18:10 2010 +0200 @@ -29,7 +29,7 @@ *) _t="-${CT_CLOOG_VERSION}";; esac CT_Pushd "${CT_SRC_DIR}/cloog-ppl${_t}" - CT_Patch nochdir "cloog-ppl-${CT_CLOOG_VERSION}" + CT_Patch nochdir "cloog-ppl" "${CT_CLOOG_VERSION}" CT_Popd } diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_libs/gmp.sh --- a/scripts/build/companion_libs/gmp.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_libs/gmp.sh Sun Apr 11 23:18:10 2010 +0200 @@ -18,7 +18,7 @@ # Extract GMP do_gmp_extract() { CT_Extract "gmp-${CT_GMP_VERSION}" - CT_Patch "gmp-${CT_GMP_VERSION}" + CT_Patch "gmp" "${CT_GMP_VERSION}" } if [ "${CT_GMP}" = "y" ]; then diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_libs/libelf.sh --- a/scripts/build/companion_libs/libelf.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_libs/libelf.sh Sun Apr 11 23:18:10 2010 +0200 @@ -16,7 +16,7 @@ do_libelf_extract() { CT_Extract "libelf-${CT_LIBELF_VERSION}" - CT_Patch "libelf-${CT_LIBELF_VERSION}" + CT_Patch "libelf" "${CT_LIBELF_VERSION}" } if [ "${CT_LIBELF}" = "y" ]; then diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_libs/mpc.sh --- a/scripts/build/companion_libs/mpc.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_libs/mpc.sh Sun Apr 11 23:18:10 2010 +0200 @@ -19,7 +19,7 @@ # Extract MPC do_mpc_extract() { CT_Extract "mpc-${CT_MPC_VERSION}" - CT_Patch "mpc-${CT_MPC_VERSION}" + CT_Patch "mpc" "${CT_MPC_VERSION}" } do_mpc() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_libs/mpfr.sh --- a/scripts/build/companion_libs/mpfr.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_libs/mpfr.sh Sun Apr 11 23:18:10 2010 +0200 @@ -19,7 +19,7 @@ # Extract MPFR do_mpfr_extract() { CT_Extract "mpfr-${CT_MPFR_VERSION}" - CT_Patch "mpfr-${CT_MPFR_VERSION}" + CT_Patch "mpfr" "${CT_MPFR_VERSION}" # OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the # same version number. Unfortunately, some tarballs of MPFR are not diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_libs/ppl.sh --- a/scripts/build/companion_libs/ppl.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_libs/ppl.sh Sun Apr 11 23:18:10 2010 +0200 @@ -21,7 +21,7 @@ # Extract PPL do_ppl_extract() { CT_Extract "ppl-${CT_PPL_VERSION}" - CT_Patch "ppl-${CT_PPL_VERSION}" + CT_Patch "ppl" "${CT_PPL_VERSION}" } do_ppl() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_tools/100-m4.sh --- a/scripts/build/companion_tools/100-m4.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_tools/100-m4.sh Sun Apr 11 23:18:10 2010 +0200 @@ -9,7 +9,7 @@ do_companion_tools_m4_extract() { CT_Extract "m4-${CT_M4_VERSION}" - CT_Patch "m4-${CT_M4_VERSION}" + CT_Patch "m4" "${CT_M4_VERSION}" } do_companion_tools_m4_build() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_tools/200-autoconf.sh --- a/scripts/build/companion_tools/200-autoconf.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_tools/200-autoconf.sh Sun Apr 11 23:18:10 2010 +0200 @@ -9,7 +9,7 @@ do_companion_tools_autoconf_extract() { CT_Extract "autoconf-${CT_AUTOCONF_VERSION}" - CT_Patch "autoconf-${CT_AUTOCONF_VERSION}" + CT_Patch "autoconf" "${CT_AUTOCONF_VERSION}" } do_companion_tools_autoconf_build() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_tools/300-automake.sh --- a/scripts/build/companion_tools/300-automake.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_tools/300-automake.sh Sun Apr 11 23:18:10 2010 +0200 @@ -9,7 +9,7 @@ do_companion_tools_automake_extract() { CT_Extract "automake-${CT_AUTOMAKE_VERSION}" - CT_Patch "automake-${CT_AUTOMAKE_VERSION}" + CT_Patch "automake" "${CT_AUTOMAKE_VERSION}" } do_companion_tools_automake_build() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/companion_tools/400-libtool.sh --- a/scripts/build/companion_tools/400-libtool.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/companion_tools/400-libtool.sh Sun Apr 11 23:18:10 2010 +0200 @@ -9,7 +9,7 @@ do_companion_tools_libtool_extract() { CT_Extract "libtool-${CT_LIBTOOL_VERSION}" - CT_Patch "libtool-${CT_LIBTOOL_VERSION}" + CT_Patch "libtool" "${CT_LIBTOOL_VERSION}" } do_companion_tools_libtool_build() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/debug/000-template.sh --- a/scripts/build/debug/000-template.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/debug/000-template.sh Sun Apr 11 23:18:10 2010 +0200 @@ -11,7 +11,7 @@ do_debug_foobar_extract() { # For example: # CT_Extract "foobar-${CT_FOOBAR_VERSION}" - # CT_Patch "foobar-${CT_FOOBAR_VERSION}" + # CT_Patch "foobar" "${CT_FOOBAR_VERSION}" : } diff -r 835379d47869 -r bdb3a98e064b scripts/build/debug/100-dmalloc.sh --- a/scripts/build/debug/100-dmalloc.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/debug/100-dmalloc.sh Sun Apr 11 23:18:10 2010 +0200 @@ -6,7 +6,7 @@ do_debug_dmalloc_extract() { CT_Extract "dmalloc-${CT_DMALLOC_VERSION}" - CT_Patch "dmalloc-${CT_DMALLOC_VERSION}" + CT_Patch "dmalloc" "${CT_DMALLOC_VERSION}" } do_debug_dmalloc_build() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/debug/200-duma.sh --- a/scripts/build/debug/200-duma.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/debug/200-duma.sh Sun Apr 11 23:18:10 2010 +0200 @@ -12,11 +12,7 @@ do_debug_duma_extract() { CT_Extract "duma_${CT_DUMA_VERSION}" CT_Pushd "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" - # Even if DUMA uses _ and not -, crosstool-NG uses the dash to split the - # 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 nochdir "duma-${CT_DUMA_VERSION}" + CT_Patch nochdir "duma" "${CT_DUMA_VERSION}" CT_Popd } diff -r 835379d47869 -r bdb3a98e064b scripts/build/debug/300-gdb.sh --- a/scripts/build/debug/300-gdb.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/debug/300-gdb.sh Sun Apr 11 23:18:10 2010 +0200 @@ -57,17 +57,17 @@ if [ "${do_gdb}" = "y" ]; then CT_Extract "gdb-${CT_GDB_VERSION}" - CT_Patch "gdb-${CT_GDB_VERSION}" + CT_Patch "gdb" "${CT_GDB_VERSION}" fi if [ "${do_insight}" = "y" ]; then CT_Extract "insight-${CT_GDB_VERSION}" - CT_Patch "insight-${CT_GDB_VERSION}" + CT_Patch "insight" "${CT_GDB_VERSION}" fi if [ "${do_ncurses}" = "y" ]; then CT_Extract "ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}" - CT_Patch "ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}" + CT_Patch "ncurses" "${CT_DEBUG_GDB_NCURSES_VERSION}" fi } diff -r 835379d47869 -r bdb3a98e064b scripts/build/debug/400-ltrace.sh --- a/scripts/build/debug/400-ltrace.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/debug/400-ltrace.sh Sun Apr 11 23:18:10 2010 +0200 @@ -13,7 +13,7 @@ do_debug_ltrace_extract() { CT_Extract "ltrace-${CT_LTRACE_VERSION}" - CT_Patch "ltrace-${CT_LTRACE_VERSION}" + CT_Patch "ltrace" "${CT_LTRACE_VERSION}" } do_debug_ltrace_build() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/debug/500-strace.sh --- a/scripts/build/debug/500-strace.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/debug/500-strace.sh Sun Apr 11 23:18:10 2010 +0200 @@ -8,7 +8,7 @@ do_debug_strace_extract() { CT_Extract "strace-${CT_STRACE_VERSION}" - CT_Patch "strace-${CT_STRACE_VERSION}" + CT_Patch "strace" "${CT_STRACE_VERSION}" } do_debug_strace_build() { diff -r 835379d47869 -r bdb3a98e064b scripts/build/kernel/linux.sh --- a/scripts/build/kernel/linux.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/kernel/linux.sh Sun Apr 11 23:18:10 2010 +0200 @@ -23,7 +23,7 @@ do_kernel_extract() { if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" != "y" ]; then CT_Extract "linux-${CT_KERNEL_VERSION}" - CT_Patch "linux-${CT_KERNEL_VERSION}" + CT_Patch "linux" "${CT_KERNEL_VERSION}" fi return 0 } diff -r 835379d47869 -r bdb3a98e064b scripts/build/libc/eglibc.sh --- a/scripts/build/libc/eglibc.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/libc/eglibc.sh Sun Apr 11 23:18:10 2010 +0200 @@ -94,7 +94,7 @@ # Extract eglibc do_libc_extract() { CT_Extract "eglibc-${CT_LIBC_VERSION}" - CT_Patch "eglibc-${CT_LIBC_VERSION}" + CT_Patch "eglibc" "${CT_LIBC_VERSION}" # C library addons for addon in $(do_libc_add_ons_list " "); do @@ -110,7 +110,7 @@ # 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 nochdir "eglibc-${addon}-${CT_LIBC_VERSION}" + CT_Patch nochdir "eglibc" "${addon}-${CT_LIBC_VERSION}" CT_Popd done diff -r 835379d47869 -r bdb3a98e064b scripts/build/libc/glibc.sh --- a/scripts/build/libc/glibc.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/libc/glibc.sh Sun Apr 11 23:18:10 2010 +0200 @@ -38,7 +38,7 @@ CT_Extract "glibc-${CT_LIBC_VERSION}" CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}" - CT_Patch nochdir "glibc-${CT_LIBC_VERSION}" + CT_Patch nochdir "glibc" "${CT_LIBC_VERSION}" # C library addons for addon in "${addons_list[@]}"; do @@ -54,7 +54,7 @@ # 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 nochdir "glibc-${addon}-${CT_LIBC_VERSION}" + CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}" done # The configure files may be older than the configure.in files diff -r 835379d47869 -r bdb3a98e064b scripts/build/libc/newlib.sh --- a/scripts/build/libc/newlib.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/libc/newlib.sh Sun Apr 11 23:18:10 2010 +0200 @@ -34,7 +34,7 @@ do_libc_extract() { CT_Extract "newlib-$(libc_newlib_version)" - CT_Patch "newlib-$(libc_newlib_version)" + CT_Patch "newlib" "$(libc_newlib_version)" if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then CT_Extract "avr32headers" diff -r 835379d47869 -r bdb3a98e064b scripts/build/libc/uClibc.sh --- a/scripts/build/libc/uClibc.sh Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/build/libc/uClibc.sh Sun Apr 11 23:18:10 2010 +0200 @@ -22,13 +22,13 @@ # Extract uClibc do_libc_extract() { CT_Extract "uClibc-${CT_LIBC_VERSION}" - CT_Patch "uClibc-${CT_LIBC_VERSION}" + CT_Patch "uClibc" "${CT_LIBC_VERSION}" # uClibc locales if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale" CT_Extract nochdir "uClibc-locale-030818" - CT_Patch nochdir "uClibc-locale-030818" + CT_Patch nochdir "uClibc" "locale-030818" CT_Popd fi diff -r 835379d47869 -r bdb3a98e064b scripts/functions --- a/scripts/functions Sun Apr 11 23:17:25 2010 +0200 +++ b/scripts/functions Sun Apr 11 23:18:10 2010 +0200 @@ -708,10 +708,15 @@ # Patches the specified component # See CT_Extract, above, for explanations on 'nochdir' -# Usage: CT_Patch [nochdir] +# Usage: CT_Patch [nochdir] +# If the package directory is *not* packagename-packageversion, then +# the caller must cd into the proper directory first, and call us +# with nochdir CT_Patch() { local nochdir="$1" - local basename + local pkgname + local version + local pkgdir local base_file local ver_file local d @@ -719,40 +724,40 @@ local bundled_patch_dir local local_patch_dir + pkgname="$1" + version="$2" + pkgdir="${pkgname}-${version}" + if [ "${nochdir}" = "nochdir" ]; then shift nochdir="$(pwd)" else - nochdir="${CT_SRC_DIR}/${1}" + nochdir="${CT_SRC_DIR}/${pkgdir}" 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}'" + if [ -e "${CT_SRC_DIR}/.${pkgdir}.patched" ]; then + CT_DoLog DEBUG "Already patched '${pkgdir}'" return 0 fi # Check if already partially patched - if [ -e "${CT_SRC_DIR}/.${basename}.patching" ]; then - CT_DoLog ERROR "The '${basename}' sources were partially patched." + if [ -e "${CT_SRC_DIR}/.${pkgdir}.patching" ]; then + CT_DoLog ERROR "The '${pkgdir}' sources were partially patched." CT_DoLog ERROR "Please remove first:" - CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'" - CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'" - CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patching'" + CT_DoLog ERROR " - the source dir for '${pkgdir}', in '${CT_SRC_DIR}'" + CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.extracted'" + CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${pkgdir}.patching'" CT_Abort "I'll stop now to avoid any carnage..." fi - touch "${CT_SRC_DIR}/.${basename}.patching" + touch "${CT_SRC_DIR}/.${pkgdir}.patching" CT_Pushd "${nochdir}" - CT_DoLog EXTRA "Patching '${basename}'" + CT_DoLog EXTRA "Patching '${pkgdir}'" - bundled_patch_dir="${CT_LIB_DIR}/patches/${base_file}/${ver_file}" - local_patch_dir="${CT_LOCAL_PATCH_DIR}/${base_file}/${ver_file}" + bundled_patch_dir="${CT_LIB_DIR}/patches/${pkgname}/${version}" + local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkgname}/${version}" case "${CT_PATCH_ORDER}" in bundled) patch_dirs=("${bundled_patch_dir}");; @@ -787,8 +792,8 @@ done fi - CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched" - CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.patching" + CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${pkdir}.patched" + CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${pkdir}.patching" CT_Popd }