Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

list all packages no other package depends on

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Locked
Advanced search
35 posts
  • 1
  • 2
  • Next
Author
Message
mDup
Apprentice
Apprentice
Posts: 212
Joined: Fri Apr 14, 2006 11:38 pm

list all packages no other package depends on

Post by mDup » Sun Apr 03, 2016 10:58 pm

Is there a command in portage or paludis to list them all?
For example no package depends on xload on my system:

Code: Select all

system ~ # equery d xload
 * These packages depend on xload:
system ~ # 
But can one list all of them at once?
Thanks
Top
kurly
Apprentice
Apprentice
Posts: 260
Joined: Mon Apr 02, 2012 4:47 pm

Post by kurly » Mon Apr 04, 2016 1:21 am

emerge -pc should work, unless I misunderstand your requirements.
Top
mDup
Apprentice
Apprentice
Posts: 212
Joined: Fri Apr 14, 2006 11:38 pm

Post by mDup » Mon Apr 04, 2016 1:29 am

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
Top
dol-sen
Retired Dev
Retired Dev
User avatar
Posts: 2805
Joined: Sun Jun 30, 2002 2:44 pm
Location: Richmond, BC, Canada

Post by dol-sen » Mon Apr 04, 2016 2:42 am

@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...
Top
mDup
Apprentice
Apprentice
Posts: 212
Joined: Fri Apr 14, 2006 11:38 pm

Post by mDup » Mon Apr 04, 2016 2:44 am

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.
Top
The Doctor
Bodhisattva
Bodhisattva
User avatar
Posts: 2678
Joined: Tue Jul 27, 2010 10:56 pm

Post by The Doctor » Mon Apr 04, 2016 3:15 am

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.
Top
mDup
Apprentice
Apprentice
Posts: 212
Joined: Fri Apr 14, 2006 11:38 pm

Post by mDup » Mon Apr 04, 2016 3:19 am

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.
Top
The Doctor
Bodhisattva
Bodhisattva
User avatar
Posts: 2678
Joined: Tue Jul 27, 2010 10:56 pm

Post by The Doctor » Mon Apr 04, 2016 6:37 am

Code: Select all

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.
Top
Irre
Guru
Guru
Posts: 434
Joined: Sat Nov 09, 2013 10:03 am
Location: Stockholm

Post by Irre » Mon Apr 04, 2016 6:58 am

I use this script to remove entries in my world file:

Code: Select all

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
:)
Top
charles17
Advocate
Advocate
Posts: 3686
Joined: Sun Mar 02, 2008 3:20 pm

Post by charles17 » Mon Apr 04, 2016 7:29 am

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: Select all

$ for i in $(cat /var/lib/portage/world); do echo $i && qdepends -Q $i; done
For those not registered in @world, use emerge -ac
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

Post by khayyam » Mon Apr 04, 2016 10:08 am

charles17 wrote:

Code: Select all

$ for i in $(cat /var/lib/portage/world); do echo $i && qdepends -Q $i; done
charles17 ... or the 'demoggified' version ;)

Code: Select all

# 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
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

Post by khayyam » Mon Apr 04, 2016 11:34 am

Irre wrote:

Code: Select all

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: Select all

#!/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
Top
mDup
Apprentice
Apprentice
Posts: 212
Joined: Fri Apr 14, 2006 11:38 pm

Post by mDup » Mon Apr 04, 2016 4:40 pm

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.
Top
1clue
Advocate
Advocate
Posts: 2569
Joined: Sun Feb 05, 2006 3:08 am

Post by 1clue » Mon Apr 04, 2016 5:02 pm

The Doctor wrote:

Code: Select all

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.
Top
charles17
Advocate
Advocate
Posts: 3686
Joined: Sun Mar 02, 2008 3:20 pm

Post by charles17 » Mon Apr 04, 2016 5:12 pm

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: Select all

media-gfx/inkscape
app-office/texmacs-1.99.2-r1
or

Code: Select all

app-arch/p7zip
app-arch/xz-utils-5.2.2
Top
Irre
Guru
Guru
Posts: 434
Joined: Sat Nov 09, 2013 10:03 am
Location: Stockholm

Post by Irre » Mon Apr 04, 2016 8:58 pm

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 ...
Top
VoidMage
Watchman
Watchman
User avatar
Posts: 6196
Joined: Sat Oct 14, 2006 8:43 am

Post by VoidMage » Mon Apr 04, 2016 9:34 pm

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') ?
Top
mDup
Apprentice
Apprentice
Posts: 212
Joined: Fri Apr 14, 2006 11:38 pm

Post by mDup » Tue Apr 05, 2016 12:40 am

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: Select all

% 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: Select all

% 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.
Top
charles17
Advocate
Advocate
Posts: 3686
Joined: Sun Mar 02, 2008 3:20 pm

Post by charles17 » Tue Apr 05, 2016 6:43 am

khayyam wrote:charles17 ... or the 'demoggified' version ;)

Code: Select all

# while read i ; do echo $i ; qdepends -Q $i ; done </var/lib/portage/world
Thanks khay, I am still learning

Code: Select all

# 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: Select all

$ ls -al /var/db/pkg/*
Top
Yamakuzure
Advocate
Advocate
User avatar
Posts: 2323
Joined: Wed Jun 21, 2006 11:06 am
Location: Adendorf, Germany
Contact:
Contact Yamakuzure
Website

Post by Yamakuzure » Tue Apr 05, 2016 6:53 am

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
Top
Yamakuzure
Advocate
Advocate
User avatar
Posts: 2323
Joined: Wed Jun 21, 2006 11:06 am
Location: Adendorf, Germany
Contact:
Contact Yamakuzure
Website

Post by Yamakuzure » Tue Apr 05, 2016 7:22 am

@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
Top
charles17
Advocate
Advocate
Posts: 3686
Joined: Sun Mar 02, 2008 3:20 pm

Post by charles17 » Tue Apr 05, 2016 7:48 am

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?
Top
Yamakuzure
Advocate
Advocate
User avatar
Posts: 2323
Joined: Wed Jun 21, 2006 11:06 am
Location: Adendorf, Germany
Contact:
Contact Yamakuzure
Website

Post by Yamakuzure » Tue Apr 05, 2016 9:31 am

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: Select all

 $ 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
Top
charles17
Advocate
Advocate
Posts: 3686
Joined: Sun Mar 02, 2008 3:20 pm

Post by charles17 » Tue Apr 05, 2016 10:18 am

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: Select all

# 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>.
Top
khayyam
Watchman
Watchman
User avatar
Posts: 6227
Joined: Thu Jun 07, 2012 2:45 am
Location: Room 101

Post by khayyam » Tue Apr 05, 2016 10:30 am

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
Top
Locked

35 posts
  • 1
  • 2
  • Next

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic