scripts, cc/gcc: do not fail on existing symlinks or build.log 1.11
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jul 12 23:52:24 2011 +0200 (2011-07-12)
branch1.11
changeset 2558b7317d2fe0e9
parent 2557 b71761e8cff1
child 2559 af44455a6567
scripts, cc/gcc: do not fail on existing symlinks or build.log

If the user builds a toolchain over an existing one, so, without removing
CT_PREFIX_DIR, the build fails as the symlinks already exist, as does the
build.log.

This can also happen (for build.log) if the user first ran in download-
or extract-only.

Patch (with no SoB) originally from:
Phil Wilshire <phil.wilshire@overturenetworks.com>

Modified by me as it did not apply cleanly.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 1ebc2248cc60230cd53ff94ae8f8f1e3261461a3)
scripts/build/cc/gcc.sh
scripts/build/internals.sh
scripts/crosstool-NG.sh.in
     1.1 --- a/scripts/build/cc/gcc.sh	Fri Apr 15 00:22:42 2011 +0200
     1.2 +++ b/scripts/build/cc/gcc.sh	Tue Jul 12 23:52:24 2011 +0200
     1.3 @@ -354,7 +354,7 @@
     1.4      # check whether compiler has an extension
     1.5      file="$( ls -1 "${core_prefix_dir}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
     1.6      [ -z "${file}" ] || ext=".${file##*.}"
     1.7 -    CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}"
     1.8 +    CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}"
     1.9  
    1.10      CT_EndStep
    1.11  }
    1.12 @@ -569,7 +569,7 @@
    1.13      # check whether compiler has an extension
    1.14      file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
    1.15      [ -z "${file}" ] || ext=".${file##*.}"
    1.16 -    CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
    1.17 +    CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
    1.18  
    1.19      CT_EndStep
    1.20  }
     2.1 --- a/scripts/build/internals.sh	Fri Apr 15 00:22:42 2011 +0200
     2.2 +++ b/scripts/build/internals.sh	Tue Jul 12 23:52:24 2011 +0200
     2.3 @@ -86,14 +86,14 @@
     2.4      for t in "${CT_TARGET}-"*; do
     2.5          if [ -n "${CT_TARGET_ALIAS}" ]; then
     2.6              _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
     2.7 -            CT_DoExecLog ALL ln -sv "${t}" "${_t}"
     2.8 +            CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
     2.9          fi
    2.10          if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
    2.11              _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
    2.12              if [ "${_t}" = "${t}" ]; then
    2.13                  CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'"
    2.14              else
    2.15 -                CT_DoExecLog ALL ln -sv "${t}" "${_t}"
    2.16 +                CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
    2.17              fi
    2.18          fi
    2.19      done
     3.1 --- a/scripts/crosstool-NG.sh.in	Fri Apr 15 00:22:42 2011 +0200
     3.2 +++ b/scripts/crosstool-NG.sh.in	Tue Jul 12 23:52:24 2011 +0200
     3.3 @@ -597,7 +597,7 @@
     3.4  # moment... Consign all ouptut to oblivion...
     3.5  CT_DoLog INFO "Finishing installation (may take a few seconds)..."
     3.6  exec >/dev/null 2>&1
     3.7 -
     3.8 +rm -f ${CT_PREFIX_DIR}/build.log.bz2
     3.9  if [ "${CT_LOG_TO_FILE}" = "y" ]; then
    3.10      cp "${tmp_log_file}" "${CT_PREFIX_DIR}/build.log"
    3.11      if [ "${CT_LOG_FILE_COMPRESS}" = y ]; then