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