Re: %bcond_with/%bcond_without

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux