View previous topic :: View next topic |
Author |
Message |
mDup Apprentice

Joined: 14 Apr 2006 Posts: 212
|
Posted: Sun Apr 03, 2016 10:58 pm Post subject: list all packages no other package depends on |
|
|
Is there a command in portage or paludis to list them all?
For example no package depends on xload on my system:
Code: | system ~ # equery d xload
* These packages depend on xload:
system ~ #
|
But can one list all of them at once?
Thanks |
|
Back to top |
|
 |
kurly Apprentice

Joined: 02 Apr 2012 Posts: 260
|
Posted: Mon Apr 04, 2016 1:21 am Post subject: |
|
|
emerge -pc should work, unless I misunderstand your requirements. |
|
Back to top |
|
 |
mDup Apprentice

Joined: 14 Apr 2006 Posts: 212
|
Posted: Mon Apr 04, 2016 1:29 am Post subject: |
|
|
kurly wrote: | emerge -pc should work, unless I misunderstand your requirements. |
'emerge -pc' does not mention 'xload' (which no package depends upon)
If I add --verbose I spot:
x11-apps/xload-1.1.2 pulled in by:
@selected requires x11-apps/xload |
|
Back to top |
|
 |
dol-sen Retired Dev


Joined: 30 Jun 2002 Posts: 2805 Location: Richmond, BC, Canada
|
Posted: Mon Apr 04, 2016 2:42 am Post subject: |
|
|
@selected means it is pulled in by the world file or the profile, (most probably the world file)
You can manually look over your world file and do some house cleaning, then running the -pc options will likely find some packages to clean. _________________ Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch... |
|
Back to top |
|
 |
mDup Apprentice

Joined: 14 Apr 2006 Posts: 212
|
Posted: Mon Apr 04, 2016 2:44 am Post subject: |
|
|
dol-sen wrote: | @selected means it is pulled in by the world file or the profile, (most probably the world file)
You can manually look over your world file and do some house cleaning, then running the -pc options will likely find some packages to clean. |
But world is what I have. I ask what I have but no other package needs.
Agreed, I may have an ftp server package and no other package needs it. But I may need it (if I run an ftp server).
Conversely several years ago one may have emerged 'fubar' which
looked fun and then one forgot forever. But 'fubar' holds on
dependencies one really does not want anymore. And sure one does no longer
need funny 'fubar'.
Listing packages no other package depends upon would attract ones
attention to 'fubar' which for sure one would unmerge. And, next, its
dependencies.
Point is: if no package depends on a package, that's the one I want to quickly see.
Of course one can do 'equery d $p' for every $p one has (perhaps >3000) and inspect output.
The suggestion to inspect a, say, >3000 line file is exactly what I would want to avoid if a single command can limit it to, say, 500, or, hopefully, less.
Last edited by mDup on Mon Apr 04, 2016 3:44 am; edited 3 times in total |
|
Back to top |
|
 |
The Doctor Moderator


Joined: 27 Jul 2010 Posts: 2678
|
Posted: Mon Apr 04, 2016 3:15 am Post subject: |
|
|
I think you best tool for that is going to be to use less to look at /var/lib/portage/world and find the packages you personally don't think are necessary. For example, if widelands is the world file but you don't have a clue what it is then you can emerge --deslelect it and then you can run emerge -pc and see what gets freed up.
This is good maintenance to do anyway. _________________ First things first, but not necessarily in that order.
Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box. |
|
Back to top |
|
 |
mDup Apprentice

Joined: 14 Apr 2006 Posts: 212
|
Posted: Mon Apr 04, 2016 3:19 am Post subject: |
|
|
The Doctor wrote: | I think you best tool for that is going to be to use less to look at /var/lib/portage/world and find the packages you personally don't think are necessary. For example, if widelands is the world file but you don't have a clue what it is then you can emerge --deslelect it and then you can run emerge -pc and see what gets freed up.
This is good maintenance to do anyway. |
It is good maintenance, I agree, but some help from tools themselves would be great to spot widelands in a set of <500 as opposed to >3000 possibilities.
fwiw: I do a lot of maintenance and that is why question arises. My 'server', after 10 years, no longer serves 'media' so I want to get rid of 'media' packages. Not to speak about 'use' aspects, but those I have under control.
So, really: conveniently tell me which packages no other package depends upon. |
|
Back to top |
|
 |
