View previous topic :: View next topic |
Author |
Message |
Old_dude n00b
Joined: 28 May 2005 Posts: 6
|
Posted: Tue Sep 04, 2007 8:23 pm Post subject: Simple build of all packages currently installed |
|
|
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 |
|
|
termite Guru
Joined: 06 May 2007 Posts: 466
|
Posted: Wed Sep 05, 2007 1:05 am Post subject: |
|
|
will do the same thing. |
|
Back to top |
|
|
Old_dude n00b
Joined: 28 May 2005 Posts: 6
|
Posted: Wed Sep 05, 2007 6:28 pm Post subject: |
|
|
termite wrote: | will do the same thing. |
Actually, output isn't even close ...... _________________ Gentoo noob since ALWAYS |
|
Back to top |
|
|
roderick l33t
Joined: 11 Jul 2005 Posts: 908 Location: St. John's, NL CANADA
|
Posted: Wed Sep 05, 2007 7:45 pm Post subject: |
|
|
Fine...
Here's the compact output:
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 |
|
|
i92guboj Bodhisattva
Joined: 30 Nov 2004 Posts: 10315 Location: Córdoba (Spain)
|
Posted: Wed Sep 05, 2007 8:07 pm Post subject: |
|
|
roderick wrote: | Fine...
Here's the compact output:
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. |
|
Back to top |
|
|
likewhoa l33t
Joined: 04 Oct 2006 Posts: 778 Location: Brooklyn, New York
|
Posted: Wed Sep 05, 2007 11:30 pm Post subject: |
|
|
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
to finish it just add a pipe with xargs emerge -1v |
|
Back to top |
|
|
roderick l33t
Joined: 11 Jul 2005 Posts: 908 Location: St. John's, NL CANADA
|
Posted: Thu Sep 06, 2007 2:30 am Post subject: |
|
|
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 |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Thu Sep 06, 2007 10:47 am Post subject: |
|
|
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 |
|
|
|