On Tue, Apr 28, 2020 at 9:55 AM Nicolas Mailhot via devel
<[email protected]> wrote:
>
> Le mardi 28 avril 2020 à 08:43 +0200, Petr Pisar a écrit :
> > On Mon, Apr 27, 2020 at 04:33:52PM +0200, Petr Šabata wrote:
> > >
> > > %_use_ncurses %{lua:
> > > if rpm.expand("%{name}") == "yourpackage1"
> > > or rpm.expand("%{name}") == "yourpackage2" then
> > > print(rpm.expand("%{bcond_with foo}%{with foo}"))
> > > else
> > > print(rpm.expand("%{bcond_without foo}%{with foo}"))
> > > end
> > > }
>
> %{name} use in macro logic is unsafe because %{name} does not exist in
> the preamble before the Name: line, and the Name: line does not exist
> before you start declaring package headers.
>
> Once you’re in package
> header declaration mode rpm parser behaviour will prevent you from
> doing logic between headers blocks, so it all needs interleaving, which
> ends un not possible sanely in any semi-complex spec file.
You're correct but I can't think of any solution besides not using the
macros before you define Name, just like in your example below. It's
certainly a drawback.
P
> The rpm parser will now insult you with messages like
> warning: undefined macro(s) in %{_sourcedir}:
> /var/lib/builder/rpmbuild/SOURCES/%{name}
>
> if you try to use %{name} at the srpm level.
>
> This is an rpm 4.15 change
> https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/83
>
> Regards,
>
> --
> Nicolas Mailhot
_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]