From f8ba8ced93f4ae44b6f616a4fdfcc8be457f25db94d1343256935aa48a87e911 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 30 Nov 2022 13:46:45 +0000 Subject: [PATCH] Accepting request 1038260 from Kernel:tools - Make macros usable with older releases (boo#1205611). OBS-URL: https://build.opensuse.org/request/show/1038260 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua-macros?expand=0&rev=24 --- lua-macros.changes | 5 +++++ lua-macros.spec | 6 +++++- macros.lua | 14 +++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lua-macros.changes b/lua-macros.changes index f7db647..9d140fd 100644 --- a/lua-macros.changes +++ b/lua-macros.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Nov 25 19:15:41 UTC 2022 - Michal Suchanek + +- Make macros usable with older releases (boo#1205611). + ------------------------------------------------------------------- Fri Sep 2 15:13:06 UTC 2022 - Callum Farmer diff --git a/lua-macros.spec b/lua-macros.spec index 23c684e..e0f8b1b 100644 --- a/lua-macros.spec +++ b/lua-macros.spec @@ -1,7 +1,7 @@ # # spec file for package lua-macros # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,6 +15,7 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # + %if %{undefined _rpmmacrodir} %define _rpmmacrodir %{_rpmconfigdir}/macros.d %endif @@ -26,7 +27,10 @@ License: MIT Group: Development/Languages/Other URL: https://www.lua.org Source0: macros.lua +%if 0%{?suse_version} >= 1500 +# on SLE 12 lua is lua5.2 unconditionally, avoid Requires: lua +%endif BuildArch: noarch %description diff --git a/macros.lua b/macros.lua index 3230b68..4720675 100644 --- a/macros.lua +++ b/macros.lua @@ -13,7 +13,19 @@ # lua includes folder %lua_incdir %{_includedir}/lua%{lua_version} -%lua_version_default 5.4 +%lua_version_default %{lua: +local result = 5.4 +local ver = rpm.expand("%{?suse_version}") +if #ver > 0 then + ver = tonumber(ver) + if ver < 1500 then + result = 5.1 + elseif ver == 1500 then + result = 5.3 + end +end +print(result) +} %lua_version_default_nodots %(lua -e 'print((string.gsub("%{lua_version_default}", "%.", "")))') %ifluadefault \