Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] merge a list of packages?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
CptClyde
n00b
n00b


Joined: 18 Jan 2023
Posts: 18

PostPosted: Thu Apr 27, 2023 12:41 pm    Post subject: [SOLVED] merge a list of packages? Reply with quote

Is there a way to pipe into emerge a list of packages to install?
I do not see any options built into the emerge in the man page and the following do not seem to work:
Code:
emerge -a < list

Code:
cat list | xargs emerge -a


Is there something I'm missing? I thought assumed this would be trivial but is apparently beyond me.


Last edited by CptClyde on Thu Apr 27, 2023 12:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 2262

PostPosted: Thu Apr 27, 2023 12:54 pm    Post subject: Re: merge a list of packages? Reply with quote

CptClyde wrote:
Code:
cat list | xargs emerge -a

Works for me. So does emerge -a $(cat list)

This assumes what is in "list" are valid atoms.

See also user defined sets on the wiki and man pages
Back to top
View user's profile Send private message
CptClyde
n00b
n00b


Joined: 18 Jan 2023
Posts: 18

PostPosted: Thu Apr 27, 2023 12:59 pm    Post subject: [solved] Reply with quote

Interesting, this is what I see when I try the 'xargs' command:

Code:
gentoo ~ # cat flatlist | xargs emerge -a
!!! "--ask" should only be used in a terminal. Exiting.


but your emerge -a $(cat list) does seem to work for me. Thanks a ton.
.... yes a few of the atoms are ambiguous and require full names be added it seems.

Thanks for the help.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23670

PostPosted: Thu Apr 27, 2023 3:14 pm    Post subject: Re: [SOLVED] merge a list of packages? Reply with quote

CptClyde wrote:
Is there a way to pipe into emerge a list of packages to install?
You must list them all on the command line, or in a set that is referenced on the command line. However, the command line length limit is quite generous, and there is no need to type them all on the command line. Any command that ultimately runs emerge with the right arguments will suffice. xargs is the most obvious approach, though it has a potentially undesirable quirk if your argument list is exceedingly long, since it would run more than one emerge.
CptClyde wrote:
Code:
emerge -a < list
This would emerge nothing, and if emerge did not exit due to that, it would ask the listfile if you want to proceed with merging nothing.
CptClyde wrote:
Code:
cat list | xargs emerge -a
This is a Useless Use Of Cat. Use xargs emerge -a <list to get the same effect more cleanly.
CptClyde wrote:
Interesting, this is what I see when I try the 'xargs' command:
Code:
gentoo ~ # cat flatlist | xargs emerge -a
!!! "--ask" should only be used in a terminal. Exiting.
Right. Per info xargs, the child process (emerge) will be run with stdin redirected from null, which is not a terminal. You could choose not to use --ask here, or you could use the xargs option --arg-file to preserve stdin.
CptClyde wrote:
but your emerge -a $(cat list) does seem to work for me.
In bash, this can be simplified as emerge -a $(< list) to avoid the cat call.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum