diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2021-02-26 09:34:52 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2021-02-26 09:34:52 +0000 |
commit | 3efd8ef43c07a53663d8a1f53f1c13ffb0447b87 (patch) | |
tree | 0627cd203cbacfe5b26c25517b59939c771899ee | |
parent | gcc-config: provide 'gcc-config --get-current-profile [CTARGET]' example (diff) | |
download | gcc-config-3efd8ef43c07a53663d8a1f53f1c13ffb0447b87.tar.gz gcc-config-3efd8ef43c07a53663d8a1f53f1c13ffb0447b87.tar.bz2 gcc-config-3efd8ef43c07a53663d8a1f53f1c13ffb0447b87.zip |
gcc-config: add support for special 'latest' version for profile switchv2.4
To ease switching to latest version add special 'latest' verison.
Works for both "latest" and "<CTARGET>-latest" forms.
Bug: https://bugs.gentoo.org/765664
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-x | gcc-config | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -65,6 +65,8 @@ usage() { Profile names are of the form: <CTARGET>-<version> (like 'i686-pc-linux-gnu-3.2.1') <version> (like '3.2.1') <profile-number> (as specified in '--list-profiles') + latest + <CTARGET>-latest (like mmix-latest) EOF exit ${1:-1} } @@ -1081,6 +1083,14 @@ for x in "$@" ; do die "Could not locate profile #$x !" fi else + # User gave us "latest" or "<CTARGET>-latest". + if [[ ${x} == latest ]]; then + get_chost + x=$(version_sorted_paths "${GCC_ENV_D}"/${CHOST}-* | tail -1) + elif [[ ${x} == *-latest ]]; then + x=$(version_sorted_paths "${GCC_ENV_D}"/${x%-latest}-* | tail -1) + fi + # User gave us a full <CTARGET-version>, <CTARGET> or <version> x=${x##*/} if [[ ${DOIT} == "get_current_profile" && -z $(ls "${GCC_ENV_D}"/${x}-* 2>/dev/null) ]] || \ |