-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a better `make rpm` experience. A rpm-version script is required to turn the `git describe` output into something RPM can accept. The script was extracted from the RPM GitHub action we had.
- Loading branch information
1 parent
65f6579
commit 9eecc0d
Showing
4 changed files
with
26 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash -eu | ||
# Generates a version string from `git describe` in a format that RPM accepts | ||
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ | ||
last_tag=$(git describe --tags --abbrev=0) | ||
version=$(cut -d- -f1 <<< ${last_tag:1}) | ||
pre_release=$(cut -d- -f2 -s <<< $last_tag) | ||
if [ -n "$pre_release" ] | ||
then version=$version~${pre_release//./} | ||
fi | ||
git_describe=$(git describe --tags) | ||
post_release=${git_describe//$last_tag/} | ||
post_release=${post_release:1} | ||
post_release=${post_release//-/.} | ||
if [ -n "$post_release" ] | ||
then version=$version^${post_release} | ||
fi | ||
echo $version |