From 0f9c095d889ff68c9b704d9a79a665d997542a13 Mon Sep 17 00:00:00 2001 From: Mikhail Novosyolov Date: Sun, 3 Oct 2021 01:15:18 +0300 Subject: [PATCH] Adapt to rpm 4.17 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on: https://src.fedoraproject.org/rpms/java-11-openjdk/c/2adbf848e0830d263953b4ab1a9214d372b4479b?branch=rawhide https://src.fedoraproject.org/rpms/java-11-openjdk/c/0eeb4a6e133c5efadb90a511da40c774b82b7363?branch=rawhide 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 ``` --- java-11-openjdk.spec | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/java-11-openjdk.spec b/java-11-openjdk.spec index 0cb9731..989ab93 100644 --- a/java-11-openjdk.spec +++ b/java-11-openjdk.spec @@ -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, # not rpm transaction and so no configs are persisted when pure rpm -u is run. It may be # considered as regression -Requires: copy-jdk-configs >= 3.3 +Requires: copy-jdk-configs >= 4.0 OrderWithRequires: copy-jdk-configs # for printing support Requires: cups-libs @@ -1885,7 +1885,13 @@ done -- 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 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" SOURCE2 = "%{_libexecdir}/copy_jdk_configs.lua" @@ -1913,9 +1919,10 @@ else return end end --- run content of included file with fake args -arg = {"--currentjvm", "%{uniquesuffix %{nil}}", "--jvmdir", "%{_jvmdir %{nil}}", "--origname", "%{name}", "--origjavaver", "%{javaver}", "--arch", "%{_arch}", "--temp", "%{rpm_state_dir}/%{name}.%{_arch}"} -require "copy_jdk_configs.lua" +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" +cjc = 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_script %{nil}}