On 03. 04. 20 22:36, Zbigniew Jędrzejewski-Szmek wrote:
On Fri, Apr 03, 2020 at 02:23:12PM -0400, Stephen Gallagher wrote:
> Fabio Valenti made this comment in the FESCo ticket[1].
>
> "Side note: I think more people would be amenable to including
> "conditionals" into their packages if they weren't only shown off as
> `%if eln this else that`. I think there's more value in doing "feature
> flags" rather than conditionalize everything based on the `dist` tag,
> for example something like this might even be useful in fedora
> branches (e.g. for bootstrapping):
>
> ```spec
> # at the top of the .spec file, where it's easily visible
> %if 0%{?eln}
> %bcond_with docs
> %else
> %bconf_without docs
> %endif
>
> # ...
>
> %if %{with docs}
> # do something
> %endif
> ```
>
> This makes conditionals (when they are necessary) much easier to
> maintain (and understand), in my experience."
This is a side topic, and I didn't want to clutter the FESCo ticket
with that. But here we have threads, so I hope that you'll forgive me ;)
If find the %bcond_with/%bcond_without pattern abhorrent.
1. The logic is reversed: when I see "with" I think something is enabled,
when I see "without" I think something is disabled. But it's actually
the other way around here, which I find very confusing and often get
the condition reversed on the first try.
2. The value ('0%{?eln}') in this example is expressed before the name
('docs'), which is like saying 'value =: name'.
3. It takes five (!) lines to express the something that should be one
line.
So... could we please get a way to express this in rpm with a sane syntax:
%define_cond docs 0%{?fedora} > 0
(Naming and details of syntax are just examples, but the important
parts are: one line, name before value, positive logic).
A followup:
https://github.com/rpm-software-management/rpm/pull/1520
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok