rpm-software-management/mock

Provide a new script for introspecting and recording buildroot metadata

Closed this issue · 2 comments

Currently, #1393 uses specific rpm -q --qf and dnf repoquery commands for introspecting the buildroot (useful for later buildroot reproducibility).

It would be nice to have a python tool using the python3-rpm (or python3-dnf) library instead. The tricky part here would be to use the appropriate version of this library -- we must use the RPM stack from bootstrap, not from host or from buildroot, if bootstrap feature is used.

We could have a drop-in executable script, copy-pasted into the bootstrap by Mock and then executed, but such a script will be precedent definitely.

We could have a drop-in executable script, copy-pasted into the bootstrap by Mock and then executed

The experiment would be relatively trivial:

import rpm
if __name__ == '__main__':
    rpm.addMacro("_dbpath", "/var/lib/mock/fedora-rawhide-x86_64-bootstrap/root/var/lib/rpm")
    ts = rpm.ts()
    for h in ts.dbMatch():
        print(h["name"])

It is not common to have python3-rpm installed in bootstrap chroot, though. Especially nowadays when the world is switching towards DNF5.

It feels to me that this isn't the right way (we probably don't want to install python3-rpm into every bootstrap to make this work). Feel free to reopen this if you think otherwise.