1 |
On Mon, Apr 20, 2020 at 9:13 AM Ashley Dixon <ash@××××××××××.uk> wrote: |
2 |
> |
3 |
> Following the recent conversation started by Meino, I have decided to convert my |
4 |
> package.* files to directory structures. For all but one, this has proven |
5 |
> tedious, but relatively painless. My package.use file is another story: at over |
6 |
> three-hundred lines, the thought of manually converting this to a directory |
7 |
> structure does not attract me. |
8 |
> |
9 |
> Are there any tools in Portage to help with this, or must I resort to writing a |
10 |
> shell script ? |
11 |
> |
12 |
> For example, considering the following lines in my flat package.use: |
13 |
> |
14 |
> media-video/openshot printsupport |
15 |
> sys-apps/util-linux tty-helpers |
16 |
> |
17 |
> I want to take this file and create a directory structure: |
18 |
> |
19 |
> media-video/openshot, containing "media-video/openshot printsupport" |
20 |
> sys-apps/util-linux, containing "sys-apps/util-linux tty-helpers" |
21 |
> |
22 |
|
23 |
Well, you could do this. |
24 |
|
25 |
Or you could do: |
26 |
cd /etc/portage |
27 |
mv package.use legacy |
28 |
mkdir package.use |
29 |
mv legacy package.use/ |
30 |
|
31 |
Then your new stuff could go in nice clean files, and your old stuff |
32 |
is sitting in that legacy file. You don't HAVE to have one package |
33 |
per file. |
34 |
|
35 |
My personal organization system for these directories is: |
36 |
|
37 |
1. Every directory contains a file named zzzauto which is where |
38 |
autounmasked/etc entries end up going. That is going to be like an |
39 |
inbox and if it gets crufty I just delete it and let portage re-create |
40 |
it. |
41 |
2. I create task/topic-based files within it, with groups of related |
42 |
flags. So if I want ~arch on package foo, and that requrires ~arch on |
43 |
3 other packages, I create a file named foo and stick all 4 keyword |
44 |
changes in it. This way when I'm wondering WHY I unmasked some random |
45 |
library I can see what lead me to that point. |
46 |
3. When portage autounmasks something I try to make a point to run |
47 |
cat zzzauto > newfile ; rm zzzauto ; touch zzzauto - to move the |
48 |
unmask entries into a new topical file or append them to an existing |
49 |
one. I want to keep the zzzauto file clean so that I don't end up |
50 |
with a 300 line monstrosity like you have, and like I used to have. |
51 |
I'm not perfect at this, but the zzzauto file can always be wiped at |
52 |
any time as it was autogenerated in the first place, and any |
53 |
carefully-tailored settings are in topical files. |
54 |
|
55 |
You could stick one package per file named after the package like |
56 |
you're proposing, but: |
57 |
1. It will take a lot of time. |
58 |
2. It will add no value other than satisfying the move to a |
59 |
directory, which the legacy file above already adds. In six months |
60 |
you'll have no idea why you set some flag for some random package, |
61 |
because you have a million files like this. |
62 |
|
63 |
At least with the legacy all the undocumented cruft stays in one file, |
64 |
and then you can put new stuff in new files and start documenting |
65 |
things using whatever scheme you prefer. |
66 |
|
67 |
Otherwise though I'm sure you could do what you're proposing in a few |
68 |
lines of python. I'm sure it is possible with a bit of bash/awk/etc |
69 |
as well. |
70 |
|
71 |
-- |
72 |
Rich |