| |
@@ -57,6 +57,31 @@
|
| |
ERROR: git_version: name cannot be empty.
|
| |
git_version name="$(git_name)" failed with value 1.
|
| |
---
|
| |
+ > git_release
|
| |
+ ---
|
| |
+ > git_release name=foo
|
| |
+ ---
|
| |
+ > git_release pivot=1
|
| |
+ ---
|
| |
+ > git_release name=foo pivot=1
|
| |
+ ---
|
| |
+ > git_release pivot=x
|
| |
+ ---
|
| |
+ > git_release pivot=2.0
|
| |
+ ---
|
| |
+ > git_release pivot=1-1 # invalid
|
| |
+ ERROR: git_release: pivot cannot contain dashes.
|
| |
+ git_release pivot=1-1 # invalid failed with value 1.
|
| |
+ ---
|
| |
+ > git_release name= # invalid
|
| |
+ ERROR: git_release: name cannot be empty.
|
| |
+ git_release name= # invalid failed with value 1.
|
| |
+ ---
|
| |
+ > git_release name="$(git_name)"
|
| |
+ ERROR: git_name: Could not get remote URL.
|
| |
+ ERROR: git_release: name cannot be empty.
|
| |
+ git_release name="$(git_name)" failed with value 1.
|
| |
+ ---
|
| |
> git_vcs
|
| |
ERROR: git_vcs: Start by setting origin URL.
|
| |
git_vcs failed with value 1.
|
| |
@@ -154,6 +179,31 @@
|
| |
ERROR: git_dir_version: name cannot be empty.
|
| |
git_dir_version name="$(git_name)" failed with value 1.
|
| |
---
|
| |
+ > git_dir_release
|
| |
+ ---
|
| |
+ > git_dir_release name=foo
|
| |
+ ---
|
| |
+ > git_dir_release pivot=1
|
| |
+ ---
|
| |
+ > git_dir_release name=foo pivot=1
|
| |
+ ---
|
| |
+ > git_dir_release pivot=x
|
| |
+ ---
|
| |
+ > git_dir_release pivot=2.0
|
| |
+ ---
|
| |
+ > git_dir_release pivot=1-1 # invalid
|
| |
+ ERROR: git_dir_release: pivot cannot contain dashes.
|
| |
+ git_dir_release pivot=1-1 # invalid failed with value 1.
|
| |
+ ---
|
| |
+ > git_dir_release name= # invalid
|
| |
+ ERROR: git_dir_release: name cannot be empty.
|
| |
+ git_dir_release name= # invalid failed with value 1.
|
| |
+ ---
|
| |
+ > git_dir_release name="$(git_name)"
|
| |
+ ERROR: git_name: Could not get remote URL.
|
| |
+ ERROR: git_dir_release: name cannot be empty.
|
| |
+ git_dir_release name="$(git_name)" failed with value 1.
|
| |
+ ---
|
| |
> git_dir_vcs
|
| |
ERROR: git_dir_vcs: Start by setting origin URL.
|
| |
git_dir_vcs failed with value 1.
|
| |
@@ -251,6 +301,31 @@
|
| |
ERROR: git_cwd_version: name cannot be empty.
|
| |
git_cwd_version name="$(git_cwd_name)" failed with value 1.
|
| |
---
|
| |
+ > git_cwd_release
|
| |
+ ---
|
| |
+ > git_cwd_release name=foo
|
| |
+ ---
|
| |
+ > git_cwd_release pivot=1
|
| |
+ ---
|
| |
+ > git_cwd_release name=foo pivot=1
|
| |
+ ---
|
| |
+ > git_cwd_release pivot=x
|
| |
+ ---
|
| |
+ > git_cwd_release pivot=2.0
|
| |
+ ---
|
| |
+ > git_cwd_release pivot=1-1 # invalid
|
| |
+ ERROR: git_cwd_release: pivot cannot contain dashes.
|
| |
+ git_cwd_release pivot=1-1 # invalid failed with value 1.
|
| |
+ ---
|
| |
+ > git_cwd_release name= # invalid
|
| |
+ ERROR: git_cwd_release: name cannot be empty.
|
| |
+ git_cwd_release name= # invalid failed with value 1.
|
| |
+ ---
|
| |
+ > git_cwd_release name="$(git_name)"
|
| |
+ ERROR: git_name: Could not get remote URL.
|
| |
+ ERROR: git_cwd_release: name cannot be empty.
|
| |
+ git_cwd_release name="$(git_name)" failed with value 1.
|
| |
+ ---
|
| |
> git_cwd_vcs
|
| |
ERROR: git_cwd_vcs: Start by setting origin URL.
|
| |
git_cwd_vcs failed with value 1.
|
| |
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, thengit_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 tagpkgname-1.0-3
).git_release
can be used together withgit_changelog
to get also changelogs generated from the tags.git_release
can be technically used withgit_version
together but the usage probably does not make too much sense.git_version
is primarily intended for upstream devels (who will have staticRelease
) andgit_release
is intended for downstream devels (who will have staticVersion
).@ngompa @bkabrda: can you, please, review