Gentoo Archives: gentoo-alt

From: Benda Xu <heroxbd@g.o>
To: Sam Pfeiffer <sammypfeiffer@×××××.com>
Cc: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] Allow non-interactive bootstrap to be stopped at arbitrary stages
Date: Sat, 25 Jan 2020 12:58:35
Message-Id: 87blqrlmf2.fsf@gentoo.org
In Reply to: Re: [gentoo-alt] Allow non-interactive bootstrap to be stopped at arbitrary stages by Sam Pfeiffer
1 Hi Sam,
2
3 Sam Pfeiffer <sammypfeiffer@×××××.com> writes:
4
5 > To be more specific... To easily go thru it I made a gist with the
6 > latest version of bootstrap-prefix.sh and I'll be pointing to specific
7 > lines (this also helps me recap why I did this, as I remember using
8 > stage{1,2,3} didn't work for me when I first came into this):
9 >
10 > When you execute bootstrap-prefix.sh without arguments (other than the
11 > EPREFIX, ./bootstrap-prefix.sh /MY/EPREFIX) it calls this line:
12 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3033
13 > Calling bootstrap_interactive
14 >
15 > If you give an extra argument (./bootstrap-prefix.sh /MY/EPREFIX
16 > [noninteractive, stage{1,2,3}]) it calls this line:
17 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3082
18 > bootstrap_${TODO#non} || exit 1
19 >
20 > Which, on the noninteractive case, goes to the same place than no
21 > arguments (bootstrap_interactive). But in the stage{1,2,3} calls
22 > directly the bootstrap_stageX function.
23 >
24 > The thing is, noninteractive does some checks, finds resources and
25 > sets up environment variables like:
26 >
27 > * Check for bad flags:
28 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2200-L2247
29 > * We find a gcc:
30 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2273-L2433
31 > * We get a cpu count and adjust -j for Make:
32 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2443-L2501
33 > * Check if we deal with multilib systems:
34 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2503-L2576
35 > * Check if we are boostrapping from a Gentoo system:
36 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2578-L2608
37 > * Set our EPREFIX:
38 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2610-L2681
39 >
40 > Which is summarised at the end by setting the environment variables EPREFIX, CHOST, PATH, MAKEOPTS.
41 >
42 > And then finally calls bootstrap_stage1_log, which runs
43 > bootstrap_stage1 itself.
44 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2724-L2726
45 >
46 > Then, we compare with calling bootstrap-prefix.sh EPREFIX stage1...
47 > Calls bootstrap_stage1():
48 > https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L1355
49 >
50 > And as you can see it won't do any of the extra work done in
51 > bootstrap_interactive().
52
53 Perfect! You are correct in understanding the script.
54
55 > I'm not that versed in this script, so I may be missing something easy
56 > to overcome this (or I don't know enough about what is going on), but
57 > there is no separate function that does everything in
58 > bootstrap_interactive without calling bootstrap_stage1. And
59 > bootstrap_stage1 does not do all that setup that bootstrap_interactive
60 > does. So that's how I came to my proposal.
61 >
62 > If there is some patch to enable that setup from bootstrap_interactive
63 > with bootstrap_stage1, that would be a good alternative, I guess. I
64 > still like the fact that with my approach you are just saying
65 > "bootstrap everything until this step" instead of needing to manually
66 > do bootstrap_setup (imaginary function I just named) then
67 > bootstrap_stage1, then bootstrap_stage2, then bootstrap_stage3, and
68 > then no argument for the last emerge -e system, to get to a specific
69 > bootstrap stage, but that's just commodity.
70
71 Why manually do bootstrap_setup then stage 1-3, emerge -e @system a bad
72 thing? That gives you more control of what to do in the CI system. I
73 would prefer to have the explicit steps than environmental switches.
74
75 > Let me know if I'm wrong somewhere or you think of any better solution!
76
77 You are nowhere wrong. I just prefer keeping the manual bootstrap
78 options up to date and have it drive our CI.
79
80 Yours,
81 Benda

Replies

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