The Doctor Moderator


Joined: 27 Jul 2010 Posts: 2678
|
Posted: Mon Apr 04, 2016 6:37 am Post subject: |
|
|
Code: | wc -l /var/lib/portage/world
143 /var/lib/portage/world | If your world file has more than 500 packages in it you have a serous problem and with more than 3000 your plight would be desperate. _________________ First things first, but not necessarily in that order.
Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box. |
|
Back to top |
|
 |
Irre Guru

Joined: 09 Nov 2013 Posts: 434 Location: Stockholm
|
Posted: Mon Apr 04, 2016 6:58 am Post subject: |
|
|
I use this script to remove entries in my world file: Code: | localhost Desktop # cat ../cleanup.sh
for i in `cat /var/lib/portage/world`
do
if emerge -p --depclean $i | grep "These are the packages that would be unmerged:">null
then echo $i >>/var/lib/portage/world-new
else echo "removing:" $i
fi
done
mv /var/lib/portage/world /var/lib/portage/world-previous
mv /var/lib/portage/world-new /var/lib/portage/world |  |
|
Back to top |
|
 |
charles17 Advocate

Joined: 02 Mar 2008 Posts: 3686
|
Posted: Mon Apr 04, 2016 7:29 am Post subject: |
|
|
mDup wrote: | Of course one can do 'equery d $p' for every $p one has (perhaps >3000) and inspect output. |
Use qdepends instead of equery. It is much faster. Code: | $ for i in $(cat /var/lib/portage/world); do echo $i && qdepends -Q $i; done |
For those not registered in @world, use emerge -ac |
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Mon Apr 04, 2016 10:08 am Post subject: |
|
|
charles17 wrote: | Code: | $ for i in $(cat /var/lib/portage/world); do echo $i && qdepends -Q $i; done |
|
charles17 ... or the 'demoggified' version ;)
Code: | # while read i ; do echo $i ; qdepends -Q $i ; done </var/lib/portage/world |
mDup wrote: | Agreed, I may have an ftp server package and no other package needs it. But I may need it (if I run an ftp server). Conversely several years ago one may have emerged 'fubar' which looked fun and then one forgot forever. But 'fubar' holds on dependencies one really does not want anymore. And sure one does no longer need funny 'fubar'. |
@mDup ... I'm really having difficulty undertsanding your problem, both the ftp server and 'fubar' are in the world file, and all you need do is look and ask yourself "why do I have {x}", sure you could check every installed package looking for those that aren't a dependency of some other package, but isn't that effectively what the world file is (or should be, assuming the correct use of --oneshot)?
best ... khay |
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Mon Apr 04, 2016 11:34 am Post subject: |
|
|
Irre wrote: | Code: | for i in `cat /var/lib/portage/world`
do
if emerge -p --depclean $i | grep "These are the packages that would be unmerged:">null
then echo $i >>/var/lib/portage/world-new
else echo "removing:" $i
fi
done
mv /var/lib/portage/world /var/lib/portage/world-previous
mv /var/lib/portage/world-new /var/lib/portage/world |
|
Irre ... the following would remove the requirement for grep, and cat, and so be a little leaner.
Code: | #!/bin/sh
while read i ; do
if [ -n "$(emerge -pq --depclean $i)" ]; then
echo $i >>/var/lib/portage/world-new
else
echo "removing:" $i
fi
done </var/lib/portage/world
if [ -f /var/lib/portage/world-new ]; then
mv /var/lib/portage/world /var/lib/portage/world-previous ;
mv /var/lib/portage/world-new /var/lib/portage/world
fi |
best ... khay |
|
Back to top |
|
 |
mDup Apprentice

Joined: 14 Apr 2006 Posts: 212
|
Posted: Mon Apr 04, 2016 4:40 pm Post subject: |
|
|
I have ~3000 lines in world indeed and they correctly correspond to installed (non system) packages.
1) emerge -p --depclean <package> is slow (may take a few days)
2) qdepend -Q <package> is fast (and done)
I'll compare what both report as having nothing depend on <package> when all ~3000 <package>s are done. |
|
Back to top |
|
 |
