public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH 2/7] fedora: Adopt versioning guideline for snapshots
Date: Mon, 29 Aug 2022 17:17:04 +0200	[thread overview]
Message-ID: <20220829151709.2650896-3-sbrivio@redhat.com> (raw)
In-Reply-To: <20220829151709.2650896-1-sbrivio@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

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/#_simple_versioning

Suggested-by: Daniel P. Berrangé <berrange(a)redhat.com>
Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
 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 <sbrivio(a)redhat.com>
 
 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='
 '
-- 
@@ -12,7 +12,10 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 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='
 '
-- 
2.35.1


  parent reply	other threads:[~2022-08-29 15:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 15:17 [PATCH 0/7] Second batch of fixes reported during Fedora package review Stefano Brivio
2022-08-29 15:17 ` [PATCH 1/7] util: Drop any supplementary group before dropping privileges Stefano Brivio
2022-08-30  1:20   ` David Gibson
2022-08-29 15:17 ` Stefano Brivio [this message]
2022-08-29 19:25   ` [PATCH 2/7] fedora: Adopt versioning guideline for snapshots Stefano Brivio
2022-08-29 15:17 ` [PATCH 3/7] fedora: Drop SPDX identifier from spec file Stefano Brivio
2022-08-29 15:17 ` [PATCH 4/7] fedora: Drop comment stating the spec file is an example file Stefano Brivio
2022-08-29 15:17 ` [PATCH 5/7] fedora: Define git_hash in spec file and reuse it Stefano Brivio
2022-08-29 15:17 ` [PATCH 6/7] fedora: Use full versioning for SELinux subpackage Requires: tag Stefano Brivio
2022-08-29 15:17 ` [PATCH 7/7] fedora: Pass explicit bindir, mandir, docdir, and drop OpenSUSE override Stefano Brivio
2022-08-29 19:23   ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220829151709.2650896-3-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).