1 |
Thank you for the 'one liner'... I think it is exactly what I need. I'm |
2 |
trying it out lately and let you know... |
3 |
|
4 |
I did tweak it a smidge to be a little more flexible and robust: |
5 |
|
6 |
locutus ~ # cat /usr/local/bin/emerge_select |
7 |
#!/bin/sh |
8 |
|
9 |
if test -z $1; then |
10 |
echo "required search argument is missing." |
11 |
echo "For example, use 'x11' for all the X11 ebuilds." |
12 |
exit |
13 |
else |
14 |
emerge -va1 $(emerge -pvu world | \ |
15 |
sed -n -r 's,^\[ebuild[^]]*\]\ ('$1'[^\ ]*).*$,\1,p' | \ |
16 |
sed -r 's/-[^-]+(-r[0-9]+)*$//') \ |
17 |
|| until emerge --resume --skipfirst; do :; done |
18 |
fi |
19 |
|
20 |
DÆVID |
21 |
|
22 |
> -----Original Message----- |
23 |
> From: Bo Ørsted Andresen [mailto:bo.andresen@××××.dk] |
24 |
> Sent: Monday, November 20, 2006 12:37 AM |
25 |
> To: gentoo-user@l.g.o |
26 |
> Subject: Re: [gentoo-user] In need of script/command that |
27 |
> will parse out all the packages from "emerge -avu world" |
28 |
> |
29 |
> On Monday 20 November 2006 07:37, Daevid Vincent wrote: |
30 |
> > Wondering if someone has a script or shell 'one liner' that |
31 |
> can take the |
32 |
> > output of "emerge -avu world" and make a list of the |
33 |
> packages (I assume all |
34 |
> > on one line). Then I could pump that back into "emerge -av" |
35 |
> again (I don't |
36 |
> > mind if it's a simple manual highlight and copy/append). |
37 |
> |
38 |
> You need to replace --ask with --pretend when you send the |
39 |
> output into a pipe. |
40 |
> Otherwise it will wait for input. Also when you send it back |
41 |
> to `emerge -av` |
42 |
> you should add --oneshot in order to avoid that every package |
43 |
> on the list |
44 |
> gets added to the world file. |
45 |
> |
46 |
> [SNIP] |
47 |
> > For example: |
48 |
> > |
49 |
> > daevid ~ # emerge -avu world | grep x11- |
50 |
> > [ebuild U ] x11-misc/util-macros-1.1.2 [1.1.0] |
51 |
> USE="-debug" 45 kB |
52 |
> > [ebuild U ] x11-proto/inputproto-1.4 [1.3.2] USE="-debug" 47 kB |
53 |
> > [ebuild U ] x11-proto/xproto-7.0.9 [7.0.7] USE="-debug" 138 kB |
54 |
> > [ebuild U ] x11-libs/xtrans-1.0.2 [1.0.1] USE="-debug" 97 kB |
55 |
> > [ebuild U ] x11-libs/libX11-1.0.3-r1 [1.0.3] USE="ipv6 |
56 |
> -debug" 1,415 kB |
57 |
> > ... |
58 |
> > |
59 |
> > I want to run some command that will give me a list like: |
60 |
> > |
61 |
> > x11-misc/util-macros x11-proto/inputproto x11-proto/xproto ... |
62 |
> > |
63 |
> > Then I could just select and copy that "string" and append |
64 |
> it to "emerge |
65 |
> > -av " |
66 |
> |
67 |
> I believe [1] should help you understand how this works...: |
68 |
> |
69 |
> # emerge -va1 $(emerge -pvu world | |
70 |
> sed -n -r 's,^\[ebuild[^]]*\]\ (x11-[^\ ]*).*$,\1,p' | |
71 |
> sed -r 's/-[^-]+(-r[0-9]+)*$//') |
72 |
> |
73 |
> [1] http://www.grymoire.com/Unix/Sed.html |
74 |
> |
75 |
> -- |
76 |
> Bo Andresen |
77 |
> |
78 |
|
79 |
|
80 |
-- |
81 |
gentoo-user@g.o mailing list |