1clue Advocate

Joined: 05 Feb 2006 Posts: 2569
|
Posted: Mon Apr 04, 2016 5:02 pm Post subject: |
|
|
The Doctor wrote: | Code: | wc -l /var/lib/portage/world
143 /var/lib/portage/world | If your world file has more than 500 packages in it you have a serous problem and with more than 3000 your plight would be desperate. |
Wow.
My world file has 44 lines, and I spotted one in there I don't need.
IMO you should only add specific apps you need into your world file, not things you know those apps need. For example, if you need mysql then add that rather than any dependencies.
Generally speaking since I started doing this I have had fewer problems with dependencies overall than I did before.
Last edited by 1clue on Mon Apr 04, 2016 5:27 pm; edited 1 time in total |
|
Back to top |
|
 |
charles17 Advocate

Joined: 02 Mar 2008 Posts: 3686
|
Posted: Mon Apr 04, 2016 5:12 pm Post subject: |
|
|
mDup wrote: | I'll compare what both report as having nothing depend on <package> when all ~3000 <package>s are done. |
Amongst many real dependencies it could show some cases like these where inkscape and p7zip need to stay listed in /var/lib/portage/world or otherwise would get removed on next emerge -ac.
Code: | media-gfx/inkscape
app-office/texmacs-1.99.2-r1 | or Code: | app-arch/p7zip
app-arch/xz-utils-5.2.2 |
|
|
Back to top |
|
 |
Irre Guru

Joined: 09 Nov 2013 Posts: 434 Location: Stockholm
|
Posted: Mon Apr 04, 2016 8:58 pm Post subject: |
|
|
khayyam wrote: | Irre ... the following would remove the requirement for grep, and cat, and so be a little leaner.
| Thank you for this leaner cleaner ... |
|
Back to top |
|
 |
VoidMage Watchman


Joined: 14 Oct 2006 Posts: 6196
|
Posted: Mon Apr 04, 2016 9:34 pm Post subject: |
|
|
To extend the original question, how would you go about a case, when the potential candidates for removal are leaves, but aren't listed in world (for example being results of a long forgotten 'emerge -1o') ? |
|
Back to top |
|
 |
mDup Apprentice

Joined: 14 Apr 2006 Posts: 212
|
Posted: Tue Apr 05, 2016 12:40 am Post subject: |
|
|
VoidMage wrote: | To extend the original question, how would you go about a case, when the potential candidates for removal are leaves, but aren't listed in world (for example being results of a long forgotten 'emerge -1o') ? |
Good question
well ... contrary to other people habits I do not remove anything from world.
Ideally world for me is all I have installed.
In fact sometimes I do:
Code: |
% equery l '*' --format='$cp' | cat | sort | uniq > tmp/equery.l.do
% \cp -p /var/lib/portage/world tmp/world.orig
% \cp -p tmp/equery.l.do /var/lib/portage/world
|
so the case you mention I do not run into.
fwiw above is not something I recommend.
In fact, I do clean up world sometimes by removing colons
Code: |
% cat /var/lib/portage/world | cut -d: -f1 | uniq > xxx
% \mv xxx /var/lib/portage/world
|
also something I do not recommend either. Because that hides some slots.
But I have other ways to handle that. |
|
Back to top |
|
 |
charles17 Advocate

