Re: looking for command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2004-02-25 at 21:03, Brad Wyman wrote:
> I'd love to find the equivalent of urpmi_rpm-find-leaves for redhat.
> any ideas?

I suppose that means "leafnodes" eg packages which no other package
requires? If so the attached python script should do the trick.

	- Panu -

----

#!/usr/bin/python

import rpm

ts = rpm.TransactionSet()

req = {}
orphan = []

for h in ts.dbMatch('name'):
	name = h['name']
	if not h[rpm.RPMTAG_REQUIRENAME]:
		continue
	for r in h[rpm.RPMTAG_REQUIRENAME]:
		req[r] = name

for h in ts.dbMatch('name'):
	name = h['name']
	preq = 0
	for p in h[rpm.RPMTAG_PROVIDES] + h[rpm.RPMTAG_FILENAMES]:
		if req.has_key(p):
			preq = preq + 1

	if preq == 0:
		orphan.append(name)

orphan.sort()
for p in orphan:
	print p




_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux