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 \