Hello, this PR implements git_release macro to be used in spec files to dynamically generate release number from git (annotated) tags.
Release number from the latest tag is taken as a base and dynamic suffixes are appended to it indicating number of commits from the latest tag, HEAD commit short hash, and working tree dirtiness status (.wtree.<timestamp> suffix).
If currently checked out commit is the one tagged most recently and working tree is clean, then no dynamic suffixes are appended and we simply get the value read from the tag (the value after the last dash in the tag name). It may or may not be a number (but assumption is that it will usually be a number).
If rpkg tag is called, then git_release macro generates a "bumped release", which is the release value from the latest tag +1. If bumping is not possible (because release in the latest tag is not a number), then error is raised and manual tag creation is required.
Release resetting may be done by creating a new tag manually with release value equal to 1, example: rpkg tag pkgname-1.1-1 (this is assuming there is e.g. already existing tag pkgname-1.0-3).
git_release can be used together with git_changelog to get also changelogs generated from the tags.
git_release can be technically used with git_version together but the usage probably does not make too much sense. git_version is primarily intended for upstream devels (who will have static Release) and git_release is intended for downstream devels (who will have static Version).
Hello, this PR implements
git_releasemacro to be used in spec files to dynamically generate release number from git (annotated) tags.Release number from the latest tag is taken as a base and dynamic suffixes are appended to it indicating number of commits from the latest tag, HEAD commit short hash, and working tree dirtiness status (
.wtree.<timestamp>suffix).If currently checked out commit is the one tagged most recently and working tree is clean, then no dynamic suffixes are appended and we simply get the value read from the tag (the value after the last dash in the tag name). It may or may not be a number (but assumption is that it will usually be a number).
If
rpkg tagis called, thengit_releasemacro generates a "bumped release", which is the release value from the latest tag +1. If bumping is not possible (because release in the latest tag is not a number), then error is raised and manual tag creation is required.Release resetting may be done by creating a new tag manually with release value equal to 1, example:
rpkg tag pkgname-1.1-1(this is assuming there is e.g. already existing tagpkgname-1.0-3).git_releasecan be used together withgit_changelogto get also changelogs generated from the tags.git_releasecan be technically used withgit_versiontogether but the usage probably does not make too much sense.git_versionis primarily intended for upstream devels (who will have staticRelease) andgit_releaseis intended for downstream devels (who will have staticVersion).@ngompa @bkabrda: can you, please, review