[Rpm-ecosystem] comparing rpm.hdr's
Igor Gnatenko
ignatenko at redhat.com
Thu Aug 11 08:06:35 UTC 2016
On Thu, Aug 11, 2016 at 9:26 AM, Panu Matilainen
<pmatilai at laiskiainen.org> wrote:
> On 08/10/2016 11:08 PM, Igor Gnatenko wrote:
>>
>> Hi maillist,
>>
>> is there way to compare RPM hdr objects? Actually I want to find way how
>> to:
>> * know if package has been changed
>> * compare not only NEVRA, but also additional attributes
>
>
> For many/most practical purposes you can just compare equality of
> RPMTAG_SHA1HEADER between the objects, ie
>
> Note that the SHA1 hash reflects the package metadata and contents as it
> came out of the rpmbuild. It does NOT reflect things like package getting
> (re)signed, unsigned or installed. For many purposes this is exactly what
> you want, but if you want to account for absolutely everything then you can
> for example compare the object serializations.
>
> So basically:
>
> if h1['sha1header'] != h2['sha1header']:
> # original package metadata or contents differ
>
> if h1.unload() != h2.unload():
> # headers differ by signature, install time or such
>
That's what I wanted. Thanks a lot!
> - Panu -
>
>
> _______________________________________________
> Rpm-ecosystem mailing list
> Rpm-ecosystem at lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-ecosystem
--
-Igor Gnatenko
More information about the Rpm-ecosystem
mailing list