Understanding rpm macros

Hi all,

For the last few days i was trying to learn how rpm packaging works and was looking at various examples from the fedora repo.

For a more complex one i looked the gnutls spec file but i am a bit confused how the macros that define the conditional options work.

For example there is

%if 0%{?fedora} && 0%{?fedora} < 38
%bcond_without srp
%else
%bcond_with srp
%endif

[...]
%configure 
[...]
%if %{with srp}
           --enable-srp-authentication \
%endif

Trying to understand this code i think this should add --enable-srp-authentication flag to configure in fedora 38+.

However when i then checked the corresponding build log

the flag does not seem to get passed to configure and i find in the output

checking whether to enable SRP authentication support... no

which confuses me.

Is there something i am misunderstanding about this?
Thanks.

2 Likes

Added devel, package-maintainers, rpm

From Ask Fedora to Project Discussion

Removed engineering, f38, rpm

What it’s saying is:

  • if it’s Fedora < 38:
  • enable srp (bcond_without means it’s on and can be disabled with a --without flag to the builder/rpm process
  • else (for F38+) don’t enable srp, but add a command line option to enable it

Basically, the confusion is because of bcond_without, which means `enabled but add command line option to disable. It’s confusing and so we’ve got new flags for this. See the docs:

https://rpm-software-management.github.io/rpm/manual/conditionalbuilds.html

3 Likes

Thanks that makes a lot more sense now.

1 Like