2009/4/5 Chris Brannon <cmbrannon@cox.net>:
I wrote this code in anger. Hopefully, others might find it useful. There is a little story behind it.
I maintain the nmh package in unsupported. I just discovered that a package from extra provides /usr/bin/dp, which is also provided by nmh. We have this nice collection of files under /var/cache/pkgtools/lists, thanks to Daenyth's very useful pkgfile tool. We ought to be able to use that collection to detect conflicts like the one I just described. Hence the birth of pkgconflict.
Usage: pkgconflict <PACKAGEFILE>
Source is here: http://members.cox.net/cmbrannon/pkgconflict
If someone else has a better tool for this purpose, I'd love to hear about it!
Enjoy, -- Chris
Thanks for the useful script! But shouldn't this line: known_files[entry] = (repo, package) be known_files[entry].append((repo, package)) and then this check: (repo, package) = known_files[file] could be modified to if len(known_files[file]) > 0: for repo, pkg in known_files[file]: if pkg != pkg_given: print "%s: conflicts %s/%s (%s)" % (pkg_given, repo, pkg, file) Otherwise the previous entry for a file might be overwritten if there are conflicts and the package name specified on the command line occurs *after* the conflicting package name. The case you've described will always work since you're testing against a package from unsupported. -- Abhishek