Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Portage one liners - tips and tricks for using gentools
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
tomchuk
Guru
Guru


Joined: 23 Mar 2003
Posts: 317
Location: Brooklyn, NY

PostPosted: Sat Dec 06, 2003 11:55 pm    Post subject: Portage one liners - tips and tricks for using gentools Reply with quote

Portage one liners
(Hey baby, wanna touch my gentool?)

Here are a few of my favorite one-line commands to make portage do cool and useful things. I've tried to include commands that are usefull and not overly obvious as the man pages for the tools in gentoolkit are very good.

The basic requirements for this How-To are a gentoo system with a recent version of app-portage/gentoolkit installed.


To find out where xchat installed it's executable:
Code:
qpkg -nc -l xchat | grep bin/.*



To find vcron's man pages:
Code:
qpkg -nc -l vcron | grep man[0-9]/.* | sed "s/.*man[0-9]\///g" | sed "s/.gz/)/g" | sed "s/\./(/g"
This is a bit ugly but 99% of the time it will spit out a list of man pages installed (like crontab(1), crontab(5), cron(8))


To verify the integrity of /bin/ps
Code:
qpkg -f -c -v /bin/ps



To verify all installed packages in the meta-category 'system':
Code:
for I in `emerge -eDp system | awk '{print $4}'`; do qpkg -c $I; done
This will take forever as it checks mtimes and md5s for every file of every package in 'system'


To upgrade every package on your system to the latest version:
Code:
emerge -Uu --oneshot `qpkg -I -nc`
This will catch things that even emerge -UuD world will miss without adding them to the world file.


To print info on USE flags that will affect php:
Code:
for I in `emerge -vp --nodeps php | grep ebuild | sed "s/\[ebuild.*[0-9]  //g" | sed "s/[-,+]//g"`; do euse -i $I; done



To rebuild your entire system using the USE flags that the individual packages were compiled with:
Code:
for I in `emerge -eDp world | grep ebuild | awk '{print $4}' | sed "s/\-[0-9].*//g"`
do
   USE="`etcat -u $I | grep "\+ [0-9,a-z]" | awk '{print $3}'` `etcat -u $I | grep "\- [0-9,a-z]" | awk '{print $2 $3}'`" emerge --nodeps --oneshot -pv $I || echo -e "$I did not compile" >> ~/emerge_emptytree.log
done
For every package in emerge -eDp world, the script will use etcat to determine what it was installed with and emerge that package (not touching your world file) using those USE flags. It's set for -p right now so you can do a dry run. If you're sure you like the decisions it makes, remove the "-pv" from "emerge --nodeps --oneshot -pv $I" on the end of line 3 (which should all be on one line)


I think those are the ones I find most usefull. If anyone else uses the gentools in interesting ways, please post.
Back to top
View user's profile Send private message
j11888
n00b
n00b


Joined: 16 Dec 2003
Posts: 5

PostPosted: Tue Dec 16, 2003 10:13 pm    Post subject: Reply with quote

i use the patch to show dl times in emerge -vp, so i think that a script as such is better with that:

Code:
$ cat euseflags
#!/bin/sh
for I in `emerge -vp --nodeps $1 | grep ebuild | sed "s/\[ebuild.*[0-9]  //g"|sed "s/[-,+]//g"|sed "s/kB//g"|sed "s/[0-9][0-9]*//g" `;
 do euse -i $I;
  done


dont no how well my sed commands are, but i think itll work w/ or w/o the download time patch.
Back to top
View user's profile Send private message
Seymour
n00b
n00b


Joined: 04 Mar 2003
Posts: 69
Location: Binghamton, New York

PostPosted: Thu Dec 18, 2003 7:05 pm    Post subject: Reply with quote

Is there a way to recompile the exact version of every installed package? "emerge -ep world" wants to downgrade the packages that I installed with ACCEPT_KEYWORDS="~x86".

Also, where does qpkg get its package information? When I run
Code:
emerge -Uu --oneshot `qpkg -I -nc`
I get:
Code:
root@mslug# emerge -Uu --oneshot `qpkg -I -nc`
Calculating dependencies \
emerge: there are no masked or unmasked ebuilds to satisfy "app-admin/fam-oss".

!!! Error calculating dependencies. Please correct.

I cant find any trace of that package anywhre in portage or on my system.
Back to top
View user's profile Send private message
Jazz
Guru
Guru


Joined: 16 Nov 2003
Posts: 543
Location: Melbourne, Australia

PostPosted: Thu Dec 18, 2003 7:22 pm    Post subject: Reply with quote

hey exactly... i getthe same app-admin/fam-oss error, even when i try to do a emerge -pUD world !

Its insane, earlier i used to get virtual/cdrdao error ! and i had to manually fix the ebuild for cdrtools, and cdrdao for emerge to work properly again !

