Gentoo Archives: gentoo-user

From: "Bo Ørsted Andresen" <bo.andresen@××××.dk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] In need of script/command that will parse out all the packages from "emerge -avu world"
Date: Mon, 20 Nov 2006 08:42:11
Message-Id: 200611200936.48984.bo.andresen@zlin.dk
In Reply to: [gentoo-user] In need of script/command that will parse out all the packages from "emerge -avu world" by Daevid Vincent
1 On Monday 20 November 2006 07:37, Daevid Vincent wrote:
2 > Wondering if someone has a script or shell 'one liner' that can take the
3 > output of "emerge -avu world" and make a list of the packages (I assume all
4 > on one line). Then I could pump that back into "emerge -av" again (I don't
5 > mind if it's a simple manual highlight and copy/append).
6
7 You need to replace --ask with --pretend when you send the output into a pipe.
8 Otherwise it will wait for input. Also when you send it back to `emerge -av`
9 you should add --oneshot in order to avoid that every package on the list
10 gets added to the world file.
11
12 [SNIP]
13 > For example:
14 >
15 > daevid ~ # emerge -avu world | grep x11-
16 > [ebuild U ] x11-misc/util-macros-1.1.2 [1.1.0] USE="-debug" 45 kB
17 > [ebuild U ] x11-proto/inputproto-1.4 [1.3.2] USE="-debug" 47 kB
18 > [ebuild U ] x11-proto/xproto-7.0.9 [7.0.7] USE="-debug" 138 kB
19 > [ebuild U ] x11-libs/xtrans-1.0.2 [1.0.1] USE="-debug" 97 kB
20 > [ebuild U ] x11-libs/libX11-1.0.3-r1 [1.0.3] USE="ipv6 -debug" 1,415 kB
21 > ...
22 >
23 > I want to run some command that will give me a list like:
24 >
25 > x11-misc/util-macros x11-proto/inputproto x11-proto/xproto ...
26 >
27 > Then I could just select and copy that "string" and append it to "emerge
28 > -av "
29
30 I believe [1] should help you understand how this works...:
31
32 # emerge -va1 $(emerge -pvu world |
33 sed -n -r 's,^\[ebuild[^]]*\]\ (x11-[^\ ]*).*$,\1,p' |
34 sed -r 's/-[^-]+(-r[0-9]+)*$//')
35
36 [1] http://www.grymoire.com/Unix/Sed.html
37
38 --
39 Bo Andresen

Replies