[Yum] Yum/rpm dependency list

Jason Kim jkim at advance.net
Tue Apr 26 21:20:10 UTC 2005


On Monday 25 April 2005 21:51, Greg Knaddison wrote:
> I don't think that finding the dependencies of the original packages
> is the best way of attacking this problem.
>
> I think that you might have better luck looking at the install.log and
> install.log.syslog and /var/log/yum.log
>

Thanks, but that sounds a bit unwieldy/error prone to me. I'm basically trying 
to implement a system where I define (somewhere in a central location) the 
set of files that a machine _should_ have (ideally by keeping a list of 
groups- say 'base, core, admin-tools, my-websrv-pkgs') and somehow verify it. 
I'd rather not rely on anything other than the currently installed rpm db and 
the dependency/group info from my yum repositories. That way, no matter how 
the groups change (if I remove 'php' from 'my-websrv-pkgs', for instance), or 
who installs what on a system (another SA installs ImageMagick for a custom 
app, but forgets to record it), I'll know exactly what the difference is and 
how to fix it.

I could just keep a list of currently installed rpms and diff, but in the case 
of removing php above, this may result in having cruft left in the list- 
package 'foo', which 'php' relies on, and possibly package 'bar' that 'foo' 
relied on, etc... After a few changes who knows how many unneeded packages 
would be left behind?

So far I've found the following really slow, hacky way of doing it:
diff <(mkdir -p /tmp/temproot ; rpm --root /tmp/temproot --initdb ; rpm
--root /tmp/temproot --import RPM-GPG-KEY ; mkdir -p
/tmp/temproot/var/cache/yum ; echo n | yum --installroot=/tmp/temproot -d
1 groupinstall base core | grep Install: | awk '{print $2}' | sed -e
's/\.[^\.]*//' | sort ; rm -rf /tmp/temproot) <(rpm -qa --qf '%{Name}\n' |
sort)

Clearly not the best way. I've been poking around the yum code hoping to find 
a nifty function that did something like:
  'full_pkg_list = ResolveDependencies(requested_pkg_list'
but it seems to be a lot more complicated than that.

So anyway, if anyone could help out I'd be very appreciative :)

-JayKim



More information about the Yum mailing list