Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gcc-config:master commit in: /
Date: Fri, 22 May 2020 13:20:40
Message-Id: 1590153538.8a4854aec042fc347066a8e73053490c403d7649.slyfox@gentoo
1 commit: 8a4854aec042fc347066a8e73053490c403d7649
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 22 13:18:58 2020 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri May 22 13:18:58 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=8a4854ae
7
8 gcc-config: make USE_NATIVE_LINKS=no to clean stale symlinks
9
10 Before the change symlinks like /usr/bin/cc were untouched.
11 After the change they are explicitly removed.
12
13 Bug: https://bugs.gentoo.org/724454
14 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
15
16 gcc-config | 13 ++++++-------
17 1 file changed, 6 insertions(+), 7 deletions(-)
18
19 diff --git a/gcc-config b/gcc-config
20 index 847cde2..8f9d64c 100755
21 --- a/gcc-config
22 +++ b/gcc-config
23 @@ -287,7 +287,7 @@ update_wrappers() {
24 # `tuple-foo`. Only native ones do we want the simple `foo`
25 # and only for USE_NATIVE_LINKS=yes mode.
26 local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
27 - if ! is_cross_compiler && [[ ${USE_NATIVE_LINKS} == yes ]] ; then
28 + if ! is_cross_compiler ; then
29 all_wrappers+=( "${new_wrappers[@]}" )
30 # There are a few fun extra progs which we have to handle #412319
31 all_wrappers+=( cc:gcc f77:g77 )
32 @@ -303,12 +303,9 @@ update_wrappers() {
33 #
34 # x=cc:gcc -> ref=/path/to/gcc
35 ref="${ROOT}${GCC_PATH}/${x#*:}"
36 - if [[ ${x} == *:* ]] ; then
37 - # Only install a wrapper if the reference binary exists ...
38 - [[ -x ${ref} ]] || continue
39 - fi
40 # x=cc:gcc -> x=cc
41 x=${x%:*}
42 +
43 if [[ ! -x ${ref} ]] ; then
44 if is_cross_compiler ; then
45 ewarn "insanity with ${x} and ${ref}"
46 @@ -320,10 +317,12 @@ update_wrappers() {
47 fi
48
49 # Now do the actual linking to the target binary
50 - if [[ -x ${ref} ]] ; then
51 + if [[ ${x#${CTARGET}-} == ${x} && ${USE_NATIVE_LINKS} != yes ]]; then
52 + # Delete stale native symlink.
53 + rm -f "${EROOT}usr/bin/${x}"
54 + elif [[ -x ${ref} ]] ; then
55 atomic_ln "${ref#${ROOT}}" "${EROOT}usr/bin" "${x}"
56 else
57 - ewarn "double insanity with ${x} and ${ref}"
58 # Make sure we have no stale wrappers
59 rm -f "${EROOT}usr/bin/${x}"
60 fi