Gentoo Archives: gentoo-commits

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