From 7aff403c1e32861961d2ac5ca5ce0a86c855c4c7 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 29 Aug 2022 14:53:59 +0200 Subject: [PATCH] fedora: Adopt versioning guideline for snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Simple versioning" scheme: https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_simple_versioning probably doesn't apply to passt, given that upstream git tags are not really releases. Switch to the "Snapshots" versioning scheme: https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_snapshots Suggested-by: Daniel P. Berrangé Signed-off-by: Stefano Brivio --- contrib/fedora/rpkg.macros | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/fedora/rpkg.macros b/contrib/fedora/rpkg.macros index 2032034..df9dfc5 100644 --- a/contrib/fedora/rpkg.macros +++ b/contrib/fedora/rpkg.macros @@ -12,7 +12,10 @@ # Author: Stefano Brivio function git_version { - printf "0.git.%s.%s" "$(date -u -I | tr - _)" "$(git rev-parse --short HEAD)" + __commit="$(git rev-parse --short "${1:-HEAD}")" + __date="$(git log --pretty="format:%cI" "${__commit}" -1)" + + printf "0^%s.g%s" "$(date -uI -d "${__date}" | tr -d -)" "${__commit}" } function git_head { @@ -28,7 +31,7 @@ function passt_git_changelog_entry { __date="$(git log --pretty="format:%cI" "${__to}" -1)" __author="$(git log -1 --pretty="format:%an <%ae>" ${__to} -- contrib/fedora)" - printf "* %s %s - %s\n" "$(date "+%a %b %e %Y" -d "${__date}")" "${__author}" "0.git.${1}-0" + printf "* %s %s - %s\n" "$(date "+%a %b %e %Y" -d "${__date}")" "${__author}" "$(git_version "${__to}")-1" IFS=' '