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