Support operating on source repos (#10)
So I happened to find another reason to work on #10 - it's useful for figuring out the consequences of dropping a package: quality/tickets#880 (comment) The good news is, this turns out to be easy. We only need a small change to the repository modification code to handle source repos, where the package entries don't specifiy a sourcerpm - we just take the package name. We identify this case by looking at the package arch; if it's "src" we just take the name, if it's anything else we use the existing approach. With this change, you can just include the appropriate source repository as a base repository, and otherwise use rmdepcheck just the same. e.g. this command tests what happens if you drop the python-pytest-xprocess package from F44: ./rmdepcheck.py --removes https://dl.fedoraproject.org/pub/fedora/linux/development/44/Everything/x86_64/os/,https://dl.fedoraproject.org/pub/fedora/linux/development/44/Everything/source/tree/ python-pytest-xprocess You can see it works because there are results for .src packages from the source repo; these are build dependencies. If you run the same command without the source repo you get a smaller set of results covering only the runtime dependencies. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
e6092ee687
commit
e38e57c7ef
1 changed files with 6 additions and 2 deletions
|
|
@ -153,8 +153,12 @@ def replace_primary(primfn: str, removes: Iterable[str]) -> tuple[str, int, str,
|
|||
primtree = et.parse(primfn)
|
||||
primroot = primtree.getroot()
|
||||
for pkg in primroot.findall("common:package", XMLNS):
|
||||
srpm = mfind(mfind(pkg, "common:format", XMLNS), "rpm:sourcerpm", XMLNS).text
|
||||
if srpm and srpm.rsplit("-", 2)[0] in removes:
|
||||
if mfind(pkg, "common:arch", XMLNS).text == "src":
|
||||
spkg = mfind(pkg, "common:name", XMLNS).text
|
||||
else:
|
||||
srpm = mfind(mfind(pkg, "common:format", XMLNS), "rpm:sourcerpm", XMLNS).text
|
||||
spkg = srpm.rsplit("-", 2)[0]
|
||||
if spkg and spkg in removes:
|
||||
primroot.remove(pkg)
|
||||
|
||||
tempfn = f"{rddir}/primtemp.xml"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue