aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-03-21 19:27:34 -0400
committerMike Frysinger <vapier@gentoo.org>2012-03-21 19:27:34 -0400
commit2de15a99d8c9deddbd57e05515ad6e41b6a30358 (patch)
treef3a5aac2a2a081e33fe7075b3c993bbe16eea174 /gcc-config
parentgcc-config: trust env $CHOST (diff)
downloadgcc-config-2de15a99d8c9deddbd57e05515ad6e41b6a30358.tar.gz
gcc-config-2de15a99d8c9deddbd57e05515ad6e41b6a30358.tar.bz2
gcc-config-2de15a99d8c9deddbd57e05515ad6e41b6a30358.zip
gcc-config: localize old config support to simplify rest of code
This logic is only for old installs, so move it out of the core code paths and make upgrade failures fatal. This way we don't have to care about it later on. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'gcc-config')
-rwxr-xr-xgcc-config30
1 files changed, 19 insertions, 11 deletions
diff --git a/gcc-config b/gcc-config
index 13bc127..1e8a0d8 100755
--- a/gcc-config
+++ b/gcc-config
@@ -294,7 +294,7 @@ switch_profile() {
# Punt old files; maybe globs too much, but oh well
rm -f \
"${GCC_ENV_D}/NATIVE" "${GCC_ENV_D}/.NATIVE" \
- "${ENV_D}/05gcc" "${GCC_ENV_D}/config" \
+ "${ENV_D}/05gcc" \
"${ENV_D}/05gcc-${CTARGET}"-* "${GCC_ENV_D}/config-${CTARGET}"-*
# Help out the gcc wrapper
@@ -403,9 +403,7 @@ switch_profile() {
get_current_profile() {
local conf="${GCC_ENV_D}/config-${CTARGET}"
- if [[ ! -f ${conf} ]] ; then
- conf="${GCC_ENV_D}/config" # old name
- elif [[ -n ${CC_COMP} ]] && is_cross_compiler ; then
+ if [[ -f ${conf} ]] && [[ -n ${CC_COMP} ]] && is_cross_compiler ; then
conf="${conf}-${CC_COMP}"
fi
@@ -438,13 +436,9 @@ list_profiles() {
fi
if [[ ! -f ${GCC_ENV_D}/config-${CTARGET} ]] ; then
- if ! is_cross_compiler && [[ -e ${GCC_ENV_D}/config ]] ; then
- [[ -w ${GCC_ENV_D}/config ]] && mv ${GCC_ENV_D}/config ${GCC_ENV_D}/config-${CTARGET}
- else
- # get_current_profile already warns
- #eerror "${argv0}: No gcc profile is active; please select one!"
- filter=${CTARGET}
- fi
+ # get_current_profile already warns
+ #eerror "${argv0}: No gcc profile is active; please select one!"
+ filter=${CTARGET}
fi
source_var CURRENT "${GCC_ENV_D}"/config-${CTARGET}
@@ -706,6 +700,20 @@ get_chost
&& : ${CTARGET:=${CC_COMP:-${CHOST}}} \
|| : ${CTARGET:=${CHOST}}
+# Do migration of old files
+if [[ -e ${GCC_ENV_D}/config ]] ; then
+ (
+ unset CURRENT
+ . "${GCC_ENV_D}"/config
+ if [[ ${CURRENT} == ${CTARGET}-* ]] ; then
+ mv "${GCC_ENV_D}"/config "${GCC_ENV_D}"/config-${CTARGET} || exit 1
+ else
+ # who knows; force a refresh by punting it
+ rm -f "${GCC_ENV_D}"/config || exit 1
+ fi
+ ) || die "could not get rid of old ${GCC_ENV_D}/config"
+fi
+
if [[ -z ${CC_COMP} ]] ; then
CC_COMP=$(get_current_profile)
if [[ $? -ne 0 ]] ; then