RPM Community Forums

Mailing List Message of <rpm-devel>

Storing arbitrary metadata in RPM headers

From: Alex Myltsev <avm@altlinux.org>
Date: Fri 22 Jun 2007 - 15:10:22 CEST
Message-ID: <ffae7d540706220610hde85ce3jf2fe4b87ae38d8a8@mail.gmail.com>
Hello,

what is the best way to store (more or less) arbitrary metadata in RPM headers?

The thing is, at ALT Linux we build RPMs from git repositories, and
I'd like to store the commit ID, repository URL etc. somewhere in the
binary RPM (to match binary RPMs to their sources). Later on I may
need to store other metadata, so it seems like a mechanism to store
key:value pairs in RPMs is called for.

Some of the options seemed to be:
1) storing them in a special file inside the payload; this makes
querying this information quite slow and won't work on a large scale;
2) storing them inside %description; that way I have to parse
%description later, which is brittle and will fail sometimes;
3) creating special-case RPMTAGs for every piece of metadata, which is
just silly;
4) doing some other hackery.

I chose 4), and I intend to store the git repository URL in
Summary(X-GIT-URL), the commit ID in Summary(X-GIT-COMMIT), and
generally store 'key:value' as
Summary(X-KEY): value

It is of course abuse of Summary, but it is simple to implement,
stands in noone's way, and I can query it later with a simple
$ LANG=X-KEY-ID rpmquery --qf='%{SUMMARY}' package.rpm

What do you think?
Received on Fri Jun 22 15:11:16 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.