#9 rpkg does not use existing git tags like git describe
Closed 5 years ago Opened 5 years ago by alick.

It seems rpkg does not use existing git tags like git describe to deduct version numbers. In a git repo with a long existing history, rpkg thinks the version is 0.0.


Hello, this is not a bug. rpkg only considers tags in format name-version-release (e.g. rpkg-util-2.2-1) that it can conveniently parse. Currently, if you want to start tagging by rpkg in your project, you need to create a "starting tag" in that format with a desired package name, version and release info in it. rpkg will then use that tag as a starting point for all operation.

Metadata Update from @clime:
- Issue status updated to: Closed (was: Open)

5 years ago

Is it possible to rpkg tag an older commit? The issue I am facing is that
I want to create a snapshot srpm when latest HEAD is not yet ready to
release.

Regards,
Alick
On Sat, May 19, 2018 at 2:12 AM clime pagure@pagure.io wrote:

The status of the issue: rpkg does not use existing git tags like git describe of project: rpkg-util has been updated to: Closed by clime.

https://pagure.io/rpkg-util/issue/9

Is it possible to rpkg tag an older commit?

You need to git reset to that particular commit, then create a tag and git reset origin to reset the original state.

Note that you can also just use git tag -a manually (that allows you to specify target commit). If you want the tag to be recognized by rpkg later, it should have name-version-release format.

rpkg tag is mainly good for tag name auto-generation.

Unfortunately neither git reset nor git tag -a worked in my test. I
tried to create tags like volumeicon-0.5.1-1 for the 0.5.1 release, but
rpkg spec upon master HEAD still outputs version as
0.0.git.41.7ce6c27.wtree.zi8lv1.

I am using rpkg-2.2-1.fc27 from the Fedora repo. Do I need to switch to git
master version of rpkg?

Unfortunately neither git reset nor git tag -a worked in my test. I
tried to create tags like volumeicon-0.5.1-1 for the 0.5.1 release, but
rpkg spec upon master HEAD still outputs version as
0.0.git.41.7ce6c27.wtree.zi8lv1.
I am using rpkg-2.2-1.fc27 from the Fedora repo. Do I need to switch to git
master version of rpkg?

So I am guessing, you are using git_version macro in your spec file. Do you also use git_name macro before that? Does it ouput "volumeicon"?

After creating the volumeicon-0.5.1-1 tag on the desired commit, try to also update your specfile to have something like

Version: {{{ git_version name=volumeicon }}}

Specifying name to git_version is not usually necessary if git_name is used beforehand and it gives the requested results but this will be a good debugging step.

Now rpkg spec should generate spec file with version starting with 0.5.1. Dynamic suffixes will be appended if you have some commits on top of the volumeicon-0.5.1-1 tag (.git.xxxxxxx suffix) or if your working tree is dirty (.wtree.xxxxx suffix). To get rid of the suffixes, checkout the tag you have created.

Note that after you get your hands on this, you should fix your spec file first, commit and then recreate the volumeicon-0.5.1-1 tag so that everything works correctly after checking out volumeicon-0.5.1-1. If you have already released that version, my recommendation would be to create a new version just with that fix in the specfile, where the version is properly generated.

Login to comment on this ticket.

Metadata