1 |
Ich leite dir hier mal eine Mail von der englischen Liste weiter, |
2 |
die genau dieses Thema behandelt (ziemlich ausführlich behandelt). |
3 |
|
4 |
viel spaß, Thilo |
5 |
|
6 |
|
7 |
Betreff: Picking up emerge in middle |
8 |
|
9 |
>>>> Hmmm. Good question. I might be talking out my ass here, but I swear |
10 |
>>>> that whenever I CTRL+C and come back later, the emerge just starts |
11 |
again |
12 |
>>>> and jams through all the parts it already did. |
13 |
>>>> |
14 |
> |
15 |
>> I made this experiment: |
16 |
>> - during "emerge file" I pressed CTRL-C - made a list of object files in |
17 |
>> "work" directory - started "emerge --resume" and stoped it just after |
18 |
>> configure finished - checked the list of object files again - they were |
19 |
>> lost |
20 |
>> |
21 |
>> Resume: |
22 |
>> "emerge --resume" starts emerge process from the beginning, but new |
23 |
>> compile process should be faster due to ccache (if used). |
24 |
>> |
25 |
>> Nevertheless there is a possibility to continue with broken emerge using |
26 |
>> "ebuild" command. |
27 |
>> |
28 |
>> From "man ebuild": |
29 |
>> Normally, to merge an ebuild, you need to fetch, unpack, compile, |
30 |
install |
31 |
>> and qmerge. |
32 |
>> |
33 |
>> So, except of running "emerge --resume" it's possible to run: "ebuild |
34 |
>> /path/to/pkg.ebuild compile install qmerge" which should be the fastest |
35 |
>> and very helpful if some hand corrections in source code are necessary |
36 |
>> after standard emerge fail ... i.e. due to missing '"' in some packages |
37 |
>> (discussed here). |
38 |
|
39 |
|
40 |
You have most or all the pieces, but don't have them laid out quite as |
41 |
nicely as I prefer, so here's what I've found. |
42 |
|
43 |
1 Emerge resume isn't all that useful. |
44 |
|
45 |
Emerge resume basically restarts a long hairy emerge from a point just |
46 |
after the last successful ebuild merge. Thus, it's not really of much |
47 |
use under normal circumstances, over simply issuing the command again, |
48 |
since previously emerged packages wouldn't normally be remerged anyway. |
49 |
It could however be useful for those that like to set a bunch of shell |
50 |
variables on the command line before invoking emerge, or otherwise have a |
51 |
huge amount of typing to redo, if the system crashed or something and |
52 |
therefore the command isn't available in the shell history. |
53 |
|
54 |
2 CCache is rather MORE useful, in resumption situations. |
55 |
|
56 |
If ccache is enabled, David Vincent's observation about emerge just |
57 |
"jamming thru" compilation steps that have already been completed will be |
58 |
accurate. I expect that is what he was seeing. The effect here is that |
59 |
portage/emerge does everything over again, but ccache steps in and |
60 |
shortcuts gcc so the compiles don't actually have to be done over again. |
61 |
Ccache simply substitutes the cached output (complete with warnings) and |
62 |
files as if gcc was actually doing it, but faster. |
63 |
|
64 |
3 Ebuild is even MORE useful, in resumption situations. |
65 |
|
66 |
Unlike emerge, which automatically deletes the work dirs and starts over, |
67 |
ebuild will (unless told otherwise) look to see if the unpack step was |
68 |
successful, and skip it if so. Further, if by chance the compile step was |
69 |
ALSO successful, it will skip that also, moving on to the install step |
70 |
(note the list of the steps from man ebuild in the post I quoted above). |
71 |
|
72 |
However, since those steps (well, except qmerge, which just merges what's |
73 |
in the "fake" install dirs to the live system) each skip previous steps |
74 |
completed successfully, that "compile" step you mentioned above shouldn't |
75 |
be necessary to specify directly. Simply ebuild (path to ebuild) install |
76 |
qmerge should work. |
77 |
|
78 |
Further, the "merge" action of ebuild combines ALL the above steps, again, |
79 |
skipping unpack and compile if they've already been done. Thus, all |
80 |
one REALLY needs to do is "ebuild /path/to/package.ebuild merge", and it |
81 |
will verify the unpack step, then pick up with the compile or install step |
82 |
as necessary and go from there. |
83 |
|
84 |
**IMPORTANT** Ebuild does NOT resolve dependencies like emerge does. |
85 |
Thus, one only uses ebuild on the partially completed ebuild that was |
86 |
currently being installed when the interruption occurred, if there |
87 |
happened to be dependencies to emerge before the main package, and the |
88 |
interruption occurred while emerging one of them, before the main |
89 |
package emerge began. Of course, this also implies that the metapackages |
90 |
"system" and "world" cannot be directly used with ebuild, altho it can |
91 |
naturally complete the merge of a package merge interrupted as PART of an |
92 |
"emerge system" or "emerge world". Just remember that ebuild only works |
93 |
on one package at a time, and doesn't do dependencies. |
94 |
|
95 |
4 A bare "make" can be useful as well. |
96 |
|
97 |
With ebuild, the normal ./configure and make (compile) steps, plus |
98 |
possible additional tasks specific to the individual ebuild package, are |
99 |
all one step. Thus, while it skips the unpack and the invoked make will |
100 |
skip anything already successfully made (compiled) in the ebuild compile |
101 |
step, it wills still rerun thru the ./configure testing step each time it |
102 |
is invoked. |
103 |
|
104 |
If one expects they might interrupt the compile multiple times (or if one |
105 |
is running a system unstable enough that it might crash during the compile |
106 |
multiple times), and one is SURE the ./configure step has already been |
107 |
completed, one can (with most ebuilds, some work a bit differently |
108 |
and this won't work, tho it won't harm anything either) actually enter the |
109 |
work dir (normally /var/tmp/portage/packagename/work/packagename), and |
110 |
invoke make from there, to do the actual compiling, skipping the |
111 |
./configure (testing) step that's already been done. This works because |
112 |
(again, on most packages) all the fancy --configure-with use flag type |
113 |
stuff, as well as the CFLAGS type stuff, gets dynamically bound into the |
114 |
configure script results when that runs, so a simple "make" in the root |
115 |
source dir already knows what you want compiled and with what flags, based |
116 |
on that configure information. |
117 |
|
118 |
The caveat here is that make works at a lower level than ebuild, and thus |
119 |
has no knowledge of ebuild or how it works, so it can't tell ebuild that |
120 |
the compile step is finished. Thus, even after make has successfully |
121 |
completed, if you invoked it directly, you must still go run ebuild merge |
122 |
again, and it will still go thru the configure (as it always does, even |
123 |
when the configure that's there is perfectly usable, because it's all part |
124 |
of the same compile step), and then skip real fast thru the main make |
125 |
steps, before marking the compile finished and continuing with the install |
126 |
and qmerge steps. |
127 |
|
128 |
The upshot of all this is that if there's going to be only the one |
129 |
interruption, it does little good to go run make directly, since you have |
130 |
to run ebuild merge anyway, and it'll do the same thing. However, if you |
131 |
may be interrupting the process a number of times, because running the |
132 |
make directly doesn't rerun the ./configure while ebuild merge will, |
133 |
you'll save time by invoking the make directly. |
134 |
|
135 |
The one other factor worth mentioning here is that depending on the |
136 |
package and sometimes on the use flags, the ebuild compile step will do |
137 |
more than just a configure and make. the docs USE flag is a perfect |
138 |
example, as in many ebuilds, it will cause the ebuild compile step to do |
139 |
an additional "make docs" command. Of course, one can always do the |
140 |
additional steps manually as well, if desired, but that involves |
141 |
checking the ebuild to see what it actually DOES do, and it's seldom worth |
142 |
the trouble, since the main make step is almost always the "big" one, |
143 |
taking the most time and therefore most likely to be interrupted. |
144 |
Checking the ebuild for the additional steps is likely to take more time |
145 |
than running the configure an extra time, if you DO interrupt the |
146 |
process during the extra steps, so it's just not worth it. However, I do |
147 |
mention it so folks that take my suggestion and run the bare make, don't |
148 |
get confused if the ebuild merge then goes and does some MORE make stuff |
149 |
as well. |
150 |
|
151 |
... |
152 |
|
153 |
That's the main stuff, but there are still a couple lose ends to wrap up. |
154 |
|
155 |
Why all the separate fetch/unpack/compile/install/qmerge steps if a simple |
156 |
merge automatically checks to see what's done and goes from there? |
157 |
Simple. The ebuild command was designed to allow on-site ebuild tweaking, |
158 |
and the interrupt/resume functionality it provides is more of a side |
159 |
effect than the reason the tool is there. That's probably also why the |
160 |
configure and make steps aren't split out -- it'd serve no useful end |
161 |
toward the target purpose of allowing on-site installer admin tweaking. |
162 |
|
163 |
Put a bit more concretely, consider the admin that has a special patch |
164 |
they want to (or have been told to by upstream developers) try. While |
165 |
this is always possible by simply bypassing the portage system and doing a |
166 |
manual install from tarball, then emerge-injecting the package into |
167 |
portage's database if desired, ebuild allows just this sort of tweaking at |
168 |
each step in the process. One can fetch and unpack an ebuild, then apply |
169 |
their own patch before running ebuild merge to complete the process |
170 |
automatically. Or, one can ebuild compile and let portage handle that |
171 |
automatically, then examine the results before finishing up the install |
172 |
and qmerge steps automatically with merge. Or, one can do everything up |
173 |
thru the (fake) install automatically, then stop and examine what files |
174 |
are in the fake installation before actually doing the qmerge step. |
175 |
|
176 |
Of course, this also makes troubleshooting an ebuild far easier as well, |
177 |
because each step ends at a critical point, where the results to that |
178 |
point can be checked and a problem pinpointed if it has occurred. If an |
179 |
ebuild is for some reason going thru the motions and installing all the |
180 |
docs but failing to install a particular binary, as happened to me once, |
181 |
it's easy to see if it's in the fake install location before the qmerge to |
182 |
the live system, and if it's not, to trace back and see if the compile |
183 |
process actually created the file or if the install simply didn't move it |
184 |
from the work dir to the fake install dir. In my case, it was a problem |
185 |
during make. I figured out what was going wrong by doing the make |
186 |
manually until I was able to get the expected file made, then I ran ebuild |
187 |
merge and let it finish the process for me. (The problem was a bad path |
188 |
on my system or some such, so the necessary utility didn't get invoked, |
189 |
and the necessary file didn't get made, IIRC, thus, a pbcak, problem |
190 |
between chair and keyboard, user error, not something to file a bug about. |
191 |
However, without ebuild's troubleshooting ability, I would have had a much |
192 |
more difficult time figuring out the problem!) |
193 |
|
194 |
One more item to wrap up. Check out the noclean and keepwork FEATURES |
195 |
available to portage, in the make.conf manpage. I've not tried these, but |
196 |
by my read, it looks like they may allow an emerge to pick up where it |
197 |
left off rather than erasing and starting over, just like ebuild does. |
198 |
The tradeoff of course would be having to manually clean out |
199 |
/var/tmp/portage (or your non-default portage tempdir location) far more |
200 |
often, as all those extra packages that are normally cleaned up to a |
201 |
minimal stub would still be there in full space hogging glory. |
202 |
|
203 |
That should about cover it! |
204 |
|
205 |
|
206 |
-- |
207 |
gentoo-user-de@g.o mailing list |