I am trying to determine what packages are actually in use on my
system and which are not[1].  A basic requirement of doing such is to
figure out which packages are required by other packages and look at
the packages that have no dependants first.

I thought the following little few lines of bash would do it:

rpm -qa | sed -e 's/-[0-9.]*-.*//' | while read pkg;
do
    echo -e "$pkg: \c ";
    rpm -q --whatrequires $pkg | tr "\n" " ";
    echo;
done | grep "no package requires"

and I do get lots of packages but when they are libs (just what I am
targeting first) most of them have implicit dependancies on the libs
contained in them.  For instance:

libgd1: no package requires libgd1 
# rpm -e libgd1
error: removing these packages would break dependencies:
    libgd.so.1   is needed by gnuplot-3.7.1-22mdk
    libgd.so.1   is needed by linuxconf-1.26r5-1mdk

This happens _a_lot_.

Ideas?

b.

1.  with the MDK library naming policy this becomes a requirement
    because as a new version of a library becomes more and more used
    by other packages on the system, the old library hangs around and
    eventually becomes unused.


-- 
Brian J. Murrell

Reply via email to