1 |
Hello Benda, |
2 |
|
3 |
To be more specific... To easily go thru it I made a gist with the latest |
4 |
version of *bootstrap-prefix.sh* and I'll be pointing to specific lines |
5 |
(this also helps me recap why I did this, as I remember using stage{1,2,3} |
6 |
didn't work for me when I first came into this): |
7 |
|
8 |
When you execute *bootstrap-prefix.sh* without arguments (other than the |
9 |
EPREFIX, *./bootstrap-prefix.sh /MY/EPREFIX*) it calls this line: |
10 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3033 |
11 |
Calling *bootstrap_interactive* |
12 |
|
13 |
If you give an extra argument (*./bootstrap-prefix.sh /MY/EPREFIX |
14 |
[noninteractive, stage{1,2,3}]*) it calls this line: |
15 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L3082 |
16 |
bootstrap_${TODO#non} || exit 1 |
17 |
|
18 |
Which, on the noninteractive case, goes to the same place than no arguments |
19 |
(*bootstrap_interactive*). But in the stage{1,2,3} calls directly the |
20 |
*bootstrap_stageX* function. |
21 |
|
22 |
The thing is, noninteractive does some checks, finds resources and sets up |
23 |
environment variables like: |
24 |
|
25 |
- Check for bad flags: |
26 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2200-L2247 |
27 |
- We find a gcc: |
28 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2273-L2433 |
29 |
- We get a cpu count and adjust -j for Make: |
30 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2443-L2501 |
31 |
- Check if we deal with multilib systems: |
32 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2503-L2576 |
33 |
- Check if we are boostrapping from a Gentoo system: |
34 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2578-L2608 |
35 |
- Set our EPREFIX: |
36 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2610-L2681 |
37 |
|
38 |
Which is summarised at the end by setting the environment variables |
39 |
EPREFIX, CHOST, PATH, MAKEOPTS. |
40 |
|
41 |
And then finally calls *bootstrap_stage1_log*, which runs* bootstrap_stage1* |
42 |
itself. |
43 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L2724-L2726 |
44 |
|
45 |
Then, we compare with calling bootstrap-prefix.sh EPREFIX stage1... |
46 |
Calls *bootstrap_stage1()*: |
47 |
https://gist.github.com/awesomebytes/ba4df9c6ef3ab5742cb9aceed7998c3d#file-bootstrap-prefix-sh-L1355 |
48 |
|
49 |
And as you can see it won't do any of the extra work done in |
50 |
*bootstrap_interactive()*. |
51 |
|
52 |
I'm not that versed in this script, so I may be missing something easy to |
53 |
overcome this (or I don't know enough about what is going on), but there is |
54 |
no separate function that does everything in* bootstrap_interactive* |
55 |
without calling *bootstrap_stage1*. And *bootstrap_stage1* does not do all |
56 |
that setup that *bootstrap_interactive* does. So that's how I came to my |
57 |
proposal. |
58 |
|
59 |
If there is some patch to enable that setup from *bootstrap_interactive* |
60 |
with* bootstrap_stage1*, that would be a good alternative, I guess. I still |
61 |
like the fact that with my approach you are just saying "bootstrap |
62 |
everything until this step" instead of needing to manually do |
63 |
*bootstrap_setup* (imaginary function I just named) then *bootstrap_stage1*, |
64 |
then *bootstrap_stage2*, then* bootstrap_stage3*, and then no argument for |
65 |
the last *emerge -e system*, to get to a specific bootstrap stage, but |
66 |
that's just commodity. |
67 |
|
68 |
Let me know if I'm wrong somewhere or you think of any better solution! |
69 |
|
70 |
On Thu, 16 Jan 2020 at 13:42, Sam Pfeiffer <sammypfeiffer@×××××.com> wrote: |
71 |
|
72 |
> Hi Benda, |
73 |
> |
74 |
> Thanks for your reply. |
75 |
> |
76 |
> On Thu, 16 Jan 2020 at 13:01, Benda Xu <heroxbd@g.o> wrote: |
77 |
> |
78 |
>> Hi Sam, |
79 |
>> |
80 |
>> Sam Pfeiffer <sammypfeiffer@×××××.com> writes: |
81 |
>> |
82 |
>> > To ease automated building and debugging of the bootstrap of Gentoo |
83 |
>> > Prefix I would like to propose a patch to add the option to stop the |
84 |
>> > non-interactive bootstrap on specific stages of the bootstrap. |
85 |
>> > |
86 |
>> > I'm currently doing this in my CI projects [1][2] and I'd love to have |
87 |
>> > this added upstream. |
88 |
>> > |
89 |
>> > I propose a patch like this: |
90 |
>> >https://gist.github.com/awesomebytes/3468477c6c90fe3d985372d50aabba9f |
91 |
>> > |
92 |
>> > Which is what I'm currently using. It just adds another optional |
93 |
>> >parameter to the commandline (a 3rd one) in non-interactive mode which |
94 |
>> >you tell it after which stage to stop (stage1, stage2, stage3). |
95 |
>> |
96 |
>> > I'm not the most versed person in bash, so maybe there is a more |
97 |
>> > conceptually beautiful way of doing this. My patch is just a proposal |
98 |
>> > (that has been tested and running). |
99 |
>> > |
100 |
>> > This patch is useful because it allows: |
101 |
>> > 1) Easier debugging by stages. |
102 |
>> |
103 |
>> > 2) Allows to split the bootstrap job in parts in CI environments with |
104 |
>> > time limits on jobs to run (e.g. Azure Pipelines time limit is 6h*, |
105 |
>> > and the bootstrap takes in between 5h40-6h40 depending on random |
106 |
>> > things like time to download things, and load on the machine... or |
107 |
>> > packages just taking longer to build). |
108 |
>> > |
109 |
>> > And this patch should not change anything to anyone else (AFAIK). |
110 |
>> |
111 |
>> Are you aware that in bootstrap-prefix.sh you can specify the stage you |
112 |
>> are after? e.g. |
113 |
>> |
114 |
>> https://wiki.gentoo.org/wiki/Project:Prefix/Manual_Bootstrap#Stage_1 |
115 |
>> |
116 |
>> The text above that could be outdated, but PATH exports and stage1~3 are |
117 |
>> correct. |
118 |
>> |
119 |
> I'm aware, but the behaviour (relating to environment variables and |
120 |
> choosing CPU numbers) differs from the |
121 |
> noninteractive argument. I'd like to keep the CI environment as close as a |
122 |
> user executing ./bootstrap-prefix.sh EPREFIX as possible. |
123 |
> That's why I'm proposing this addition. Another approach could be |
124 |
> modifying the current argument to do the same than the noninteractive one. |
125 |
> But that may break the workflow of someone, and I don't want that. |
126 |
> |
127 |
> |
128 |
>> |
129 |
>> > Thanks for your time and feedback! |
130 |
>> > |
131 |
>> > P.S.: I'm used to the GitHub/GitLab workflow of having a graphical |
132 |
>> > interface to do a Pull Request... I don't know how to do this with |
133 |
>> > https://gitweb.gentoo.org/repo/proj/prefix.git/ If there is no way, |
134 |
>> > aside of the goal of this email, I'd propose to have a mirror in |
135 |
>> > GitHub. |
136 |
>> |
137 |
>> Yes, that's a good to have for me, but not in high priority. |
138 |
>> |
139 |
>> > *If you are curious, Stage 1 takes 8min~, Stage 2 takes 29min~, Stage |
140 |
>> > 3 takes 2h30min~, emerge system takes 2h35min~ on Azure Pipelines, |
141 |
>> > approximately. |
142 |
>> |
143 |
>> Thank you so much for all your work! That's extremely helpful to keep |
144 |
>> the quality of Prefix codebase. |
145 |
>> |
146 |
>> > [1] https://github.com/awesomebytes/gentoo_prefix_ci |
147 |
>> > [2] https://github.com/awesomebytes/gentoo_prefix_ci_32b |
148 |
>> |
149 |
>> Yours, |
150 |
>> Benda |
151 |
>> |
152 |
>> |
153 |
> |
154 |
> -- |
155 |
> |
156 |
> *Sammy Pfeiffer* |
157 |
> PhD Candidate at The Magic Lab within UTS. |
158 |
> |
159 |
|
160 |
|
161 |
-- |
162 |
|
163 |
*Sammy Pfeiffer* |
164 |
PhD Candidate at The Magic Lab within UTS. |