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

Michael Schroeder notifications at github.com
Thu Mar 2 13:49:02 UTC 2023


The bcond mechanism of rpm allows to specify a default for a feature in a spec file, which can be overridden with the command line. SUSE wants to build packages with the same source in different projects. Thus we need a way to specify a default via an rpm macro.

Our first try was to misuse the command line feature by putting `%_with_foo 1` in the macros. But that has two disadvantages: it breaks the command line and it makes it impossible to change the default in a derived project, as rpm cannot undefine macros in a macrofile and the bcond implementation only checks for definedness.

So here's a small addition that makes it possible to set feature defaults: Feature `foo` can be enabled by adding
the macro
```
%bcond_default_foo 1
```
The mechanism uses expression evaluation, so it is possible to remove a default by using %nil as default.

Maybe we can use a better name as `bcond_default`. Any suggestions?

(The pull request is missing documentation and test cases, so do not merge)

You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/2405

-- Commit Summary --

  * Allow to specify a default for bcond features in a macro file

-- File Changes --

    M macros.in (3)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/2405.patch
https://github.com/rpm-software-management/rpm/pull/2405.diff

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

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


More information about the Rpm-maint mailing list