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

Jaroslav Mracek jmracek at redhat.com
Fri Aug 4 11:16:30 UTC 2017

I see a possible solution:

a = base.sack.query().filter(name='TestA')
for pkg in a:
    if pkg.installed:
        yumdb_info = base._yumdb.get_package(pkg)
        print(yumdb_info.checksum_type, yumdb_info.checksum_data)
            type, checksum = pkg.returnIdSum()
            print(type, checksum)
        except AttributeError:

But it uses private object _yumdb. In near future we will replace it with SWDB.

Have a nice time


On Wed, Aug 2, 2017 at 5:52 PM, Ian Pilcher <arequipeno at gmail.com> wrote:

> 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" --------
> ========================================================================
> _______________________________________________
> Rpm-ecosystem mailing list
> Rpm-ecosystem at lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-ecosystem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-ecosystem/attachments/20170804/ebec1e2c/attachment.html>

More information about the Rpm-ecosystem mailing list