* [gentoo-user] world's leaves
@ 2008-08-05 2:58 Andrew Gaydenko
2008-08-05 3:14 ` Dale
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Gaydenko @ 2008-08-05 2:58 UTC (permalink / raw
To: gentoo-user
Hi!
Is there some simple way to find all portage leaves (packages from which
nothing depends on) of installed world?
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] world's leaves
2008-08-05 2:58 [gentoo-user] world's leaves Andrew Gaydenko
@ 2008-08-05 3:14 ` Dale
2008-08-05 3:43 ` Andrew Gaydenko
0 siblings, 1 reply; 6+ messages in thread
From: Dale @ 2008-08-05 3:14 UTC (permalink / raw
To: gentoo-user
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
:-) :-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] world's leaves
2008-08-05 3:14 ` Dale
@ 2008-08-05 3:43 ` Andrew Gaydenko
2008-08-05 4:03 ` Dale
2008-08-05 12:06 ` Albert Hopkins
0 siblings, 2 replies; 6+ messages in thread
From: Andrew Gaydenko @ 2008-08-05 3:43 UTC (permalink / raw
To: gentoo-user
======= 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] world's leaves
2008-08-05 3:43 ` Andrew Gaydenko
@ 2008-08-05 4:03 ` Dale
2008-08-06 17:08 ` Alan McKinnon
2008-08-05 12:06 ` Albert Hopkins
1 sibling, 1 reply; 6+ messages in thread
From: Dale @ 2008-08-05 4:03 UTC (permalink / raw
To: gentoo-user
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 <package name>. 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 <package
name> and equery depends <package name>.
Dale
:-) :-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] world's leaves
2008-08-05 3:43 ` Andrew Gaydenko
2008-08-05 4:03 ` Dale
@ 2008-08-05 12:06 ` Albert Hopkins
1 sibling, 0 replies; 6+ messages in thread
From: Albert Hopkins @ 2008-08-05 12:06 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
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
[-- Attachment #2: auditworld --]
[-- Type: text/x-python, Size: 1875 bytes --]
#!/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()
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-user] world's leaves
2008-08-05 4:03 ` Dale
@ 2008-08-06 17:08 ` Alan McKinnon
0 siblings, 0 replies; 6+ messages in thread
From: Alan McKinnon @ 2008-08-06 17:08 UTC (permalink / raw
To: gentoo-user
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 <package name>. 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-08-06 18:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-05 2:58 [gentoo-user] world's leaves Andrew Gaydenko
2008-08-05 3:14 ` Dale
2008-08-05 3:43 ` Andrew Gaydenko
2008-08-05 4:03 ` Dale
2008-08-06 17:08 ` Alan McKinnon
2008-08-05 12:06 ` Albert Hopkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox