Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Portage Dependency Tracing
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
watersb
Apprentice
Apprentice


Joined: 04 Sep 2002
Posts: 297
Location: take a left turn in Tesuque

PostPosted: Fri Apr 11, 2003 7:00 am    Post subject: Portage Dependency Tracing Reply with quote

You have just typed emerge -pu --deep world and all this stuff appears -- wow! You might ask:

What are all those pacakages for? Try emerge search <pkgname>

Why does it want to install a particular package? That is, where is a particular pacakge's dependency coming from?

This tip suggests a technique for dealing with the second question - where is the dependency for a package coming from?

For a third question -- Geez, do I have to install all this right now? -- you can find out how to defer unwanted packages during an "emerge -pu world", with this excellent tip.

I use the qpkg tool that is part of gentoolkit. But qpkg does not always help me...

You can dump a list of all currently-installed packages in a number of ways; one is to perform "emerge -pe world". The one that I use is to dump all entries in /var/db/pkg to a text file, like this:

Code:

# cd /var/dg/pkg
# find . -type d -mindepth 2 | sort > /tmp/packages-installed


Tonight I've been using this in conjunction with a little script that searches the package deps for entries:
Code:

#! /bin/bash

cd /var/cache/edb/dep
find . -type f | xargs grep -l $1 | sort > /tmp/pkgs-depending-on-$1


This gives a listing of all the dependencies for every package that is currently in portage, I think; anyway there are way more things in there than I have installed. And note that this will grab anything that matches lexically; that is, by package name.

Save this script in a file called "pkgdep", and then call it like:

Code:

$ pkg-dep pilot-link
$ cat /tmp/pkfs-depending-on-pilot-link


To answer a question like, "Why is package X getting added?", I've been doing cross-comparisons, searching through all the deps for package X against all of my currently-installed packages:

Code:

for pkg in `cat /tmp/packages-installed`
do
 grep $pkg /tmp/pkgs-depending-on-pilot-link
done


Using this technique is geared towards giving you false-positives; matches occur lexically, and may not be meaningul. I do this because I find that qpkg does not always give me results that I need; I'll read up on qpkg more...

Anyway, I have found this technique useful for sussing out package dependencies, and maybe it will help.
Back to top
View user's profile Send private message
mattsteven
Apprentice
Apprentice


Joined: 27 Oct 2003
Posts: 240
Location: Your Planet

PostPosted: Sun Jul 04, 2004 4:54 pm    Post subject: Nicely done, this is very useful when bundled into a sin Reply with quote

this is very useful for solving the "why are all these unneccesary packages being installed" problem when bundled into a single script!

Code:

#!/bin/bash

if [ ! $1 ] ; then
        echo "Usage:  $0 packagename"
        exit 1
fi

if [ ! -f /tmp/packages-installed ] ; then
        cd /var/db/pkg
        find . -type d -mindepth 2 | sort > /tmp/packages-installed
fi

cd /var/cache/edb/dep/
find . -type f | xargs grep -l $1 | sort > /tmp/pkgs-depending-on-$1

for pkg in `cat /tmp/packages-installed`
do
        grep $pkg /tmp/pkgs-depending-on-$1
done


_________________
Matthew Steven
Linux-only desktop since 1998
Graying hair since 2006
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