Bug 1482192 - rpmbuild's new macro evaluation is causing nil to disapear
Summary: rpmbuild's new macro evaluation is causing nil to disapear
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 27
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 1443076
TreeView+ depends on / blocked
Reported: 2017-08-16 16:28 UTC by jiri vanek
Modified: 2017-08-18 18:26 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-08-18 18:26:23 UTC
Type: Bug

Attachments (Terms of Use)

Description jiri vanek 2017-08-16 16:28:40 UTC
I guess teh change "Expand parametric macro arguments before processing (#127, RhBug:1397209)" have caused following issue(s):

lets have macro:

%global files_jre() %{expand:
%{_jvmdir}/%{sdkdir %%1}/lib/libjsoundalsa.so
%{_jvmdir}/%{sdkdir %%1}/lib/libsplashscreen.so
%{_jvmdir}/%{sdkdir %%1}/lib/libawt_xawt.so
%{_jvmdir}/%{sdkdir %%1}/lib/libjawt.so
%{_jvmdir}/%{sdkdir %%1}/bin/policytool

I was used to use it as:

%{files_jre %{nil}}


%files debug
%{files_jre -- %{debug_suffix_unquoted}}

where %global debug_suffix_unquoted -debug

Now with rpm  4.13 i really god two nice subpackages which directories differs by suffix.

With rpm 4.14 pre (f27+) it is facing issues:

 The "debug" usage, is complaining for "unknow switch -d"  this gave sense, and imho can be (correctly) fixed by adding --:
  %{files_jre -- %{debug_suffix_unquoted}}

However, the nil is causing more severe issue I dont know how to fix.

It expand isteslf first, so the expansion is not aware of any parameter. and %1 will always remain %1.    I would consider this as showstopper for F27.

Comment 1 Panu Matilainen 2017-08-17 06:01:27 UTC
If you need to pass unexpanded macros as arguments, just escape them as usual: %%{nil}. That's the simplest fix for the cases where macro argument expansion is breaking things.

Alternatively you can use %{?1} inside the %files_jre macro, in which case it'd work with both %{nil} and entirely without it.

I realize this is a bit of a pain because forces changing some long working macros, but I think it's worth a bit of pain as it makes the macro language saner.

Comment 2 jiri vanek 2017-08-18 10:35:59 UTC
Also this case is killed:

What I have is:
for suffix in %{build_loop} ; do
mkdir -p %{buildoutputdir $suffix}
pushd %{buildoutputdir $suffix}

Comment 3 jiri vanek 2017-08-18 10:36:29 UTC
On top of stopping new package, it stopped any jdk8 updates

Comment 4 Panu Matilainen 2017-08-18 11:12:36 UTC
Erm, how is that for-loop case "killed"? I don't see anything special about that.

What's the output you're getting and what are you expecting?

Comment 5 jiri vanek 2017-08-18 18:26:23 UTC
As explained in upstream tracker, https://github.com/rpm-software-management/rpm/issues/127, all cases can be workarounded when used proper rpm techniques.

Note You need to log in before you can comment on or make changes to this bug.