Gentoo Archives: gentoo-alt

From: Fabian Groffen <grobian@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] Allow non-interactive bootstrap to be stopped at arbitrary stages
Date: Sat, 13 Jun 2020 13:54:01
Message-Id: 20200613135353.GO32896@gentoo.org
In Reply to: Re: [gentoo-alt] Allow non-interactive bootstrap to be stopped at arbitrary stages by Sam Pfeiffer
1 I think pretty late, but this is committed in f6bbc6f470.
2
3 Thanks,
4 Fabian
5
6 On 03-02-2020 14:54:26 +1100, Sam Pfeiffer wrote:
7 > Hey Fabian,
8 >
9 > Thanks for chipping in. I do think it's useful and user-friendly to be able to
10 > control the target of the interactive/noninteractive script.
11 > I proposed in my first email in the thread something similar with the
12 > $STOP_AFTER_STAGE variable, even though I was capturing it from the commandline,
13 > and as I understand
14 > you propose, it would probably be better to capture it from an environment
15 > variable (it would actually be more in-line with other existing variables).
16 >
17 > Benda, I'm sorry for the noise I'm causing. I just want to improve the
18 > experience for the next person that tries to use this amazing project by
19 > taking advantage of already implemented stuff. And also just having this
20 > discussion is good to have more information archived to google about Gentoo
21 > Prefix and its bootstrap process. I think.
22 >
23 > On Sun, 2 Feb 2020 at 23:08, Fabian Groffen <grobian@g.o[1]> wrote:
24 > > What I gather from this discussion is that the bootstrap script is
25 > > complex, and grew more complexity over the years.
26 > >
27 > > Back in the early days, there was just documentation, one needed to
28 > > follow.  Since this frequently needed an update, and people kept using
29 > > older copies, at some point the bootstrap-prefix.sh script was
30 > > introduced.
31 > >
32 > > This script followed the documentation to the letter.  It was an exact
33 > > replica of the instructions in the bootstrap document.  This included
34 > > the notions of 3 stages and a world recompile.
35 > >
36 > > Today, the purpose of the stages have blurred, and seem more like
37 > > batches in which to do things.  Some of the initial intentions still
38 > > stand out, e.g. that stage1 is there to provide a working portage
39 > > environment with some minimal efforts.  Minimal got redefined as soon as
40 > > we had to install python and more and more tools seemed necesary (sed,
41 > > path, awk, etc.).
42 > >
43 > > Now, it seems you need to cut time and sort of bootstrap up-to a stage.
44 > > Would it be an option to simply add a(nother) var that will control the
45 > > interactive target in terms of how far it will run along.  Normal resume
46 > > strategies it employs already would simply allow a next run to run along
47 > > further.
48 > >
49 > > I think above can be done easily with a few lines of code.
50 > >
51 > > Let me know what you think.
52 > >
53 > > Thanks,
54 > > Fabian
55 > >
56 > > On 23-01-2020 13:31:05 +1100, Sam Pfeiffer wrote:
57 > > > Grobian, any input about this?
58 > > >
59 > > > On Thu, Jan 16, 2020, 17:39 Sam Pfeiffer <[1]sammypfeiffer@×××××.com[2]>
60 > > wrote:
61 > > >
62 > > > > Hello Benda,
63 > > >
64 > > > > To be more specific... To easily go thru it I made a gist with the latest
65 > > > > version of bootstrap-prefix.sh and I'll be pointing to specific lines (this
66 > > > > also helps me recap why I did this, as I remember using stage{1,2,3} didn't
67 > > > > work for me when I first came into this):
68 > > >
69 > > > > When you execute bootstrap-prefix.sh without arguments (other than the
70 > > > > EPREFIX, ./bootstrap-prefix.sh /MY/EPREFIX) it calls this line:
71 > > >
72 > > > > [2]https://gist.github.com/awesomebytes/
73 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3033[3]
74 > > >
75 > > > > Calling bootstrap_interactive
76 > > >
77 > > > > If you give an extra argument (./bootstrap-prefix.sh /MY/EPREFIX
78 > > > > [noninteractive, stage{1,2,3}]) it calls this line:
79 > > > > [3]https://gist.github.com/awesomebytes/
80 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3082[4]
81 > > >
82 > > > > bootstrap_${TODO#non} || exit 1
83 > > >
84 > > > > Which, on the noninteractive case, goes to the same place than no arguments
85 > > > > (bootstrap_interactive). But in the stage{1,2,3} calls directly the
86 > > > > bootstrap_stageX function.
87 > > >
88 > > > > The thing is, noninteractive does some checks, finds resources and sets up
89 > > > > environment variables like:
90 > > >
91 > > > >   * Check for bad flags:
92 > > > >   [4]https://gist.github.com/awesomebytes/
93 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2200-L2247[5]
94 > > > >   * We find a gcc:
95 > > > >   [5]https://gist.github.com/awesomebytes/
96 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2273-L2433[6]
97 > > > >   * We get a cpu count and adjust -j for Make:
98 > > > >   [6]https://gist.github.com/awesomebytes/
99 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2443-L2501[7]
100 > > > >   * Check if we deal with multilib systems:
101 > > > >   [7]https://gist.github.com/awesomebytes/
102 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2503-L2576[8]
103 > > > >   * Check if we are boostrapping from a Gentoo system:
104 > > > >   [8]https://gist.github.com/awesomebytes/
105 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2578-L2608[9]
106 > > > >   * Set our EPREFIX:
107 > > > > [9]https://gist.github.com/awesomebytes/
108 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2610-L2681[10]
109 > > >
110 > > > > Which is summarised at the end by setting the environment variables EPREFIX,
111 > > > > CHOST, PATH, MAKEOPTS.
112 > > >
113 > > > > And then finally calls bootstrap_stage1_log, which runs bootstrap_stage1
114 > > > > itself.
115 > > >
116 > > > > [10]https://gist.github.com/awesomebytes/
117 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2724-L2726[11]
118 > > >
119 > > > > Then, we compare with calling bootstrap-prefix.sh EPREFIX stage1...
120 > > >
121 > > > > Calls bootstrap_stage1():
122 > > > > [11]https://gist.github.com/awesomebytes/
123 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L1355[12]
124 > > >
125 > > > > And as you can see it won't do any of the extra work done in
126 > > > > bootstrap_interactive().
127 > > >
128 > > > > I'm not that versed in this script, so I may be missing something easy to
129 > > > > overcome this (or I don't know enough about what is going on), but there is
130 > > no
131 > > > > separate function that does everything in bootstrap_interactive without
132 > > > > calling bootstrap_stage1. And bootstrap_stage1 does not do all that setup
133 > > that
134 > > > > bootstrap_interactive does. So that's how I came to my proposal.
135 > > >
136 > > > > If there is some patch to enable that setup from bootstrap_interactive with
137 > > > > bootstrap_stage1, that would be a good alternative, I guess. I still like
138 > > the
139 > > > > fact that with my approach you are just saying "bootstrap everything until
140 > > > > this step" instead of needing to manually do bootstrap_setup (imaginary
141 > > > > function I just named) then bootstrap_stage1, then bootstrap_stage2, then
142 > > > > bootstrap_stage3, and then no argument for the last emerge -e system, to get
143 > > > > to a specific bootstrap stage, but that's just commodity.
144 > > >
145 > > > > Let me know if I'm wrong somewhere or you think of any better solution!
146 > > >
147 > > > > On Thu, 16 Jan 2020 at 13:42, Sam Pfeiffer <[12]sammypfeiffer@×××××.com[13]>
148 > > > > wrote:
149 > > >
150 > > > >> Hi Benda,
151 > > >
152 > > > >> Thanks for your reply.
153 > > >
154 > > > >> On Thu, 16 Jan 2020 at 13:01, Benda Xu <[13]heroxbd@g.o[14]> wrote:
155 > > >
156 > > > >>> Hi Sam,
157 > > >
158 > > > >>> Sam Pfeiffer <[14]sammypfeiffer@×××××.com[15]> writes:
159 > > >
160 > > > >>> > To ease automated building and debugging of the bootstrap of Gentoo
161 > > > >>> > Prefix I would like to propose a patch to add the option to stop the
162 > > > >>> > non-interactive bootstrap on specific stages of the bootstrap.
163 > > > >>> >
164 > > > >>> > I'm currently doing this in my CI projects [1][2] and I'd love to have
165 > > > >>> > this added upstream.
166 > > > >>> >
167 > > > >>> > I propose a patch like this:
168 > > > >>> >[15]https://gist.github.com/awesomebytes/3468477c6c90fe3d985372d50aabba9f
169 > > [16]
170 > > > >>> >
171 > > > >>> > Which is what I'm currently using. It just adds another optional
172 > > > >>> >parameter to the commandline (a 3rd one) in non-interactive mode which
173 > > > >>> >you tell it after which stage to stop (stage1, stage2, stage3).
174 > > >
175 > > > >>> > I'm not the most versed person in bash, so maybe there is a more
176 > > > >>> > conceptually beautiful way of doing this. My patch is just a proposal
177 > > > >>> > (that has been tested and running).
178 > > > >>> >
179 > > > >>> > This patch is useful because it allows:
180 > > > >>> > 1) Easier debugging by stages.
181 > > >
182 > > > >>> > 2) Allows to split the bootstrap job in parts in CI environments with
183 > > > >>> > time limits on jobs to run (e.g. Azure Pipelines time limit is 6h*,
184 > > > >>> > and the bootstrap takes in between 5h40-6h40 depending on random
185 > > > >>> > things like time to download things, and load on the machine... or
186 > > > >>> > packages just taking longer to build).
187 > > > >>> >
188 > > > >>> > And this patch should not change anything to anyone else (AFAIK).
189 > > >
190 > > > >>> Are you aware that in bootstrap-prefix.sh you can specify the stage you
191 > > > >>> are after?  e.g.
192 > > >
193 > > > >>>    [16]https://wiki.gentoo.org/wiki/Project:Prefix/
194 > > Manual_Bootstrap#Stage_1[17]
195 > > >
196 > > > >>> The text above that could be outdated, but PATH exports and stage1~3 are
197 > > > >>> correct.
198 > > >
199 > > > >> I'm aware, but the behaviour (relating to environment variables and
200 > > choosing
201 > > > >> CPU numbers) differs from the
202 > > >
203 > > > >> noninteractive argument. I'd like to keep the CI environment as close as a
204 > > > >> user executing ./bootstrap-prefix.sh EPREFIX as possible.
205 > > >
206 > > > >> That's why I'm proposing this addition. Another approach could be modifying
207 > > > >> the current argument to do the same than the noninteractive one.
208 > > >
209 > > > >> But that may break the workflow of someone, and I don't want that.
210 > > >
211 > > > >>  
212 > > >
213 > > > >>> > Thanks for your time and feedback!
214 > > > >>> >
215 > > > >>> > P.S.: I'm used to the GitHub/GitLab workflow of having a graphical
216 > > > >>> > interface to do a Pull Request... I don't know how to do this with
217 > > > >>> > [17]https://gitweb.gentoo.org/repo/proj/prefix.git/[18] If there is no
218 > > way,
219 > > > >>> > aside of the goal of this email, I'd propose to have a mirror in
220 > > > >>> > GitHub.
221 > > >
222 > > > >>> Yes, that's a good to have for me, but not in high priority.
223 > > >
224 > > > >>> > *If you are curious, Stage 1 takes 8min~, Stage 2 takes 29min~, Stage
225 > > > >>> > 3 takes 2h30min~, emerge system takes 2h35min~ on Azure Pipelines,
226 > > > >>> > approximately.
227 > > >
228 > > > >>> Thank you so much for all your work!  That's extremely helpful to keep
229 > > > >>> the quality of Prefix codebase.
230 > > >
231 > > > >>> > [1] [18]https://github.com/awesomebytes/gentoo_prefix_ci[19]
232 > > > >>> > [2] [19]https://github.com/awesomebytes/gentoo_prefix_ci_32b[20]
233 > > >
234 > > > >>> Yours,
235 > > > >>> Benda
236 > > >
237 > > > >> --
238 > > >
239 > > > >> Sammy Pfeiffer
240 > > > >> PhD Candidate at The Magic Lab within UTS.
241 > > >
242 > > > > --
243 > > >
244 > > > > Sammy Pfeiffer
245 > > > > PhD Candidate at The Magic Lab within UTS.
246 > > >
247 > > >
248 > > >
249 > > >  References:
250 > > >    1. mailto:sammypfeiffer@×××××.com[21]
251 > > >    2. https://gist.github.com/awesomebytes/
252 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3033[22]
253 > > >    3. https://gist.github.com/awesomebytes/
254 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3082[23]
255 > > >    4. https://gist.github.com/awesomebytes/
256 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2200-L2247[24]
257 > > >    5. https://gist.github.com/awesomebytes/
258 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2273-L2433[25]
259 > > >    6. https://gist.github.com/awesomebytes/
260 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2443-L2501[26]
261 > > >    7. https://gist.github.com/awesomebytes/
262 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2503-L2576[27]
263 > > >    8. https://gist.github.com/awesomebytes/
264 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2578-L2608[28]
265 > > >    9. https://gist.github.com/awesomebytes/
266 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2610-L2681[29]
267 > > >   10. https://gist.github.com/awesomebytes/
268 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2724-L2726[30]
269 > > >   11. https://gist.github.com/awesomebytes/
270 > > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L1355[31]
271 > > >   12. mailto:sammypfeiffer@×××××.com[32]
272 > > >   13. mailto:heroxbd@g.o[33]
273 > > >   14. mailto:sammypfeiffer@×××××.com[34]
274 > > >   15. https://gist.github.com/awesomebytes/3468477c6c90fe3d985372d50aabba9f
275 > > [35]
276 > > >   16. https://wiki.gentoo.org/wiki/Project:Prefix/Manual_Bootstrap#Stage_1[36]
277 > > >   17. https://gitweb.gentoo.org/repo/proj/prefix.git/[37]
278 > > >   18. https://github.com/awesomebytes/gentoo_prefix_ci[38]
279 > > >   19. https://github.com/awesomebytes/gentoo_prefix_ci_32b[39]
280 > > >
281 > > > read_char: errno==EILSEQ; invalid byte sequence for UTF-8:
282 > > --
283 > > Fabian Groffen
284 > > Gentoo on a different level
285 >
286 >
287 > --
288 >
289 > Sammy Pfeiffer
290 > PhD Candidate at The Magic Lab within UTS.
291 >
292 >
293 > References
294 > 1. mailto:grobian@g.o
295 > 2. mailto:sammypfeiffer@×××××.com
296 > 3. https://gist.github.com/awesomebytes/
297 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3033
298 > 4. https://gist.github.com/awesomebytes/
299 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3082
300 > 5. https://gist.github.com/awesomebytes/
301 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2200-L2247
302 > 6. https://gist.github.com/awesomebytes/
303 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2273-L2433
304 > 7. https://gist.github.com/awesomebytes/
305 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2443-L2501
306 > 8. https://gist.github.com/awesomebytes/
307 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2503-L2576
308 > 9. https://gist.github.com/awesomebytes/
309 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2578-L2608
310 > 10. https://gist.github.com/awesomebytes/
311 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2610-L2681
312 > 11. https://gist.github.com/awesomebytes/
313 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2724-L2726
314 > 12. https://gist.github.com/awesomebytes/
315 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L1355
316 > 13. mailto:sammypfeiffer@×××××.com
317 > 14. mailto:heroxbd@g.o
318 > 15. mailto:sammypfeiffer@×××××.com
319 > 16. https://gist.github.com/awesomebytes/3468477c6c90fe3d985372d50aabba9f
320 > 17. https://wiki.gentoo.org/wiki/Project:Prefix/Manual_Bootstrap#Stage_1
321 > 18. https://gitweb.gentoo.org/repo/proj/prefix.git/
322 > 19. https://github.com/awesomebytes/gentoo_prefix_ci
323 > 20. https://github.com/awesomebytes/gentoo_prefix_ci_32b
324 > 21. mailto:sammypfeiffer@×××××.com
325 > 22. https://gist.github.com/awesomebytes/
326 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3033
327 > 23. https://gist.github.com/awesomebytes/
328 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3082
329 > 24. https://gist.github.com/awesomebytes/
330 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2200-L2247
331 > 25. https://gist.github.com/awesomebytes/
332 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2273-L2433
333 > 26. https://gist.github.com/awesomebytes/
334 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2443-L2501
335 > 27. https://gist.github.com/awesomebytes/
336 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2503-L2576
337 > 28. https://gist.github.com/awesomebytes/
338 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2578-L2608
339 > 29. https://gist.github.com/awesomebytes/
340 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2610-L2681
341 > 30. https://gist.github.com/awesomebytes/
342 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2724-L2726
343 > 31. https://gist.github.com/awesomebytes/
344 > ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L1355
345 > 32. mailto:sammypfeiffer@×××××.com
346 > 33. mailto:heroxbd@g.o
347 > 34. mailto:sammypfeiffer@×××××.com
348 > 35. https://gist.github.com/awesomebytes/3468477c6c90fe3d985372d50aabba9f
349 > 36. https://wiki.gentoo.org/wiki/Project:Prefix/Manual_Bootstrap#Stage_1
350 > 37. https://gitweb.gentoo.org/repo/proj/prefix.git/
351 > 38. https://github.com/awesomebytes/gentoo_prefix_ci
352 > 39. https://github.com/awesomebytes/gentoo_prefix_ci_32b
353
354 --
355 Fabian Groffen
356 Gentoo on a different level

Attachments

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

Replies

Subject Author
Re: [gentoo-alt] Allow non-interactive bootstrap to be stopped at arbitrary stages Sam Pfeiffer <sammypfeiffer@×××××.com>