[Rpm-maint] [rpm-software-management/rpm] Allow to specify a default for bcond features in a macro file (PR #2405)

Fabian Vogt notifications at github.com
Mon Mar 6 15:51:07 UTC 2023


> Is putting something like `%bcond foo 0%{?default_foo}` in the spec file not an option?

Technically yes, but like bconds itself which are just syntactic sugar, it would be nice to get something like this out of the box and working universally.

Currently the design of bconds makes them effectively worse than just plain macros in my experience. When just using macros like this, it's possible to provide a value in macros, allow overriding that with an `rpmbuild` parameter, specify a default in the .spec file and it can even take arbitrary values instead of just boolean ones!

```
%dnl Provide a default
%{!?enable_foo:%global enable_foo 1}
%dnl Or error out if unset
%{!?enable_foo:%error enable_foo not set}

%if %{enable_foo}
BuildRequires: foo
%else
BuildRequires: bar
%endif
```

The only benefit of bconds is that `rpmbuild` has nicer syntax for `--with(out) foo` and it's easier to translate bconds into commandline switches using the `%{?_with_foo:--foo}` syntax. I'd like something that combines the strengths of simple macros with the special benefits of bconds.

I'm not sure what's easier: Add something to make handling of macros like this easier or extend bconds to allow for more flexibility?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2405#issuecomment-1456387757
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2405/c1456387757 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20230306/44ae4fc1/attachment-0001.html>


More information about the Rpm-maint mailing list