Can someone point us in the right direction this time ?
Bye,
Jassi
Back to top
View user's profile Send private message
CybeRDukE
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jul 2002
Posts: 92

PostPosted: Thu Dec 18, 2003 7:23 pm    Post subject: Reply with quote

i had the same problem with fam-oss.

qpkg gets its information from /var/db/pkg

the problem occurs because fam-oss was renamed to fam. in some cases a simple re-emerge of the package (in this case fam without the -oss) does work, if it doesn't then you have to get the old ebuild from portage cvs and try to uninstall cleanly.

i also noticed that masked installed programs may become a problem if there is no unmasked version of it. so my sysupdate-script looks the following:

Code:
emerge -UD $@ `qpkg -I -nc | egrep -v "(bootsplash|gentoo-test|pfeifer|kahakai)"`


it just greps out the masked packages.

hope i could help.

btw, what speeks against writing the output of qpkg -I -nc to the world-file?
Back to top
View user's profile Send private message
Seymour
n00b
n00b


Joined: 04 Mar 2003
Posts: 69
Location: Binghamton, New York

PostPosted: Thu Dec 18, 2003 11:29 pm    Post subject: Reply with quote

Thank you very much for that grep trick! I've been having that problem with "emerge -DU world" for a while and have not been able to find a workaround untill now.

As for adding the output to the world file, I don't think it would break anything. It just makes the update line act more like a regular "emerge -DU world" which wouldn't add anything to the world file.
Back to top
View user's profile Send private message
tomchuk
Guru
Guru


Joined: 23 Mar 2003
Posts: 317
Location: Brooklyn, NY

PostPosted: Fri Dec 19, 2003 12:32 am    Post subject: Reply with quote

CybeRDukE wrote:

btw, what speeks against writing the output of qpkg -I -nc to the world-file?


That would make depclean (more) totally useless. If you simply put every installed package into your world file, nothing would ever show up for depclean.
Back to top
View user's profile Send private message
Jazz
Guru
Guru


Joined: 16 Nov 2003
Posts: 543
Location: Melbourne, Australia

PostPosted: Fri Dec 19, 2003 4:44 am    Post subject: Reply with quote

Hey what grep trick ?? PLS specify what did the trick for you ! even i've been plaguing with this problem...

Also, wont the emerge sync again screw the system ??
Bye,
Jassi
Back to top
View user's profile Send private message
Seymour
n00b
n00b


Joined: 04 Mar 2003
Posts: 69
Location: Binghamton, New York

PostPosted: Fri Dec 19, 2003 12:46 pm    Post subject: Reply with quote

jassi wrote:
Hey what grep trick ?? PLS specify what did the trick for you ! even i've been plaguing with this problem...


I was refering to
CybeRDukE wrote:
Code:
emerge -UD $@ `qpkg -I -nc | egrep -v "(bootsplash|gentoo-test|pfeifer|kahakai)"`

Just replace the part in quotes with the masked packages on your system.
Back to top
View user's profile Send private message
Techie2000
Guru
Guru


Joined: 16 May 2002
Posts: 344

PostPosted: Sat Dec 20, 2003 4:46 am    Post subject: Reply with quote

Quote:
To print info on USE flags that will affect php:

Code:
for I in `emerge -vp --nodeps php | grep ebuild | sed "s/\[ebuild.*[0-9] //g" | sed "s/[-,+]//g"`; do euse -i $I; done


Why not just do "etcat -u php" ? It's much shorter to type out and the output is much cleaner...
_________________
"And I'm right. I'm always right, but in this case I'm just a bit more right than I usually am." - Linus Torvalds
Back to top
View user's profile Send private message
tomchuk
Guru
Guru


Joined: 23 Mar 2003
Posts: 317
Location: Brooklyn, NY

PostPosted: Sat Dec 20, 2003 4:52 am    Post subject: Reply with quote

Techie2000 wrote:
Quote:
To print info on USE flags that will affect php:

Code:
for I in `emerge -vp --nodeps php | grep ebuild | sed "s/\[ebuild.*[0-9] //g" | sed "s/[-,+]//g"`; do euse -i $I; done


Why not just do "etcat -u php" ? It's much shorter to type out and the output is much cleaner...


Yes that is a little easier. Did etcat always include deps or have I had a little too much holiday cheer ;)
Back to top
View user's profile Send private message
dmvianna
l33t
l33t


Joined: 22 Mar 2004
Posts: 742
Location: Down Underland

PostPosted: Wed Dec 22, 2004 2:24 pm    Post subject: Reply with quote

Hey, I want to recompile my system with the same USEs, but etcat does not work anymore. How would you do it with gentoolkit 0.2.0?
_________________
Proprietary is theft. Pierre-Joseph Proudhon, if he had a chance
Powered by a MacBook Pro
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