From 5f0aebe692304978a79a882601e4b8d8b07506a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jani=20V=C3=A4limaa?= Date: Sat, 7 Jan 2023 09:27:14 +0200 Subject: Add macros.gnome Introduce %url_ver and %tarball_version macros --- NEWS | 1 + macros.gnome | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 macros.gnome diff --git a/NEWS b/NEWS index d0cff12..79aaa64 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ +- add macros.gnome to introduce %url_ver and %tarball_version macros - rpm-spec-mode.el: fix compatibility with Emacs 28.1, patch from https://github.com/stigbjorlykke/rpm-spec-mode/pull/17 diff --git a/macros.gnome b/macros.gnome new file mode 100644 index 0000000..cb38bd0 --- /dev/null +++ b/macros.gnome @@ -0,0 +1,22 @@ +%tarball_version %{lua: +ver = string.gsub(rpm.expand("%{version}"), "~", ".") +print(ver) +} + +%url_ver %{lua: +ver = rpm.expand("%{version}") +majmin, count1 = string.gsub(ver, "^(%d+%.%d+).*", "%1", 1) +if count1 == 0 then + ver = string.gsub(ver, "~.*", "") + print(ver) + return +end +maj, count2 = string.gsub(majmin, "^(%d+).*", "%1", 1); +if count2 == 0 then + print(majmin) +elseif tonumber(majmin) < 40 then + print(majmin) +else + print(maj) +end +} -- cgit v1.2.1