Our spec file ruby.spec used for RHEL 7 ruby is implementing "load" macro by ourselves like this. Because the "load" built-in macro is available from rpm version 4.12.0. [1] But we want to build the spec file with the following 2 environments. * My local environment: Fedora 31 : rpm-4.15.1-1.fc31.x86_64 * RHEL 7 environment on mock (chroot): rpm-build-4.11.3-43.el7 ruby.spec ``` ... Source100: load.inc %include %{SOURCE100} %{load %{SOURCE4}} %{load %{SOURCE5}} ... ``` ``` $ cat load.inc ... # Include the constants defined in macros files. Could be dropped as soon as # RPM supports the %%load macro (RPM 4.12+ probably). # http://lists.rpm.org/pipermail/rpm-maint/2014-February/003659.html %define load() %{lua:source_macros(rpm.expand("%1"))} <= This line is error. ``` I got the following error when I executed the command "rhpkg srpm" to create the SRPM file. This error comes from the rpm. ``` $ rpm -q rpm rpm-4.15.1-1.fc31.x86_64 $ rhpkg srpm error: /path/to/ruby/load.inc: line 30: Macro %load is a built-in (%define) error: query of specfile /path/to/ruby/ruby.spec failed, can't parse Could not execute srpm: Could not get n-v-r-e from /path/to/ruby/ruby.spec ``` I want to call following line conditionally, "if the rpm version is >= 4.12.0" or "if the macro with options: "load()" is not defined as built-in. For example like this. But it becomes error on the line "%if ! %{defined load}". Do you have any idea how to fix this? ``` $ git diff diff --git a/load.inc b/load.inc index bf9c07e..ba37835 100644 --- a/load.inc +++ b/load.inc ... +%if ! %{defined load} <= This line is error. %define load() %{lua:source_macros(rpm.expand("%1"))} +%endif ``` ``` $ rhpkg srpm ... error: /home/jaruga/git/rh-packages/scl/rh-ruby27/ruby/load.inc: line 30: failed to load macro file 0 ... ``` [1] https://rpm.org/user_doc/macros.html > %{load:...} load a macro file (in >= 4.12.0) Thank you. Cheers, Jun -- Jun | He - His - Him _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxxxxx http://lists.rpm.org/mailman/listinfo/rpm-list