Gentoo Archives: gentoo-alt

From: Etienne Buira <etienne.buira.lists@××××.fr>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] [PATCH v2 3/3] scripts/bootstrap-prefix.sh: create etc/make.conf as dir
Date: Sat, 04 Dec 2021 07:53:53
Message-Id: 1dba8ce721695fc5cc8c7d7f1b63eac4bc72cd93.1638604209.git.etienne.buira.lists@free.fr
In Reply to: [gentoo-alt] [PATCH v2 1/3] scripts/bootstrap-prefix: bugfix: use given EPREFIX by Etienne Buira
1 This makes it easy to (pre)set some site/host specific portage
2 configuration that will only get picked once portage is in shape enough
3 to run on its own, while letting bootstrap-prefix set its own settings.
4
5 v2:
6 - added MAKE_CONF_DIR global helper variable
7 - added local override var where appropriate
8 - some reformating (not strictly adhering to 80 chars, but close to)
9 - shortened $subject
10
11 Thanks grobian for review
12 ---
13 scripts/bootstrap-prefix.sh | 25 ++++++++++++++++++-------
14 1 file changed, 18 insertions(+), 7 deletions(-)
15
16 diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
17 index 4d345ad437..e372fb21da 100755
18 --- a/scripts/bootstrap-prefix.sh
19 +++ b/scripts/bootstrap-prefix.sh
20 @@ -309,7 +309,8 @@ bootstrap_setup() {
21 [[ -e ${ROOT}/foo.$$ ]] && FS_INSENSITIVE=1
22 rm "${ROOT}"/FOO.$$
23
24 - if [[ ! -f ${ROOT}/etc/portage/make.conf ]] ; then
25 + [[ ! -e "${MAKE_CONF_DIR}" ]] && mkdir -p -- "${MAKE_CONF_DIR}"
26 + if [[ ! -f ${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_make.conf ]] ; then
27 {
28 echo "# Added by bootstrap-prefix.sh for ${CHOST}"
29 echo 'USE="unicode nls"'
30 @@ -340,7 +341,7 @@ bootstrap_setup() {
31 echo "USE=\"\${USE} ${MAKE_CONF_ADDITIONAL_USE}\""
32 [[ ${OFFLINE_MODE} ]] && \
33 echo 'FETCHCOMMAND="bash -c \"echo I need \${FILE} from \${URI} in \${DISTDIR}; read\""'
34 - } > "${ROOT}"/etc/portage/make.conf
35 + } > "${MAKE_CONF_DIR}/0100_bootstrap_prefix_make.conf"
36 fi
37
38 if is-rap ; then
39 @@ -1415,7 +1416,9 @@ bootstrap_stage_host_gentoo() {
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 && \
45 + -e ${MAKE_CONF_DIR}/0100_bootstrap_prefix_make.conf ]] \
46 + || (bootstrap_setup) || return 1
47
48 prepare_portage
49 }
50 @@ -1574,7 +1577,9 @@ bootstrap_stage1() {
51 (bootstrap_tree) || return 1
52
53 # setup a profile
54 - [[ -e ${ROOT}/etc/portage/make.profile && -e ${ROOT}/etc/portage/make.conf ]] || (bootstrap_setup) || return 1
55 + [[ -e ${ROOT}/etc/portage/make.profile && \
56 + -e ${MAKE_CONF_DIR}/0100_bootstrap_prefix_make.conf ]] \
57 + || (bootstrap_setup) || return 1
58 mkdir -p "${ROOT}"/tmp/etc/. || return 1
59 [[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || cp -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc || return 1
60
61 @@ -1643,16 +1648,20 @@ do_emerge_pkgs() {
62 clang
63 internal-glib
64 )
65 + local override_make_conf_dir=\
66 + "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf/"
67 +
68 if [[ " ${USE} " == *" prefix-stack "* ]] &&
69 [[ ${PORTAGE_OVERRIDE_EPREFIX} == */tmp ]] &&
70 - ! grep -q '^USE=".*" # by bootstrap-prefix.sh$' "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
71 + ! grep -Rq '^USE=".*" # by bootstrap-prefix.sh$' "${override_make_conf_dir}"
72 then
73 # With prefix-stack, the USE env var does apply to the stacked
74 # prefix only, not the base prefix (any more? since some portage
75 # version?), so we have to persist the base USE flags into the
76 # base prefix - without the additional incoming USE flags.
77 + mkdir -p -- "${override_make_conf_dir}"
78 echo "USE=\"\${USE} ${myuse[*]}\" # by bootstrap-prefix.sh" \
79 - >> "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
80 + >> "${override_make_conf_dir}/0101_bootstrap_prefix_stack.conf"
81 fi
82 myuse=" ${myuse[*]} "
83 local use
84 @@ -1843,6 +1852,7 @@ bootstrap_stage2() {
85 if [[ ${compiler_type} == clang ]] ; then
86 # we use Clang as our toolchain compiler, so we need to make
87 # sure we actually use it
88 + mkdir -p -- "${MAKE_CONF_DIR}"
89 {
90 echo
91 echo "# System compiler on $(uname) Prefix is Clang, do not remove this"
92 @@ -1852,7 +1862,7 @@ bootstrap_stage2() {
93 echo "OBJCXX=${CHOST}-clang++"
94 echo "BUILD_CC=${CHOST}-clang"
95 echo "BUILD_CXX=${CHOST}-clang++"
96 - } >> "${ROOT}"/etc/portage/make.conf
97 + } >> "${MAKE_CONF_DIR}/0100_bootstrap_prefix_clang.conf"
98 # llvm won't setup symlinks to CHOST-clang here because
99 # we're in a cross-ish situation (at least according to
100 # multilib.eclass -- can't blame it at this point really)
101 @@ -2197,6 +2207,7 @@ set_helper_vars() {
102 export PORTDIR=${PORTDIR:-"${ROOT}/var/db/repos/gentoo"}
103 export DISTDIR=${DISTDIR:-"${ROOT}/var/cache/distfiles"}
104 PORTAGE_TMPDIR=${PORTAGE_TMPDIR:-${ROOT}/var/tmp}
105 + MAKE_CONF_DIR="${ROOT}/etc/portage/make.conf/"
106 DISTFILES_URL=${DISTFILES_URL:-"http://dev.gentoo.org/~grobian/distfiles"}
107 GNU_URL=${GNU_URL:="http://ftp.gnu.org/gnu"}
108 DISTFILES_G_O="http://distfiles.prefix.bitzolder.nl"
109 --
110 2.32.0