Re: [gentoo-user] world's leaves

2008-08-06 Thread Alan McKinnon
On Tuesday 05 August 2008, Dale wrote:
> Andrew Gaydenko wrote:
> > Thanks!
> >
> > Be sure, I'll want to (manually) unmerge those packages I remember
> > and understand what do they do :-)
> >
> >
> > Andrew
>
> I usually do this, equery depends .  If it shows
> something depends on it, don't remove it.  Some things you do not
> want to remove without making sure it is safe, python, emerge itself,
> gcc, glibc, baselayout and anything with 'make' or 'conf' in the
> name.  Example, automake would be one to keep.

Why don't you just let portage do what it's best at and figure all that 
crap out by itself? It's much MUCH better at it than you.

equery depends is broken. It doesn't actually consider USE flags and 
reports on stuff that is in DEPEND in the ebuild, even if it's 
conditional. Just examine the output of --depclean, see it there's any 
packages that you feel you want to keep, add them to world 
with 'emerge -n' and let --depclean do it's job. It will also never 
remove anything in system, which includes your entire build chain, 
portage and python.


-- 
Alan McKinnon
alan dot mckinnon at gmail dot com




Re: [gentoo-user] world's leaves

2008-08-05 Thread Albert Hopkins
I wrote this script awhile back that I used to clean up my world file.  It 
doesn't
actually clean the file, just reports on possible ways to do it. You can run it 
like

# auditworld < /var/lib/package/world

Feel free to use it if you find it useful.

-a

#!/usr/bin/python
"""
Report any packages in world which have direct dependencies also in world
"""

__version__ = (0,3,0)

import os
import sys
sys.path.insert(0, '/usr/lib/gentoolkit/pym')
os.environ['PORTAGE_CALLER'] = 'repoman'

import portage
TREE = portage.db["/"]["vartree"]

import gentoolkit


def get_versions_installed(pkg):
"""
Return a list containt versions of pkg installed (in cpv format)
may be an empty list.
"""
return TREE.dbapi.match(pkg)


def get_world():
"""Return a list of all packages in world"""
_file = sys.stdin
_list = [line.strip() for line in _file]
return _list

def get_deps(pkg):
"""Return a list of all packages depending on pkg (directly)"""
deps = set()
for cpv in get_versions_installed(pkg):
gentoolkit_pkg = gentoolkit.Package(cpv)
rdeps = [i[2] for i in gentoolkit_pkg.get_runtime_deps() if not
i[2].startswith('virtual/')]
for rdep in rdeps:
split = portage.pkgsplit(rdep)
if split is not None:
deps.add(split[0])
else:
deps.add(rdep)

pdeps = [i[2] for i in gentoolkit_pkg.get_postmerge_deps() if not
i[2].startswith('virtual/')]
for pdep in pdeps:
split = portage.pkgsplit(pdep)
if split is not None:
deps.add(split[0])
else:
deps.add(pdep)
#print deps
#command= '/usr/bin/equery -q -C d %s' % pkg
#pipe = os.popen(command, 'r')
#_list = [portage.pkgsplit(line.strip())[0] for line in pipe]
return deps

if __name__ == '__main__':
world = get_world()
for pkg in world:
deps = get_deps(pkg)
for dep in deps:
if (dep != pkg) and (dep in world):
print '%(pkg)s already depends on %(dep)s' % locals()


Re: [gentoo-user] world's leaves

2008-08-04 Thread Dale

Andrew Gaydenko wrote:


Thanks!
 
Be sure, I'll want to (manually) unmerge those packages I remember and 
understand what do they do :-)



Andrew

  


I usually do this, equery depends .  If it shows something 
depends on it, don't remove it.  Some things you do not want to remove 
without making sure it is safe, python, emerge itself, gcc, glibc, 
baselayout and anything with 'make' or 'conf' in the name.  Example, 
automake would be one to keep.


If you do really bork something, it is usually fixable.  It may not be 
easy but most things can be fixed.


If you still unsure, post here with the output of equery list name> and equery depends . 


Dale

:-)  :-) 






Re: [gentoo-user] world's leaves

2008-08-04 Thread Andrew Gaydenko
=== On Tuesday 05 August 2008, Dale wrote: ===
> Andrew Gaydenko wrote:
> > Hi!
> >
> > Is there some simple way to find all portage leaves (packages from
> > which nothing depends on) of installed world?
> >
> >
> > Andrew
>
> 'emerge -p --depclean'  Two dashes before depclean
>
> Notice the warning that comes up right after you type that in.  Be VERY
> careful.  If for some crazy reason it uninstalls something critical,
> like python, then emerge may not work or worse yet, you could just crash
> and burn.  I suggest looking at the list and making sure anything listed
> can be removed and doing so manually.
>
> Also, run 'revdep-rebuild -i' after words just to be sure.
>
> Dale
>
> :-)  :-)

Thanks!
 
Be sure, I'll want to (manually) unmerge those packages I remember and 
understand what do they do :-)


Andrew



Re: [gentoo-user] world's leaves

2008-08-04 Thread Dale

Andrew Gaydenko wrote:

Hi!

Is there some simple way to find all portage leaves (packages from which 
nothing depends on) of installed world?



Andrew


  


'emerge -p --depclean'  Two dashes before depclean

Notice the warning that comes up right after you type that in.  Be VERY 
careful.  If for some crazy reason it uninstalls something critical, 
like python, then emerge may not work or worse yet, you could just crash 
and burn.  I suggest looking at the list and making sure anything listed 
can be removed and doing so manually.


Also, run 'revdep-rebuild -i' after words just to be sure.

Dale

:-)  :-) 



[gentoo-user] world's leaves

2008-08-04 Thread Andrew Gaydenko
Hi!

Is there some simple way to find all portage leaves (packages from which 
nothing depends on) of installed world?


Andrew