Gentoo Archives: gentoo-alt

From: Sam Pfeiffer <sammypfeiffer@×××××.com>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] Allow non-interactive bootstrap to be stopped at arbitrary stages
Date: Mon, 27 Jan 2020 11:26:46
Message-Id: CABVqfw8+Mt=8x46eSL_ujzcc1WEVwVTx=NTovGZyRno+dLYxeA@mail.gmail.com
In Reply to: Re: [gentoo-alt] Allow non-interactive bootstrap to be stopped at arbitrary stages by Benda Xu
1 Hello Benda,
2
3 On Mon, 27 Jan 2020 at 21:26, Benda Xu <heroxbd@g.o> wrote:
4
5 > Hi Sam,
6 >
7 > Sam Pfeiffer <sammypfeiffer@×××××.com> writes:
8 >
9 > > It took me a while to figure out how to do it with minimal
10 > > changes... but this is the new version I came up with:
11 > >
12 > > https://gist.github.com/awesomebytes/c930100ca97dd4195123104c5396b645
13 > >
14 > > The changes to the current bootstrap_prefix.sh are these (in .patch
15 > > format):
16 > > https://gist.github.com/awesomebytes/ab1f237feea2f51ae65a5ecca203842e
17 > >
18 > > That patch in words: I've wrapped the setup stuff in a function called
19 > >bootstrap_get_defaults (as that's what it is doing). Then the complete
20 > >bootstrap process is named bootstrap_all_stages. I also separated the
21 > >last step calling it bootstrap_emerge_emptytree_system.
22 > >
23 > > This keeps the usage of the script the same for the interactive case,
24 > > the non interactive case, but...There is a 'maybe' breaking change, as
25 > > now giving the name of the function to execute first calls
26 > > bootstrap_get_defaults, then calls the function... and does a couple
27 > > of necessary workarounds.
28 > >
29 > > I say 'maybe' breaking, as it doesn't 'exactly' do the same it did
30 > > before when executing ./bootstrap-prefix.sh EPREFIX stage2 (but I
31 > > think it was either broken or I don't know how it was used, which is
32 > > the most likely option).
33 >
34 > > If you don't like this new behaviour, my alternative implementation
35 > > was to create extra functions like: bootstrap_stage1_noninteractive,
36 > > bootstrap_stage2_noninteractive, bootstrap_stage3_noninteractive,
37 > > bootstrap_emerge_emptytree_system_noninteractive Which would do the
38 > > bootstrap_get_defaults and the workarounds.
39 > >
40 > > Let me know what you think. I can prepare a patch with that too. If
41 > > that's the case, I'd love an explanation on how to use the current
42 > > behaviour of the script.
43 >
44 > I read your patches. But I don't understand the motivation for
45 > completely reproduce the interactive use of bootstrap-prefix.sh by
46 > bootstrap_get_defaults() and bootstrap_emerge_emptytree_system().
47 >
48 > The most important part of the CI is to test stages 1~3, because both
49 > the hosts and the gentoo repository are moving targets. In the past 10
50 > years, there were few problems happening in bootstrap_get_defaults() and
51 > bootstrap_emerge_emptytree_system(), or equivalents. I would like to
52 > propose the 3rd way:
53 >
54 > 1. set the PATH, CHOST, etc. with your CI script,
55 > 2. bootstrap-prefix.sh stage1
56 > 3. bootstrap-prefix.sh stage2
57 > 4. bootstrap-prefix.sh stage3
58 > 5. call emerge -e @system with your CI script.
59 >
60 > What do you think?
61 >
62
63 First, thanks for explaining your proposal in a detailed way. I sincerely
64 didn't understand exactly what you meant.
65
66 Let me explain further. I found "complicated" to know what environment
67 variables I needed to set manually in order
68 to make use of the bootstrap script calling it in the way you just
69 presented. I did attempt to do it previously and failed miserably.
70 When looking at the bootstrap-prefix.sh script there are a lot of variables
71 in a 3000+ lines script, it's kind of daunting.
72 And when your goal is "I just need this to bootstrap, and it looks very
73 complicated" you want to the most automated way
74 (someone smart wrote the automated way!).
75
76 Now I understood what do I need to set up.
77 In hindsight, it was pretty obvious, as the interactive script itself spits
78 out for me:
79 EPREFIX=/tmp/gentoo
80 CHOST=x86_64-pc-linux-gnu
81 PATH=/tmp/gentoo/usr/bin:/tmp/gentoo/bin:/tmp/gentoo/tmp/usr/bin:/tmp/gentoo/tmp/bin:/tmp/gentoo/tmp/usr/local/bin:/usr/bin:/bin
82 MAKEOPTS=-j5
83
84 as the variables it needs when executing the interactive/noninteractive way.
85 And now that I've seen that, I also see that the instructions found here:
86 https://wiki.gentoo.org/wiki/Project:Prefix/Manual_Bootstrap
87 Are not out of date as reported at the top of the document. Even though it
88 doesn't say you need to set CHOST and MAKEOPTS, which I guess
89 they are actually automatically detected. It does briefly talk about CHOST
90 tho.
91
92 So now I see I could write my own lines of the script that does exactly
93 what you said... but I still need to configure a bunch of things
94 by hand.
95
96 Meanwhile using the same codepath we are already using "guarantees" I don't
97 need to fight any of that. Neither me, you or the next
98 maintainer. To me, the mental model I need to create and maintain in my
99 head from the version I'm proposing is tinier
100 than from the one where I need to figure out the environment variables and
101 also copy-paste the MAKEOPTS guesswork.
102
103 I mean, ideally, I would just call* ./bootstrap-prefix.sh EPREFIX
104 noninteractive* and call it a day... but the current CI infrastructure
105 can't support it. So I'm trying to get the best trade-off I can making this
106 easier to use from my point of view.
107
108 I must say that this email thread has helped me understand better this
109 process. I still think that being able to call the
110 different stages in an automated fashion is beneficial, but I understand if
111 you don't want to change that.
112
113
114
115 >
116 > Yours,
117 > Benda
118 >
119 >
120 >
121
122 --
123
124 *Sammy Pfeiffer*
125 PhD Candidate at The Magic Lab within UTS.

Replies