summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-04-14 01:37:33 -0400
committerMike Frysinger <vapier@gentoo.org>2016-04-14 01:38:47 -0400
commite5fdfd991ec21885d4141440da97189f29dfa7b9 (patch)
treefbda93a186ce21e47289c1cf4ef0c9391bf9fa04 /eclass/toolchain.eclass
parentdev-python/django-tastypie: bump to vn 0.13.3 (diff)
downloadgentoo-e5fdfd991ec21885d4141440da97189f29dfa7b9.tar.gz
gentoo-e5fdfd991ec21885d4141440da97189f29dfa7b9.tar.bz2
gentoo-e5fdfd991ec21885d4141440da97189f29dfa7b9.zip
toolchain.eclass: automatically select latest gcc-config profile when unmerging active version #529608
If the user is unmerging the current version, try and automatically switch to a better version. We blindly pick the latest one available for the target in question since there's not really a better metric to figure out which one the user actually would want.
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass34
1 files changed, 22 insertions, 12 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 03e550dd6f72..b875e198b367 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2050,26 +2050,36 @@ do_gcc_config() {
return 0
fi
- local current_gcc_config="" current_specs="" use_specs=""
+ local current_gcc_config target
current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
if [[ -n ${current_gcc_config} ]] ; then
+ local current_specs use_specs
# figure out which specs-specific config is active
current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
[[ -n ${current_specs} ]] && use_specs=-${current_specs}
- fi
- if [[ -n ${use_specs} ]] && \
- [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
- then
- ewarn "The currently selected specs-specific gcc config,"
- ewarn "${current_specs}, doesn't exist anymore. This is usually"
- ewarn "due to enabling/disabling hardened or switching to a version"
- ewarn "of gcc that doesnt create multiple specs files. The default"
- ewarn "config will be used, and the previous preference forgotten."
- use_specs=""
+
+ if [[ -n ${use_specs} ]] && \
+ [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
+ then
+ ewarn "The currently selected specs-specific gcc config,"
+ ewarn "${current_specs}, doesn't exist anymore. This is usually"
+ ewarn "due to enabling/disabling hardened or switching to a version"
+ ewarn "of gcc that doesnt create multiple specs files. The default"
+ ewarn "config will be used, and the previous preference forgotten."
+ use_specs=""
+ fi
+
+ target="${CTARGET}-${GCC_CONFIG_VER}${use_specs}"
+ else
+ # The curent target is invalid. Attempt to switch to a valid one.
+ # Blindly pick the latest version. #529608
+ # TODO: Should update gcc-config to accept `-l ${CTARGET}` rather than
+ # doing a partial grep like this.
+ target=$(gcc-config -l 2>/dev/null | grep " ${CTARGET}-[0-9]" | tail -1 | awk '{print $2}')
fi
- gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs}
+ gcc-config "${target}"
}
should_we_gcc_config() {