fedpkg / koji error

Simone Caronni negativo17 at gmail.com
Wed Sep 5 16:48:57 UTC 2012


Hello,

I have a weird error that I do not have when building a package in
mock or locally.

When I try to build a package for EPEL6 that has conditionals inside
for checking the distribution it seems that Fedora is always
validated.

Let me explain.

The spec file is structured like this:

%if 0%{?fedora} >= 16 || 0%{?fedora} == 17
%post
%endif

%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%post
%endif

%if 0%{?rhel} == 6 || 0%{?rhel} == 5
%post
%endif

Each time I try a build with koji or fedpkg on the el6 branch I obtain
the following:

error: line 110: Second %post
error: query of specfile
/home/slaanesh/fedora-scm/package/package.spec failed, can't parse
Could not execute build: need more than 0 values to unpack

This means that even for the EPEL branch the first %if block is
evaluated; so the fedpkg on my system (Fedora 17) sets %rhel to 6 but
does not unset %fedora and they are both present.
To confirm this, removing the first block or changing it this way
makes the build successful:

%if (0%{?fedora} == 16 || 0%{?fedora} == 17) && !0%{?rhel}
%endif

It's me making the wrong thing in the spec file or something else is broken?

-----

A note on this, before introducing this change, the spec file was
structured like this:

%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
%post
%else
%post
%endif

I was trying to insert the F18+ systemd macros.

It would be very beneficial to have the new systemd macros also in
f16/f17 with the simple %systemd_post macro expanding differently if
on f16/f17.

Thanks & Regards,
--Simone






-- 
You cannot discover new oceans unless you have the courage to lose
sight of the shore (R. W. Emerson).


More information about the devel mailing list