Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Useful Portage Hacks
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
BigBaaadBob
Guru
Guru


Joined: 19 Apr 2003
Posts: 342
Location: Swampscott, MA USA

PostPosted: Tue May 17, 2005 7:39 pm    Post subject: Useful Portage Hacks Reply with quote

The February 14th Gentoo Newsletter published a few neat portage hacks. Maybe we can collect some more here.
I took one of them and converted it to direct Python and called it obsolete:
Code:
#!/usr/bin/python

import portage

for x in portage.db["/"]["vartree"].getallcpv():
    if len(portage.portdb.xmatch("match-all","="+x))==0:
        print "emerge unmerge =%s" % x

This prints out the "emerge unmerge" commands for packages that are merged but are not in portage. The reason I print out the commands individually rather than just listing the packages all on the line is so that it is easy to pick which ones you really want to unmerge when cutting-n-pasting.

What I'd like to have now is something that lists all packages that have more than one slot merged, but my portage-fu is far to weak! :oops: This would be handy for deleting obsolete versions of things that might be causing problems.
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Tue May 17, 2005 7:58 pm    Post subject: Reply with quote

My (sloppy) solution woud be:
Code:
emerge eix
update-eix
eix -I | grep --binary-files=text -v Available | grep --binary-files=text -B 2 -i "Installed: *[^ ][^ ]*\ \ *"
Back to top
View user's profile Send private message
dmitchell
Veteran
Veteran


Joined: 17 May 2003
Posts: 1159
Location: Austin, Texas

PostPosted: Tue May 17, 2005 8:19 pm    Post subject: Re: Useful Portage Hacks Reply with quote

BigBadBob wrote:
What I'd like to have now is something that lists all packages that have more than one slot merged, but my portage-fu is far to weak! :oops: This would be handy for deleting obsolete versions of things that might be causing problems.


What about emerge --prune world?
_________________
Your argument is invalid.
Back to top
View user's profile Send private message
BigBaaadBob
Guru
Guru


Joined: 19 Apr 2003
Posts: 342
Location: Swampscott, MA USA

PostPosted: Tue May 17, 2005 9:18 pm    Post subject: Re: Useful Portage Hacks Reply with quote

danmitchell wrote:
What about emerge --prune world?

That sorta does the right thing, but not quite. For example:
Code:
bwithrow@tuva src $ emerge -p --prune gnome-extra/libgtkhtml

>>> These are the packages that I would unmerge:

 gnome-extra/libgtkhtml
    selected: 3.6.1
   protected: 2.6.3
     omitted: none

>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.

Notice how it is selecting the newest version for removal?

Maybe I should heed the quote in the man page:
Quote:
Since the command currently doesn't handle multiple versions of the same package properly, beware!
:lol:
Back to top
View user's profile Send private message
alkan
Guru
Guru


Joined: 06 Aug 2004
Posts: 385
Location: kasimlar yaylasi

PostPosted: Tue May 17, 2005 9:56 pm    Post subject: Reply with quote

it is depreciated but isn't 'qpkg --dups -v' what you are looking for.
Back to top
View user's profile Send private message
pilla
Administrator
Administrator


Joined: 07 Aug 2002
Posts: 7695
Location: Pelotas, BR

PostPosted: Wed May 18, 2005 12:05 am    Post subject: Reply with quote

Moved from P&P
_________________
"I'm just very selective about the reality I choose to accept." -- Calvin
Back to top
View user's profile Send private message
BigBaaadBob
Guru
Guru


Joined: 19 Apr 2003
Posts: 342
Location: Swampscott, MA USA

PostPosted: Wed May 18, 2005 12:09 am    Post subject: Reply with quote

alkan wrote:
it is depreciated but isn't 'qpkg --dups -v' what you are looking for.
Yeah, that seems to be better. I'll see what qpkg does and hack a scriptlet together like the above.
What else?
Back to top
View user's profile Send private message
BigBaaadBob
Guru
Guru


Joined: 19 Apr 2003
Posts: 342
Location: Swampscott, MA USA

PostPosted: Fri Jun 17, 2005 3:33 pm    Post subject: Reply with quote

Speaking of 'qpkg --dups -v', how does one know whether a dup is necessary or unnecessary? I've found that in some cases if I unmerge a dup a subsequent 'emerge --deep world' will cause it to be added back and in other cases it wont. And in the latter case, sometimes a 'revdep-rebuild' will discover breakage and fix it with newer versions of libraries and other times the unmerging has no effect. In all these cases an 'emerge depclean' does nothing with the dup.

I care about this because I suspect some of the weird problems I've had in the past are due to obsolete libraries are present as dups on my system when they should have gone away.

This seems like useful scriptlet fodder if I can understand how to tell the difference.
Back to top
View user's profile Send private message
BigBaaadBob
Guru
Guru


Joined: 19 Apr 2003
Posts: 342
Location: Swampscott, MA USA

PostPosted: Thu Feb 09, 2006 2:32 pm    Post subject: Reply with quote

Now that qpkg is gone, what is the equivalent to 'qpkg --dups -v'?
Back to top
View user's profile Send private message
alkan
Guru
Guru


Joined: 06 Aug 2004
Posts: 385
Location: kasimlar yaylasi

PostPosted: Thu Feb 09, 2006 3:07 pm    Post subject: Reply with quote

equery list --duplicates
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