Adapt to rpm 4.17

Based on:
2adbf848e0
0eeb4a6e13

copy-jdk-configs have also been updated to pick https://pagure.io/copy_jdk_configs/c/88b1aeb3472132166d558915dcf706c4d39d915e?branch=master

Error was:
```
  Запуск скриптлета: java-1.8.0-openjdk-headless-1:1.8.0.252.b02-0.1.ea.x86_64                                                                                                                                                          1/1
ошибка: lua script failed: /usr/libexec/copy_jdk_configs.lua:43: attempt to index a nil value (global 'arg')

Error in PRETRANS scriptlet in rpm package java-1.8.0-openjdk-headless
```
This commit is contained in:
Mikhail Novosyolov 2021-10-03 01:15:18 +03:00
parent 57bcc7e82e
commit 0f9c095d88

View file

@ -927,7 +927,7 @@ Requires: lksctp-tools%{?_isa}
# tool to copy jdk's configs - should be Recommends only, but then only dnf/yum enforce it, # tool to copy jdk's configs - should be Recommends only, but then only dnf/yum enforce it,
# not rpm transaction and so no configs are persisted when pure rpm -u is run. It may be # not rpm transaction and so no configs are persisted when pure rpm -u is run. It may be
# considered as regression # considered as regression
Requires: copy-jdk-configs >= 3.3 Requires: copy-jdk-configs >= 4.0
OrderWithRequires: copy-jdk-configs OrderWithRequires: copy-jdk-configs
# for printing support # for printing support
Requires: cups-libs Requires: cups-libs
@ -1885,7 +1885,13 @@ done
-- whether copy-jdk-configs is installed or not. If so, then configs are copied -- whether copy-jdk-configs is installed or not. If so, then configs are copied
-- (copy_jdk_configs from %%{_libexecdir} used) or not copied at all -- (copy_jdk_configs from %%{_libexecdir} used) or not copied at all
local posix = require "posix" local posix = require "posix"
local debug = false
if (os.getenv("debug") == "true") then
debug = true;
print("cjc: in spec debug is on")
else
debug = false;
end
SOURCE1 = "%{rpm_state_dir}/copy_jdk_configs.lua" SOURCE1 = "%{rpm_state_dir}/copy_jdk_configs.lua"
SOURCE2 = "%{_libexecdir}/copy_jdk_configs.lua" SOURCE2 = "%{_libexecdir}/copy_jdk_configs.lua"
@ -1913,9 +1919,10 @@ else
return return
end end
end end
-- run content of included file with fake args arg = nil ; -- it is better to null the arg up, no meter if they exists or not, and use cjc as module in unified way, instead of relaying on "main" method during require "copy_jdk_configs.lua"
arg = {"--currentjvm", "%{uniquesuffix %{nil}}", "--jvmdir", "%{_jvmdir %{nil}}", "--origname", "%{name}", "--origjavaver", "%{javaver}", "--arch", "%{_arch}", "--temp", "%{rpm_state_dir}/%{name}.%{_arch}"} cjc = require "copy_jdk_configs.lua"
require "copy_jdk_configs.lua" args = {"--currentjvm", "%{uniquesuffix %{nil}}", "--jvmdir", "%{_jvmdir %{nil}}", "--origname", "%{name}", "--origjavaver", "%{javaver}", "--arch", "%{_arch}", "--temp", "%{rpm_state_dir}/%{name}.%{_arch}"}
cjc.mainProgram(args)
%post %post
%{post_script %{nil}} %{post_script %{nil}}