Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Simple build of all packages currently installed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Old_dude
n00b
n00b


Joined: 28 May 2005
Posts: 6

PostPosted: Tue Sep 04, 2007 8:23 pm    Post subject: Simple build of all packages currently installed Reply with quote

This command will output all packages currently installed for perusal at will:
ls /var/db/pkg/*/*/*.ebuild | cut -d/ "-f5-6" > installed_list

This one will use quickpkg to build all packages installed:
ls /var/db/pkg/*/*/*.ebuild | cut -d/ "-f5-6" | sed 's/^/=/' | xargs quickpkg

These were old snippets found on the 'net, combined and modified for the current Gentoo structure as of 09/04/2007.
_________________
Gentoo noob since ALWAYS
Back to top
View user's profile Send private message
termite
Guru
Guru


Joined: 06 May 2007
Posts: 466

PostPosted: Wed Sep 05, 2007 1:05 am    Post subject: Reply with quote

Code:
eix -i
will do the same thing.
Back to top
View user's profile Send private message
Old_dude
n00b
n00b


Joined: 28 May 2005
Posts: 6

PostPosted: Wed Sep 05, 2007 6:28 pm    Post subject: Reply with quote

termite wrote:
Code:
eix -i
will do the same thing.

Actually, output isn't even close ......
_________________
Gentoo noob since ALWAYS
Back to top
View user's profile Send private message
roderick
l33t
l33t


Joined: 11 Jul 2005
Posts: 908
Location: St. John's, NL CANADA

PostPosted: Wed Sep 05, 2007 7:45 pm    Post subject: Reply with quote

Fine...

Here's the compact output:

Code:

eix -Ic


The above gives version and description in a single line. If you then want to get the package only...

Code:

eix -Ic* | cut -d" " "-f2"


eix is a wonderful tool that can show the output in many ways. And you do not need to know that portage happens to store its files currently in the directory mentioned in the first post (which could change). Unless you are a portage developer, you should never worry about the location of the package database, just that it exists and there are applications to retrieve this information for you (like eix, equery, emerge --search, etc.).

:)

Experiment with eix (install it if you do not have it). You won't be sorry.
_________________
If God were a pickle, I'd still say "no pickle on my burger".
http://roderick-greening.blogspot.com/
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 9752
Location: Córdoba (Spain)

PostPosted: Wed Sep 05, 2007 8:07 pm    Post subject: Reply with quote

roderick wrote:
Fine...

Here's the compact output:

Code:

eix -Ic


The above gives version and description in a single line. If you then want to get the package only...

Code:

eix -Ic* | cut -d" " "-f2"


eix is a wonderful tool that can show the output in many ways. And you do not need to know that portage happens to store its files currently in the directory mentioned in the first post (which could change). Unless you are a portage developer, you should never worry about the location of the package database, just that it exists and there are applications to retrieve this information for you (like eix, equery, emerge --search, etc.).

:)

Experiment with eix (install it if you do not have it). You won't be sorry.


Eix is wonderful, no doubt, but if you want a bit more of speed you can use just bash, without even sed, cut or awk. Bash string mangling is powerful enough for this task.

Code:

$ time for i in /var/db/pkg/*/*; do i=${i/\/var\/db\/pkg\//}; i=${i/-[0-9]*/}; echo $i; done
bla
blah
blah
real   0m0.071s
user   0m0.050s
sys   0m0.010s


Code:

$ time eix -Ic* | cut -d" " "-f2"
real   0m0.310s
user   0m0.253s
sys   0m0.036s


It's at least one order of magnitude faster. Not that it matters too much, though. But the first time I ran eix it took around 8 seconds to run. Those values are averages in between many consecutive runs. As said, not that this matters too much.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
likewhoa
l33t
l33t


Joined: 04 Oct 2006
Posts: 731
Location: Brooklyn, New York

PostPosted: Wed Sep 05, 2007 11:30 pm    Post subject: Reply with quote

Code:

# time find /var/db/pkg -mindepth 2 -maxdepth 2 -type d|cut -d/ -f5-6|sed 's:^:=:'
real    0m0.016s
user    0m0.001s
sys     0m0.004s


seems faster :D
to finish it just add a pipe with xargs emerge -1v
Back to top
View user's profile Send private message
roderick
l33t
l33t


Joined: 11 Jul 2005
Posts: 908
Location: St. John's, NL CANADA

PostPosted: Thu Sep 06, 2007 2:30 am    Post subject: Reply with quote

And you shouldn't need to know the structure of the portage db directory or depend on it as a generic user (advanced users - sure).
_________________
If God were a pickle, I'd still say "no pickle on my burger".
http://roderick-greening.blogspot.com/
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 2159
Location: The Peanut Gallery

PostPosted: Thu Sep 06, 2007 10:47 am    Post subject: Reply with quote

Here's another variant:
Code:
find /var/db/pkg -mindepth 2 -maxdepth 2 -type d|awk -F/ '{print "="$5"/"$6}'

And I have this in /etc/bash/bashrc as well (thanks to nanafunk):
Code:
pl () {
    local i;
    for i in /var/db/pkg/*/*;
    do
        i="${i#/*/*/*/}";
        echo "$i";
    done
}

..which is pretty much the same as above ofc.

Personally I am quite happy using text files; if portage switches to a db yadda yadda it'll be easy enough to script round I am sure. (see /msg greybot db on irc.freenode.org.)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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