Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/crossdev:master commit in: /
Date: Sun, 22 Dec 2019 22:32:48
Message-Id: 1577053779.1ebd639ccc8605f3e69b5973788101264902559e.slyfox@gentoo
1 commit: 1ebd639ccc8605f3e69b5973788101264902559e
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 22 22:29:39 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 22 22:29:39 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=1ebd639c
7
8 crossdev: refuse to install crossdev on all CHOST ABIs, not just default
9
10 In bug #500338 attempt to install toolchain for secondary ABY (x86 on amd64
11 system) clobbered native tools with tools that target --systroot=/usr/${CTARGET}.
12
13 That is never an intended state. Block all CHOSTs and suggest using
14 sys-devel/multilib-gcc-wrapper for distcc-like workloads.
15
16 Bug: https://bugs.gentoo.org/500338
17 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
18
19 crossdev | 24 +++++++++++++++++++++++-
20 1 file changed, 23 insertions(+), 1 deletion(-)
21
22 diff --git a/crossdev b/crossdev
23 index cec8170..b0c44c5 100755
24 --- a/crossdev
25 +++ b/crossdev
26 @@ -486,6 +486,7 @@ show_repo_cfg() {
27 setup_portage_vars() {
28 local arch=${ARCH} arch_set=${ARCH+set}
29 local chost=${CHOST} chost_set=${CHOST+set}
30 + local abi
31 unset ARCH CHOST
32 eval $(portageq envvar -v PORT_LOGDIR PORTAGE_TMPDIR ARCH CHOST)
33 parse_repo_config
34 @@ -496,6 +497,17 @@ setup_portage_vars() {
35 HCHOST=${CHOST}
36 [[ ${chost_set} == "set" ]] && CHOST=${chost} || unset CHOST
37
38 + # Collect all CHOST* visible for for host. We need to make sure
39 + # not to clobber any of native CHOSTs.
40 + HCHOSTS=(${HCHOST})
41 + for abi in $(portageq envvar ABI MULTILIB_ABIS DEFAULT_ABI); do
42 + HCHOSTS+=($(portageq envvar CHOST_${abi}))
43 + done
44 + # uniq
45 + HCHOSTS=(
46 + $(printf "%s\n" "${HCHOSTS[@]}" | sort -u)
47 + )
48 +
49 # see if user told us where to write things, otherwise
50 # set up some repos.conf magic if possible. if not,
51 # install our stuff to the first overlay in the list.
52 @@ -682,6 +694,7 @@ UOPTS=
53 TARCH=
54 HARCH=
55 HCHOST=
56 +HCHOSTS=()
57 CTARGET=
58 MULTILIB_ABIS="default"
59 MULTILIB_USE=""
60 @@ -844,6 +857,15 @@ if [[ ${HCHOST} == "${CTARGET}" ]] ; then
61 exit 1
62 fi
63
64 +for hchost in "${HCHOSTS[@]}"; do
65 + if [[ ${hchost} == "${CTARGET}" ]] ; then
66 + eerror "Refusing to create a cross-compiler using the same"
67 + eerror "target name as your host utils."
68 + eerror "Consider using sys-devel/multilib-gcc-wrapper package."
69 + exit 1
70 + fi
71 +done
72 +
73 # grab user settings
74 d="${CONFIGROOT}/crossdev/${CTARGET}"
75 for v in MULTILIB_ABIS USE BVER GVER KVER LVER STAGE CFLAGS LDFLAGS ASFLAGS ; do
76 @@ -935,7 +957,7 @@ info() {
77 hr -
78 einfo "crossdev version: ${CROSSDEV_VER}"
79 einfo "Host Portage ARCH: ${HARCH}"
80 -einfo "Host Portage System: ${HCHOST}"
81 +einfo "Host Portage System: ${HCHOST} (${HCHOSTS[*]})"
82 einfo "Target Portage ARCH: ${TARCH}"
83 einfo "Target System: ${CTARGET}"
84 einfo "Stage: ${STAGE} (${STAGE_DISP[${STAGE}]})"