On 5/24/23 18:26, Zbigniew Jędrzejewski-Szmek wrote:
On Wed, May 24, 2023 at 11:13:15AM -0400, Ben Beasley wrote:
In your example, the forge macros simplify the spec file only because a snapshot is involved; but the forge macros put the snapshot info in the Release field, which is still permissible but deprecated[1].
Without the forge macros, the spec file would admittedly be a little more complex. I would probably do something like the following:
%global commit 791953030836d39687688a8e7f1a3e708892cfa1
%global snapdate 20230420
Version: 1.2^%{snapdate}git%(echo '%{commit}' | cut -b -7)
Release: 1%{?dist}
Minor comment:
%(c=%{commit}; echo ${c:0:7})
is a bit nicer because it doesn't require 'cut', it just uses 'echo',
which is a shell builtin.
Or in rpm >= 4.19 (just landed in rawhide), you can just do
%{sub %{commit} 1 8}
There's a bunch of new macro string operations like that, see the
related group in https://rpm-software-management.github.io/rpm/manual/macros
</end advertisement> :P
- Panu -
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue