[PLUG] Re: rpm dependency tree

Larry Brigman larry.brigman at gmail.com
Wed Dec 29 07:58:48 UTC 2004


On Tue, 28 Dec 2004 19:07:31 -0800, Wil Cooley <wcooley at nakedape.cc> wrote:
> On Tue, 28 Dec 2004 14:14:50 -0800, Larry Brigman wrote:
> 
> > I'm looking for a simple way to display the total rpm database with it's
> > dependencies in a tree for existing packages on a system.
> >
> > The output should be text.
> >
> > The reason for this is I have a custom distro that is too big.  I need it
> > to fit on a 256mb compact flash card but still have the capabilities I
> > need.
> >
> > The search of google shows lots of discussions but no real tools to do
> > this.
> >
> > I would like to do this on the existing system. The major scripting tools
> > on it are bash and python.
> 
> Try this:
> 
> #################
> #!/bin/bash
> #
> # rpmdeptree - Script to generate a list of dependencies for requested
> # packages.  (Pass -a for all.)
> #
> # Written by Wil Cooley <wcooley at nakeedape.cc>
> 
> for rpm in $(rpm -q $@|sort); do
>     printf 'Package: %-67s {{{\n' ${rpm}
>     for prov in $(rpm -q --provides ${rpm}|cut -f1 -d' '|sort|uniq); do
>         printf '  Provides: %s\n' ${prov}
>         rpm -q --whatrequires --queryformat \
>             '    Req by: %-20{NAME} %{SUMMARY}\n' ${prov}| \
>             awk '!/no package requires/ { print }
>                 /no package requires/ { print "    Req by: (none)" }'|sort
>     done
>     printf "}}}\n"
> done
> 
> printf "# %s:foldmethod=marker" "vim"
> #################
> 
> It's slow, but I think it gives you what you want.  Okay, here's the fun
> part--if you redirect the output to a file:
> 
> rpmdeptree -a > rpm-deps.txt
> 
> Then use Vim to view it, it will fold each Package section so you can more
> easily scan the list; it'll also tell you how many lines are in the fold,
> so you can get an idea of how many provides and dependencies there are.
> Use 'zo' and 'zc' to open and close the folds.
> 
> Wil

This works (boy, is it slow).  Not exactly what I expected but 
reading it through show me why it is so slow.

Neat option on the folding but the system I am running on doesn't have
vim.

Thanks
Larry



More information about the PLUG mailing list