[Rpm-ecosystem] comparing rpm.hdr's

Panu Matilainen pmatilai at laiskiainen.org
Thu Aug 11 07:26:14 UTC 2016


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

	- Panu -




More information about the Rpm-ecosystem mailing list