1 |
Brian Litzinger <brian@××××××××××××.com> posted |
2 |
20060623234720.GB10366@×××××××××××××××××××××××××××.org, excerpted below, |
3 |
on Fri, 23 Jun 2006 16:47:21 -0700: |
4 |
|
5 |
> I suppose there is a clever way to do this, but here is what I do: |
6 |
> |
7 |
> emerge -ep world > foo |
8 |
> |
9 |
> Then I munge foo into a shell script with a bunch of individual emerge |
10 |
> commands. |
11 |
> |
12 |
> Then I just start at wherever it stopped. |
13 |
> |
14 |
> If no one posts the clever or right way to do it, I'll send along |
15 |
> my munging script. |
16 |
|
17 |
I do much the same thing sometimes (most recently to rebuild all my |
18 |
kde-base programs), but note that you don't actually have to run each |
19 |
emerge as an individual command. Once you get the list, you can simply |
20 |
trim it to the names, one per line, and use a redirect to feed it back |
21 |
into emerge. |
22 |
|
23 |
This pretty much dumps a list of the packages (make it one line): |
24 |
|
25 |
emerge -ep world|cut -d] -f2|cut -d" " -f2|grep /|sed -e s/^/=/ > pkglst |
26 |
|
27 |
The first cut uses ] as the delimiter (-d]), cutting to the second field |
28 |
(-f2), so everything to the left of ] gets dumped. |
29 |
|
30 |
The second cut uses [space] as a delimiter, again cutting to the second |
31 |
field, so leaves the category/package-version strings only (plus some |
32 |
garbage lines at the top). |
33 |
|
34 |
The grep / filters out the garbage lines (since all the lines we want have |
35 |
a / between the category and package). |
36 |
|
37 |
The sed inserts an "=" at the beginning of each line, as we will be |
38 |
emerging specific versions. |
39 |
|
40 |
The result is redirected to a file, pkglst, which you can then open in |
41 |
your favorite editor and massage manually where necessary. |
42 |
|
43 |
Once you have it right, try this: |
44 |
|
45 |
emerge --nodeps -a1 $(cat pkglst) |
46 |
|
47 |
If you've done it right, you should get a list of what it would merge, |
48 |
and a prompt asking if you want to do it (the -a). The nodeps keeps portage |
49 |
from having to calculate all those dependencies (thus making it spit out |
50 |
the pretend faster), since we know it's right because the list is the same |
51 |
one emerge spit out previously, in the same order. The -1 (same as |
52 |
--oneshot) tells portage not to add all that to the world file. You don't |
53 |
/want/ all that in the world file since some of those are dependencies |
54 |
of what you really want, and dependencies can change. The $(command) |
55 |
sequence simply tells bash to substitute the output of command into the |
56 |
command line, so we are simply using "cat pkglst" in the command line. |
57 |
|
58 |
If it works, you can say yes and start the remerge. |
59 |
|
60 |
There are a couple benefits to doing it this way. |
61 |
|
62 |
One, any time the merge stops (or you decide to stop it), you can simply |
63 |
delete the packages it has completed merging to that point from pkglst, |
64 |
and rerun your merge command to finish the job. emerge --resume works |
65 |
similarly, but if you stop the process and run a different emerge command, |
66 |
the different emerge command will erase the resume info so portage won't |
67 |
know where it left off, while with the list, you track it manually, |
68 |
deleting packages it's already merged before restarting, so emerge can't |
69 |
lose track of where it was. The list method also gives you a bit more |
70 |
flexibility in terms of skipping some packages to remerge later, if |
71 |
desired (see below). |
72 |
|
73 |
Two, the above technique, modified slightly, can be very useful for |
74 |
merging just a certain group of apps. As mentioned, I used it to remerge |
75 |
all of the kde-base packages I had emerged, not long ago. All one has to |
76 |
do is add an appropriate grep to the string of commands making the list. |
77 |
Taking my example (again, one line): |
78 |
|
79 |
emerge -ep world|cut -d] -f2|cut -d" " -f2|grep /|grep kde-base/|sed -e |
80 |
s/^/=/>pkglst |
81 |
|
82 |
The extra "grep kde-base/" filters the list to only the kde-base category |
83 |
packages, which conveniently are all the ones that make up the kde core |
84 |
packages. |
85 |
|
86 |
Note that I mentioned skipping packages, above. If for that emerge |
87 |
--emptytree world, you knew when you were creating the list that you wanted |
88 |
to save all the kde-base packages to merge later, you could either edit |
89 |
the list appropriately, or use the -v (everything /but/) grep option, as |
90 |
below, then when you decided to remerge kde, use the above to get the list |
91 |
of kde-base packages. (The only difference between the above /only/ KDE, |
92 |
and the below /everything/ /but/ KDE, is the -v grep option.) |
93 |
|
94 |
emerge -ep world|cut -d] -f2|cut -d" " -f2|grep /|grep -v kde-base/|sed -e |
95 |
s/^/=/>pkglst |
96 |
|
97 |
|
98 |
|
99 |
-- |
100 |
Duncan - List replies preferred. No HTML msgs. |
101 |
"Every nonfree program has a lord, a master -- |
102 |
and if you use the program, he is your master." Richard Stallman |
103 |
|
104 |
-- |
105 |
gentoo-amd64@g.o mailing list |