We're using Git as our VCS and RPMs for packaging. I'd like to store the Git hash a package was built from, but I'm not sure on the most appropriate place.
There are a number of tags available to an RPM, however I don't see any for a VCS version (maybe glanced over it?).
I'm quite leery about adding a custom tag, just looking at the 50,000 ft level.
One solution that feels pretty hacky would be to put the Git hash in the description field. We're not using it for anything else at this point, but wow, that just feels ugly.
So what is the most appropriate place to store a VCS version in an RPM?
Fedora (and very rarely RHEL) place this information in the Release tag.
For instance:
RPM actually has a poorly documented
VCS
tag.It doesn't appear to have any sort of guidelines on its use, but it exists and is supported.
It appears to be limited to a single parse token. Still useful. I didn't find any documentation on a well defined format or structure for it, and its adoption is limited. On my Fedora 32 system I found two packages using it, with different formats:
Frankly it's a real shame rpm doesn't give us the ability to inject custom tag info. I want to record the Jenkins build ID and job name, the git commit hash, and git branch or tag, but don't really want them in the changelog.
I can do this in debs with
X-BS-foo
tags.You can see a list of allowed rpm tags with
rpm --querytags
.The
DISTURL
tag appears to be reserved for another use but could be a candidate.There's also
URL
; you could choose to embed SCM info there, and have a redirect that takes the URL to a reasonable location if visited by a browser.You may see references to "rpm5" supporting custom tags. This seems to be a dead fork of rpm, not the rpm.org distribution used on most major distros.