Investigate using DNF excludepkgs config option instead of repository metadata modification #5

Closed
opened 2025-11-19 22:52:11 +00:00 by AdamWill · 3 comments
AdamWill commented 2025-11-19 22:52:11 +00:00 (Migrated from codeberg.org)

In the DNF docs I found the excludepkgs repo config setting, which we may be able to use instead of doing repository modification. The logic of rmdepcheck would remain the same, but instead of all the snazzy/terrifying XML editing stuff, to 'modify' the base repo(s) all we'd do is set the excludepkgs config option appropriately (at runtime, with --setopt, I guess).

In [the DNF docs](https://dnf.readthedocs.io/en/latest/conf_ref.html) I found the `excludepkgs` repo config setting, which we *may* be able to use instead of doing repository modification. The logic of rmdepcheck would remain the same, but instead of all the snazzy/terrifying XML editing stuff, to 'modify' the base repo(s) all we'd do is set the `excludepkgs` config option appropriately (at runtime, with `--setopt`, I guess).
Owner

I haven't actually tried this yet, but I thought about it while revising the XML parser, and it occurred to me that it's not totally simple, because we still need to do the 'what binary packages are built from this SRPM?' thing. Five minutes thinking about it gave me this:

dnf --repofrompath=test,https://kojipkgs.fedoraproject.org/repos/epel9-build/latest/x86_64/ --repo=test repoquery --queryformat="%{source_name},%{full_nevra}\n"

which runs very fast and is probably usable. I'm not sure if excludepkgs allows excluding by NEVRA as opposed to name, though. Excluding by name is technically not quite correct, I think - it's theoretically possible (I think) for a repo to contain multiple packages with the same name but different source RPMs. It might be practically OK to just go with --queryformat="%{source_name},%{name}\n" and exclude by name, though, for real-world cases...not 100% sure.

I haven't actually tried this yet, but I thought about it while revising the XML parser, and it occurred to me that it's not *totally* simple, because we still need to do the 'what binary packages are built from this SRPM?' thing. Five minutes thinking about it gave me this: ``` dnf --repofrompath=test,https://kojipkgs.fedoraproject.org/repos/epel9-build/latest/x86_64/ --repo=test repoquery --queryformat="%{source_name},%{full_nevra}\n" ``` which runs very fast and is probably usable. I'm not sure if `excludepkgs` allows excluding by NEVRA as opposed to name, though. Excluding by name is *technically* not quite correct, I think - it's theoretically possible (I think) for a repo to contain multiple packages with the same name but different source RPMs. It might be practically OK to just go with `--queryformat="%{source_name},%{name}\n"` and exclude by name, though, for real-world cases...not 100% sure.
Owner

oooh, looks like excluding by NVR does work:

[adamw@toolbx fedora-toolbox-43 dnf5 (main %)]$ dnf --repofrompath=test,https://kojipkgs.fedoraproject.org/repos/epel9-build/latest/x86_64/ --repo=test repoquery --info zxing-cpp
Updating and loading repositories:
Repositories loaded.
Name           : zxing-cpp
Epoch          : 0
Version        : 1.2.0
Release        : 1.el9
Architecture   : x86_64
Download size  : 627.4 KiB
Installed size : 1.2 MiB
Source         : zxing-cpp-1.2.0-1.el9.src.rpm
Repository     : test
Summary        : C++ port of the ZXing ("Zebra Crossing") barcode scanning library
URL            : https://github.com/nu-book/zxing-cpp
License        : LGPLv2 with exceptions or LGPLv3 with exceptions
Description    : ZXing-C++ ("zebra crossing") is an open-source, multi-format 1D/2D barcode
               : image processing library implemented in C++.
Vendor         : Fedora Project

[adamw@toolbx fedora-toolbox-43 dnf5 (main %)]$ dnf --setopt excludepkgs=zxing-cpp-0:1.2.0-1.el9.x86_64 --repofrompath=test,https://kojipkgs.fedoraproject.org/repos/epel9-build/latest/x86_64/ --repo=test repoquery --info zxing-cpp
Updating and loading repositories:
Repositories loaded.
[adamw@toolbx fedora-toolbox-43 dnf5 (main %)]$ 

so...I think this may be viable. Hmmmm.

oooh, looks like excluding by NVR does work: ``` [adamw@toolbx fedora-toolbox-43 dnf5 (main %)]$ dnf --repofrompath=test,https://kojipkgs.fedoraproject.org/repos/epel9-build/latest/x86_64/ --repo=test repoquery --info zxing-cpp Updating and loading repositories: Repositories loaded. Name : zxing-cpp Epoch : 0 Version : 1.2.0 Release : 1.el9 Architecture : x86_64 Download size : 627.4 KiB Installed size : 1.2 MiB Source : zxing-cpp-1.2.0-1.el9.src.rpm Repository : test Summary : C++ port of the ZXing ("Zebra Crossing") barcode scanning library URL : https://github.com/nu-book/zxing-cpp License : LGPLv2 with exceptions or LGPLv3 with exceptions Description : ZXing-C++ ("zebra crossing") is an open-source, multi-format 1D/2D barcode : image processing library implemented in C++. Vendor : Fedora Project [adamw@toolbx fedora-toolbox-43 dnf5 (main %)]$ dnf --setopt excludepkgs=zxing-cpp-0:1.2.0-1.el9.x86_64 --repofrompath=test,https://kojipkgs.fedoraproject.org/repos/epel9-build/latest/x86_64/ --repo=test repoquery --info zxing-cpp Updating and loading repositories: Repositories loaded. [adamw@toolbx fedora-toolbox-43 dnf5 (main %)]$ ``` so...I think this may be viable. Hmmmm.
adamwill added this to the Sprint 7 project 2026-04-20 19:26:04 +00:00
Owner

#32 is merged.

#32 is merged.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
quality/rmdepcheck#5
No description provided.