[Rpm-ecosystem] python-dnf question: installed vs. available checksums

Ian Pilcher arequipeno at gmail.com
Wed Aug 2 15:52:45 UTC 2017

I would like to the the DNF API (python-dnf) to determine the source
repository for the packages that are installed on a system.  (I am aware
that this is not necessarily possible for every package, but it should
be possible for the vast majority of packages on an up-to-date system.)

It is straightforward to iterate through the installed packages and
search for matching packages in a sack that was filled with
fill_sack(load_system_repo=False, load_available_repos=True) --
filtering on either NVRA or NEVRA.

If possible, I would like to take the further step of validating that
checksum of the installed package matches that of any available
packages.  However, I'm having trouble figuring out how to do this.  It
seems that installed packages have only a hdr_chksum attribute while
available packages have only a chksum attribute.  (Attempting to read
the hdr_chksum of an available package or the chksum attribute of an
installed packages raises a "No such checksum" AttributeError.

Is the NVRA/NEVRA match the best that can be done?

Ian Pilcher                                         arequipeno at gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------

More information about the Rpm-ecosystem mailing list