I can't find documentation on the version format rpkg supports when it parses the version from a git tag.
In the doc examples I only see two component versions, e.g.: foo-x.y-r
foo-x.y-r
I tried to use a three component version (i.e. foo-x.y.z-r) but this failed with copr.
foo-x.y.z-r
That means after adding the dracut-sshd-0.5.1-1 tag the next rpkg copr execution created packages with:
dracut-sshd-0.5.1-1
0.0-1.fc30
Instead of the expected 0.5.1-1.
0.5.1-1
Do I have to do something else such that rpkg picks up the right three component version?
Hello, could you, please, paste here your spec file? It would help me very much in analyzing the problem
Sure, here it is (replaced some section bodies with [..] for brevity - complete and tagged dracut-sshd.spec):
[..]
Name: {{{ git_dir_name }}} Version: {{{ git_dir_version }}} Release: 1%{?dist} Summary: Provide SSH access to initramfs early user space URL: https://github.com/gsauthof License: GPLv3+ VCS: {{{ git_dir_vcs }}} Source: {{{ git_dir_pack }}} BuildArch: noarch Requires: dracut-network %description [..] %prep {{{ git_dir_setup_macro }}} %build # nothing to do here %install [..] %files [..] %changelog [..]
Basically, rpkg internally splits whole version into two parts lead and follow. lead is everything until the last dot, follow is the rest.
lead
follow
But because rpkg supports keeping multiple versions of the same package within the same repository (i.e. all with different leads), it is needed to tell rpkg what lead you mean, otherwise it assumes it to be zero and doesn't then match correctly against 0.5.
0.5
You can tell rpkg what lead you mean by:
{{{ git_dir_version lead=0.5 }}}
The last component will still be the the follow, which is the component that rpkg automatically increments with each new tag. The lead part needs to be adjusted manually.
Please, see some docs here: https://docs.pagure.org/rpkg-util/macro_reference.html#git-version
I'm afraid, as-is, the https://docs.pagure.org/rpkg-util/macro_reference.html#git-version section has some room for improvement. It doesn't specify how the mechanics work.
For example, it doesn't say if thelead string is somehow matched against the last git tag. Is there some common prefix matching of the version suffix going on?
Honestly, this isn't clear to me even after I've read your last comment.
The section doesn't even say how the follow part is extracted from the last git tag, exactly.
Some examples that show which part of the git tag are the lead and what is then matched as follow part would also help.
It's automatically extracted from the tag, right?
After your clarifications, I think that {{{ git_dir_version }}} isn't that attractive for my use-case: a repository that just contains one package spec file without multiple version shenanigans.
{{{ git_dir_version }}}
I'll probably just remove {{{ git_dir_version }}} from my spec file since it doesn't really buy me much, involves a lot of extra complexity and having to update the lead from time-to-time is certainly more error-prone than updating the Version: field directly, every time.
Version:
Thanks for the feedback. The documentation indeed needs some improvement.
Metadata Update from @clime: - Issue status updated to: Closed (was: Open)
https://pagure.io/rpkg-util/issue/25 might be related.
This issue has been migrated to GitHub: https://github.com/fedora-copr/rpkg-util/issues/21 Don't forget to subscribe for notifications about new comments.