1 |
Ashley Dixon wrote: |
2 |
> Hi gentoo-user, |
3 |
> |
4 |
> Following the recent conversation started by Meino, I have decided to convert my |
5 |
> package.* files to directory structures. For all but one, this has proven |
6 |
> tedious, but relatively painless. My package.use file is another story: at over |
7 |
> three-hundred lines, the thought of manually converting this to a directory |
8 |
> structure does not attract me. |
9 |
> |
10 |
> Are there any tools in Portage to help with this, or must I resort to writing a |
11 |
> shell script ? |
12 |
> |
13 |
> For example, considering the following lines in my flat package.use: |
14 |
> |
15 |
> media-video/openshot printsupport |
16 |
> sys-apps/util-linux tty-helpers |
17 |
> |
18 |
> I want to take this file and create a directory structure: |
19 |
> |
20 |
> media-video/openshot, containing "media-video/openshot printsupport" |
21 |
> sys-apps/util-linux, containing "sys-apps/util-linux tty-helpers" |
22 |
> |
23 |
> How can this be done ? |
24 |
> Thanks. |
25 |
> |
26 |
|
27 |
Well, as some here know, I do things differently. My knowledge on |
28 |
scripting and those types of commands is basic, if that. A while back I |
29 |
had one file for everything but I wanted to split some off and have a |
30 |
few files for certain groups of packages, using what is updated in |
31 |
groups as a guide. This is what I ended up with. Output of tree. |
32 |
|
33 |
|
34 |
root@fireball / # tree /etc/portage/package.accept_keywords/ |
35 |
/etc/portage/package.accept_keywords/ |
36 |
├── dev-qt |
37 |
├── kde-apps |
38 |
├── kde-frameworks |
39 |
├── kde-misc |
40 |
├── kde-plasma |
41 |
└── package.keywords |
42 |
|
43 |
0 directories, 6 files |
44 |
root@fireball / # |
45 |
|
46 |
|
47 |
The reason I did this, if a upgrade goes bad for say kde-apps, I can |
48 |
move the kde-apps file out of that directory and emerge will downgrade |
49 |
to the last stable version. How I did that? Well, I went to a console |
50 |
and used cat and grep. Example. cat |
51 |
/etc/portage/package.accept_keywords/package.keywords | grep kde-apps |
52 |
That would list all the matches on the konsole. I then copied those to |
53 |
a new file for kde-apps. Since those tended to be grouped together, I |
54 |
then removed those entries from the old file. I rinse and repeat that |
55 |
several times until I got the one file to be targeted with several |
56 |
files. One could likely use echo to put those in a file automatically |
57 |
but I was chicken. :/ |
58 |
|
59 |
You may find a better way, certainly there has to be one, after all, |
60 |
this is ME, but that may give you ideas. There is likely a lot of ways |
61 |
to do this. You get someone who has a better grasp of those awk and sed |
62 |
commands, the possibilities get huge real fast. Me, I'm still learning |
63 |
about grep. I got cat pretty much figured out. ;-) |
64 |
|
65 |
Hope that helps or leads to a better way. Please share if you do find a |
66 |
better way tho. May help someone else in the future. |
67 |
|
68 |
Dale |
69 |
|
70 |
:-) :-) |