Joined: 02 Mar 2008 Posts: 3686
|
Posted: Tue Apr 05, 2016 6:43 am Post subject: |
|
|
khayyam wrote: | charles17 ... or the 'demoggified' version
Code: | # while read i ; do echo $i ; qdepends -Q $i ; done </var/lib/portage/world |
|
Thanks khay, I am still learning Code: | # while read i ; do if [ -n "$(qdepends -Q $i)" ]; then emerge --deselect $i ; fi; done < /var/lib/portage/world |
mDup wrote: | well ... contrary to other people habits I do not remove anything from world.
Ideally world for me is all I have installed. |
Polluting /var/lib/portage/world may cause trouble in dependency resolution when updating your system.
For everthing you have installed you could check /var/db/pkg/ Code: | $ ls -al /var/db/pkg/* |
|
|
Back to top |
|
 |
Yamakuzure Advocate


Joined: 21 Jun 2006 Posts: 2312 Location: Adendorf, Germany
|
Posted: Tue Apr 05, 2016 6:53 am Post subject: |
|
|
If you have emerged something manually with --oneshot, and nothing depends on it, --depclean will try to remove it, won't it? _________________ Edited 220,176 times by Yamakuzure |
|
Back to top |
|
 |
Yamakuzure Advocate


Joined: 21 Jun 2006 Posts: 2312 Location: Adendorf, Germany
|
Posted: Tue Apr 05, 2016 7:22 am Post subject: |
|
|
@charles: There is a very big problem with trying to use qdepends like this:
It lists all packages that depend on the package you check, but this includes packages that are *not* in your world file.
So if all packages depending on foo/bar are dependencies themselves and not listed in the world file, removing foo/bar from world will result in --depclean wanting to remove *all* of them! _________________ Edited 220,176 times by Yamakuzure |
|
Back to top |
|
 |
charles17 Advocate

Joined: 02 Mar 2008 Posts: 3686
|
Posted: Tue Apr 05, 2016 7:48 am Post subject: |
|
|
Yamakuzure wrote: | So if all packages depending on foo/bar are dependencies themselves and not listed in the world file, removing foo/bar from world will result in --depclean wanting to remove *all* of them! |
Wouldn't --depclean remove them even with foo/bar kept in world? |
|
Back to top |
|
 |
Yamakuzure Advocate


Joined: 21 Jun 2006 Posts: 2312 Location: Adendorf, Germany
|
Posted: Tue Apr 05, 2016 9:31 am Post subject: |
|
|
charles17 wrote: | Yamakuzure wrote: | So if all packages depending on foo/bar are dependencies themselves and not listed in the world file, removing foo/bar from world will result in --depclean wanting to remove *all* of them! |
Wouldn't --depclean remove them even with foo/bar kept in world? | Not for circular dependencies. Example: Code: | $ qdepends -Q media-video/avidemux # <-- in world file
media-libs/avidemux-plugins-2.6.8
media-libs/avidemux-core-2.6.8
$ qdepends -Q media-libs/avidemux-core
media-libs/avidemux-plugins-2.6.8
media-video/avidemux-2.6.8 # <-- in world file | So if you --deselect media-video/avidemux, because two packages depend on it, --depclean will remove all three
I just tried it, that's how I found out.  _________________ Edited 220,176 times by Yamakuzure |
|
Back to top |
|
 |
charles17 Advocate

Joined: 02 Mar 2008 Posts: 3686
|
Posted: Tue Apr 05, 2016 10:18 am Post subject: |
|
|
Yamakuzure wrote: | So if you --deselect media-video/avidemux, because two packages depend on it, --depclean will remove all three
I just tried it, that's how I found out.  |
Circular dependencies are a problem in general. But how many of such cases are there in emerge --depclean -p after running
Code: | # while read i ; do if [ -n "$(qdepends -Q $i)" ]; then emerge --deselect $i ; fi; done < /var/lib/portage/world |
Those could be easily re-added using emerge --ask --noreplace <atom>. |
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Tue Apr 05, 2016 10:30 am Post subject: |
|
|
Yamakuzure ... I'm having difficulty understanding your point here ...
Yamakuzure wrote: | There is a very big problem with trying to use qdepends like this: It lists all packages that depend on the package you check, but this includes packages that are *not* in your world file. |
The packages in world are checked to see if they are dependent, or independent.
Yamakuzure wrote: | So if all packages depending on foo/bar are dependencies themselves and not listed in the world file, removing foo/bar from world will result in --depclean wanting to remove *all* of them! |
I really don't get this, if foo/bar (a dependency of some other package) is removed from world then the package apon which it is a dependency still exists in world, no? If it were 'independent' of any dep then removing it from world would cause its dependencies to be selected by --depclean, but the fact that it is a dependency means it is a dependency of some 'independent' package in world.
That said, and reviewing the above code snippits I provided above, I'm not sure the above test is correct, and so I'd be hesitant to suggest '--deselect' without properly checking what the code does (and currently I'm busy with other things).
edit: just saw your example ... and am chewing on it :)
best ... khay |
|
Back to top |
|
 |
|