[Rpm-maint] [PATCH] rpmdbCountPackagesArch

Thomas Fitzsimmons fitzsim at redhat.com
Fri Jun 27 20:58:27 UTC 2008


Hi,

I'm working on a way to pass per-architecture package counts to
scriptlets [1].  Jeff Johnson suggested creating a new database index
for this purpose [2].

Attached are two patches against Fedora 9's rpm.  The first adds a
Namearch index to the RPM database.  The second uses Namearch to
implement a new rpmlib function, rpmdbCountPackagesArch.

A few observations about patch 1, from testing on Fedora 9 i386:

   - A new tag type, RPMTAG_NAMEARCH, is introduced.  It does not
     represent a real header tag; it's only used in rpmdb.c to maintain
     the Namearch index.

   - An RPM database rebuild is required.

   - The time it takes to rebuild the database is not affected by the
     addition of the new index.

   - /var/lib/rpm/Namearch on my machine is 84K.

   - Namearch does not index headers that have NULL arch tags, like GPG
     key entries.

Patch 2 observations:

   - rpmdbCountPackagesArch matches rpmdbCountPackages's performance.

   - rpmdbCountPackages's performance is not affected by this patch.

   - If the Namearch index is not present (i.e. if rpm --rebuilddb has
     not been run yet) rpmdbCountPackagesArch produces incorrect
     results.

These patches form the basis for whatever mechanism we choose to pass
the new information to scriptlets, whether it be re-using the existing
$1 and $2 arguments, adding additional arguments or introducing new
environment variables.  That's a subject for another thread though.
For now I'd like feedback on these initial patches.

Tom

1. https://bugzilla.redhat.com/show_bug.cgi?id=340391
2. https://lists.dulug.duke.edu/pipermail/rpm-devel/2007-February/002075.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rpm-namearch-index.patch
Url: http://lists.rpm.org/pipermail/rpm-maint/attachments/20080627/a84c0dac/attachment-0002.diff 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rpm-namearch-count.patch
Url: http://lists.rpm.org/pipermail/rpm-maint/attachments/20080627/a84c0dac/attachment-0003.diff 


More information about the Rpm-maint mailing list