<div dir="ltr">I see a possible solution:<br><br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="background-color:rgb(255,228,255)">a</span> = base.sack.query().filter(<span style="color:rgb(102,0,153)">name</span>=<span style="color:rgb(0,128,128);font-weight:bold">'TestA'</span>)<br><span style="color:rgb(0,0,128);font-weight:bold">for </span>pkg <span style="color:rgb(0,0,128);font-weight:bold">in </span><span style="background-color:rgb(228,228,255)">a</span>:<br>    <span style="color:rgb(0,0,128)">print</span>([pkg])<br>    <span style="color:rgb(0,0,128);font-weight:bold">if </span>pkg.installed:<br>        yumdb_info = base._yumdb.get_package(pkg)<br>        <span style="color:rgb(0,0,128)">print</span>(yumdb_info.checksum_type, yumdb_info.checksum_data)<br>    <span style="color:rgb(0,0,128);font-weight:bold">else</span>:<br>        <span style="color:rgb(0,0,128);font-weight:bold">try</span>:<br>            type, checksum = pkg.returnIdSum()<br>            <span style="color:rgb(0,0,128)">print</span>(type, checksum)<br>        <span style="color:rgb(0,0,128);font-weight:bold">except </span><span style="color:rgb(0,0,128)">AttributeError</span>:<br>            <span style="color:rgb(0,0,128)">print</span>(<span style="color:rgb(0,128,128);font-weight:bold">'returnIdSum()_error'</span>)<br><br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt">But it uses private object _yumdb. In near future we will replace it with SWDB.<br><br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt">Have a nice time<br><br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt">     Jaroslav<br></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 5:52 PM, Ian Pilcher <span dir="ltr"><<a href="mailto:arequipeno@gmail.com" target="_blank">arequipeno@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I would like to the the DNF API (python-dnf) to determine the source<br>
repository for the packages that are installed on a system.  (I am aware<br>
that this is not necessarily possible for every package, but it should<br>
be possible for the vast majority of packages on an up-to-date system.)<br>
<br>
It is straightforward to iterate through the installed packages and<br>
search for matching packages in a sack that was filled with<br>
fill_sack(load_system_repo=Fal<wbr>se, load_available_repos=True) --<br>
filtering on either NVRA or NEVRA.<br>
<br>
If possible, I would like to take the further step of validating that<br>
checksum of the installed package matches that of any available<br>
packages.  However, I'm having trouble figuring out how to do this.  It<br>
seems that installed packages have only a hdr_chksum attribute while<br>
available packages have only a chksum attribute.  (Attempting to read<br>
the hdr_chksum of an available package or the chksum attribute of an<br>
installed packages raises a "No such checksum" AttributeError.<br>
<br>
Is the NVRA/NEVRA match the best that can be done?<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
==============================<wbr>==============================<wbr>============<br>
Ian Pilcher                                         <a href="mailto:arequipeno@gmail.com" target="_blank">arequipeno@gmail.com</a><br>
-------- "I grew up before Mark Zuckerberg invented friendship" --------<br>
==============================<wbr>==============================<wbr>============<br>
______________________________<wbr>_________________<br>
Rpm-ecosystem mailing list<br>
<a href="mailto:Rpm-ecosystem@lists.rpm.org" target="_blank">Rpm-ecosystem@lists.rpm.org</a><br>
<a href="http://lists.rpm.org/mailman/listinfo/rpm-ecosystem" rel="noreferrer" target="_blank">http://lists.rpm.org/mailman/l<wbr>istinfo/rpm-ecosystem</a><br>
</font></span></blockquote></div><br></div>