Re: [gentoo-user] Converting a Portage Flat File to a Directory Structure

2020-04-21 Thread Ashley Dixon
On Tue, Apr 21, 2020 at 09:18:04AM -0600, Grant Taylor wrote:
> I wasn't aware that you could put sub-directories in
> /etc/portage/package.use.  I've always had to put the files directly in that
> directory, not sub-directories.  As such, my files have names like
> sys-apps-util-linux to avoid naming collisions.  Perhaps things have changed
> since I last tried to use a sub-directory or I am misremembering.

I'm not sure  if  this  is  a  new  feature,  but  to  my  knowledge,  package.*
directories are able to emulate the structure you have in  /var/db/repos/gentoo,
i.e.  /.

> I think it should be relatively easy to script reading the line, extracting
> the package name, munging the name, and writing the entire unmodified line
> to a new file based on the munged name.  If directories work, create and
> populate them without munging names.

Yeah, I think I will have to dust off my old shell-scripting manual.  Somehow  I
always find a way of avoiding scripting, as I have a  strong  disliking  towards
it.  I was just curious if there was a pre-existing tool included with  Portage.

-- 

Ashley Dixon
suugaku.co.uk

2A9A 4117
DA96 D18A
8A7B B0D2
A30E BF25
F290 A8AA



signature.asc
Description: PGP signature


Re: [gentoo-user] Converting a Portage Flat File to a Directory Structure

2020-04-21 Thread Grant Taylor



On 4/20/20 7:13 AM, Ashley Dixon wrote:

Hi gentoo-user,


Hi,


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 ?


I'm not aware of a tool to do the conversion.  However there may be one 
that I'm not aware of.



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"


I wasn't aware that you could put sub-directories in 
/etc/portage/package.use.  I've always had to put the files directly in 
that directory, not sub-directories.  As such, my files have names like 
sys-apps-util-linux to avoid naming collisions.  Perhaps things have 
changed since I last tried to use a sub-directory or I am misremembering.



How can this be done ?


I think it should be relatively easy to script reading the line, 
extracting the package name, munging the name, and writing the entire 
unmodified line to a new file based on the munged name.  If directories 
work, create and populate them without munging names.




--
Grant. . . .
unix || die



Re: [gentoo-user] Converting a Portage Flat File to a Directory Structure

2020-04-20 Thread Dale
Ashley Dixon wrote:
> Hi gentoo-user,
>
> 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"
>
> How can this be done ?
> Thanks.
>

Well, as some here know, I do things differently.  My knowledge on
scripting and those types of commands is basic, if that.  A while back I
had one file for everything but I wanted to split some off and have a
few files for certain groups of packages, using what is updated in
groups as a guide.  This is what I ended up with.  Output of tree.


root@fireball / # tree /etc/portage/package.accept_keywords/
/etc/portage/package.accept_keywords/
├── dev-qt
├── kde-apps
├── kde-frameworks
├── kde-misc
├── kde-plasma
└── package.keywords

0 directories, 6 files
root@fireball / #


The reason I did this, if a upgrade goes bad for say kde-apps, I can
move the kde-apps file out of that directory and emerge will downgrade
to the last stable version.  How I did that?  Well, I went to a console
and used cat and grep.  Example.  cat
/etc/portage/package.accept_keywords/package.keywords | grep kde-apps 
That would list all the matches on the konsole.  I then copied those to
a new file for kde-apps.  Since those tended to be grouped together, I
then removed those entries from the old file.  I rinse and repeat that
several times until I got the one file to be targeted with several
files.  One could likely use echo to put those in a file automatically
but I was chicken. :/

You may find a better way, certainly there has to be one, after all,
this is ME, but that may give you ideas.  There is likely a lot of ways
to do this.  You get someone who has a better grasp of those awk and sed
commands, the possibilities get huge real fast.  Me, I'm still learning
about grep.  I got cat pretty much figured out.  ;-) 

Hope that helps or leads to a better way.  Please share if you do find a
better way tho.  May help someone else in the future. 

Dale

:-)  :-) 


Re: [gentoo-user] Converting a Portage Flat File to a Directory Structure

2020-04-20 Thread Rich Freeman
On Mon, Apr 20, 2020 at 9:13 AM Ashley Dixon  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



[gentoo-user] Converting a Portage Flat File to a Directory Structure

2020-04-20 Thread Ashley Dixon
Hi gentoo-user,

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"

How can this be done ?
Thanks.

-- 

Ashley Dixon
suugaku.co.uk

2A9A 4117
DA96 D18A
8A7B B0D2
A30E BF25
F290 A8AA



signature.asc
Description: PGP signature