Gentoo Archives: gentoo-alt

From: Etienne Buira <etienne.buira.lists@××××.fr>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] [PATCH 3/3] scripts/bootstrap-prefix.sh: create etc/make.conf as dir (or populate it if exists)
Date: Sun, 31 Oct 2021 15:40:06
Message-Id: b53e34d9e335ba269a3214d844a9931f65bd173f.1635690454.git.etienne.buira.lists@free.fr
In Reply to: [gentoo-alt] [PATCH 1/3] scripts/bootstrap-prefix: bugfix: do not arbitrarily overwrite EPREFIX by Etienne Buira
1 This makes it easy to (pre)set some site/host specific vars (like -march
2 CFLAG), but still using bootstrap generated make.conf
3 ---
4 scripts/bootstrap-prefix.sh | 17 ++++++++++-------
5 1 file changed, 10 insertions(+), 7 deletions(-)
6
7 diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
8 index 2b9e2e76f2..45d5884648 100755
9 --- a/scripts/bootstrap-prefix.sh
10 +++ b/scripts/bootstrap-prefix.sh
11 @@ -309,7 +309,8 @@ bootstrap_setup() {
12 [[ -e ${ROOT}/foo.$$ ]] && FS_INSENSITIVE=1
13 rm "${ROOT}"/FOO.$$
14
15 - if [[ ! -f ${ROOT}/etc/portage/make.conf ]] ; then
16 + [[ ! -e "${ROOT}/etc/portage/make.conf" ]] && mkdir -p "${ROOT}/etc/portage/make.conf"
17 + if [[ ! -f ${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_make.conf ]] ; then
18 {
19 echo "# Added by bootstrap-prefix.sh for ${CHOST}"
20 echo 'USE="unicode nls"'
21 @@ -340,7 +341,7 @@ bootstrap_setup() {
22 echo "USE=\"\${USE} ${MAKE_CONF_ADDITIONAL_USE}\""
23 [[ ${OFFLINE_MODE} ]] && \
24 echo 'FETCHCOMMAND="bash -c \"echo I need \${FILE} from \${URI} in \${DISTDIR}; read\""'
25 - } > "${ROOT}"/etc/portage/make.conf
26 + } > "${ROOT}"/etc/portage/make.conf/0100_bootstrap_prefix_make.conf
27 fi
28
29 if is-rap ; then
30 @@ -1399,7 +1400,7 @@ bootstrap_stage_host_gentoo() {
31 (bootstrap_tree) || return 1
32
33 # setup a profile
34 - [[ -e ${ROOT}/etc/portage/make.profile && -e ${ROOT}/etc/portage/make.conf ]] || (bootstrap_setup) || return 1
35 + [[ -e ${ROOT}/etc/portage/make.profile && -e ${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_make.conf ]] || (bootstrap_setup) || return 1
36
37 prepare_portage
38 }
39 @@ -1558,7 +1559,7 @@ bootstrap_stage1() {
40 (bootstrap_tree) || return 1
41
42 # setup a profile
43 - [[ -e ${ROOT}/etc/portage/make.profile && -e ${ROOT}/etc/portage/make.conf ]] || (bootstrap_setup) || return 1
44 + [[ -e ${ROOT}/etc/portage/make.profile && -e ${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_make.conf ]] || (bootstrap_setup) || return 1
45 mkdir -p "${ROOT}"/tmp/etc/. || return 1
46 [[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || cp -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc || return 1
47
48 @@ -1629,14 +1630,15 @@ do_emerge_pkgs() {
49 )
50 if [[ " ${USE} " == *" prefix-stack "* ]] &&
51 [[ ${PORTAGE_OVERRIDE_EPREFIX} == */tmp ]] &&
52 - ! grep -q '^USE=".*" # by bootstrap-prefix.sh$' "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
53 + ! grep -Rq '^USE=".*" # by bootstrap-prefix.sh$' "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
54 then
55 # With prefix-stack, the USE env var does apply to the stacked
56 # prefix only, not the base prefix (any more? since some portage
57 # version?), so we have to persist the base USE flags into the
58 # base prefix - without the additional incoming USE flags.
59 + mkdir -p -- "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
60 echo "USE=\"\${USE} ${myuse[*]}\" # by bootstrap-prefix.sh" \
61 - >> "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
62 + >> "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf/0101_bootstrap_prefix_stack.conf"
63 fi
64 myuse=" ${myuse[*]} "
65 local use
66 @@ -1827,6 +1829,7 @@ bootstrap_stage2() {
67 if [[ ${compiler_type} == clang ]] ; then
68 # we use Clang as our toolchain compiler, so we need to make
69 # sure we actually use it
70 + mkdir -p -- "${ROOT}/etc/portage/make.conf"
71 {
72 echo
73 echo "# System compiler on $(uname) Prefix is Clang, do not remove this"
74 @@ -1836,7 +1839,7 @@ bootstrap_stage2() {
75 echo "OBJCXX=${CHOST}-clang++"
76 echo "BUILD_CC=${CHOST}-clang"
77 echo "BUILD_CXX=${CHOST}-clang++"
78 - } >> "${ROOT}"/etc/portage/make.conf
79 + } >> "${ROOT}"/etc/portage/make.conf/0100_bootstrap_prefix_clang.conf
80 # llvm won't setup symlinks to CHOST-clang here because
81 # we're in a cross-ish situation (at least according to
82 # multilib.eclass -- can't blame it at this point really)

Replies