Gentoo Archives: gentoo-alt

From: Fabian Groffen <grobian@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] [PATCH 3/3] scripts/bootstrap-prefix.sh: create etc/make.conf as dir (or populate it if exists)
Date: Wed, 01 Dec 2021 19:39:46
Message-Id: YafPfKvVrr4YL4sE@gentoo.org
In Reply to: [gentoo-alt] [PATCH 3/3] scripts/bootstrap-prefix.sh: create etc/make.conf as dir (or populate it if exists) by Etienne Buira
1 please shorten the subject line to 80 chars
2
3 On 31-10-2021 16:40:04 +0100, Etienne Buira wrote:
4 > This makes it easy to (pre)set some site/host specific vars (like -march
5 > CFLAG), but still using bootstrap generated make.conf
6 > ---
7 > scripts/bootstrap-prefix.sh | 17 ++++++++++-------
8 > 1 file changed, 10 insertions(+), 7 deletions(-)
9 >
10 > diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
11 > index 2b9e2e76f2..45d5884648 100755
12 > --- a/scripts/bootstrap-prefix.sh
13 > +++ b/scripts/bootstrap-prefix.sh
14 > @@ -309,7 +309,8 @@ bootstrap_setup() {
15 > [[ -e ${ROOT}/foo.$$ ]] && FS_INSENSITIVE=1
16 > rm "${ROOT}"/FOO.$$
17 >
18 > - if [[ ! -f ${ROOT}/etc/portage/make.conf ]] ; then
19 > + [[ ! -e "${ROOT}/etc/portage/make.conf" ]] && mkdir -p "${ROOT}/etc/portage/make.conf"
20 break this line in two please
21
22 > + if [[ ! -f ${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_make.conf ]] ; then
23
24 feels like it might make sense to declare a var for
25 ROOT/etc/portage/make.conf and use it here to shorten this bit
26
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 > + } > "${ROOT}"/etc/portage/make.conf/0100_bootstrap_prefix_make.conf
36 > fi
37 >
38 > if is-rap ; then
39 > @@ -1399,7 +1400,7 @@ 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 && -e ${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_make.conf ]] || (bootstrap_setup) || return 1
45 while at it, can you break this line into multiples fitting within 80
46 chars?
47
48 >
49 > prepare_portage
50 > }
51 > @@ -1558,7 +1559,7 @@ bootstrap_stage1() {
52 > (bootstrap_tree) || return 1
53 >
54 > # setup a profile
55 > - [[ -e ${ROOT}/etc/portage/make.profile && -e ${ROOT}/etc/portage/make.conf ]] || (bootstrap_setup) || return 1
56 > + [[ -e ${ROOT}/etc/portage/make.profile && -e ${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_make.conf ]] || (bootstrap_setup) || return 1
57 same
58
59 > mkdir -p "${ROOT}"/tmp/etc/. || return 1
60 > [[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || cp -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc || return 1
61 >
62 > @@ -1629,14 +1630,15 @@ do_emerge_pkgs() {
63 > )
64 > if [[ " ${USE} " == *" prefix-stack "* ]] &&
65 > [[ ${PORTAGE_OVERRIDE_EPREFIX} == */tmp ]] &&
66 > - ! grep -q '^USE=".*" # by bootstrap-prefix.sh$' "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
67 > + ! grep -Rq '^USE=".*" # by bootstrap-prefix.sh$' "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
68 > then
69 > # With prefix-stack, the USE env var does apply to the stacked
70 > # prefix only, not the base prefix (any more? since some portage
71 > # version?), so we have to persist the base USE flags into the
72 > # base prefix - without the additional incoming USE flags.
73 > + mkdir -p -- "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
74 > echo "USE=\"\${USE} ${myuse[*]}\" # by bootstrap-prefix.sh" \
75 > - >> "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf"
76 > + >> "${PORTAGE_OVERRIDE_EPREFIX}/etc/portage/make.conf/0101_bootstrap_prefix_stack.conf"
77 probably redefine that var above to etc/portage/make.conf and then use
78 it with ROOT or the OVERRIDE_EPREFIX, means the mkdir can also take this
79 as well as the grep above
80
81 > fi
82 > myuse=" ${myuse[*]} "
83 > local use
84 > @@ -1827,6 +1829,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 -- "${ROOT}/etc/portage/make.conf"
89 > {
90 > echo
91 > echo "# System compiler on $(uname) Prefix is Clang, do not remove this"
92 > @@ -1836,7 +1839,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 > + } >> "${ROOT}"/etc/portage/make.conf/0100_bootstrap_prefix_clang.conf
98 use the var here too, probably define it globally as constant in the
99 set_helper_vars() function
100
101 > # llvm won't setup symlinks to CHOST-clang here because
102 > # we're in a cross-ish situation (at least according to
103 > # multilib.eclass -- can't blame it at this point really)
104 >
105 Thanks,
106 Fabian
107 --
108 Fabian Groffen
109 Gentoo on a different level

Attachments

File name MIME type
signature.asc application/pgp-signature