[Rpm-maint] [rpm-software-management/rpm] Support triple operator for conditional shortcut (#115) (#746)

pavlinamv notifications at github.com
Tue Jul 9 14:10:52 UTC 2019


> The exact syntax is subject to endless bikeshedding of course, but one thing that strikes me as just wrong are the surrounding spaces everywhere. There are no "courtesy spaces" for readability anywhere in rpm macros, I dont think this should be any different. 

Here are 2 relevant examples from the current spec files (the most frequently used):
```%global with_lua %{?_without_lua: 0} %{?!_without_lua: 1}```
```%{?gitdate:%{gitdate}}%{?!gitdate:%{version}}```

Without "courtesy spaces" the whole triple conditional macro looks:
```%global with_lua %{?{_without_lua}:0:1}```
```%{?{gitdate}:%{gitdate}:%{version}}```

But with spaces it looks better:
```%global with_lua %{?{_without_lua} : 0 : 1}```
```%{?{gitdate} : %{gitdate} : %{version}}```


Note that inside conditionally expanded macros packagers tend to use spaces after ':' even if there are not supported. Thus it looks that packagers prefer to use spaces that help to have the macro readable.

> This also makes me wonder if it's really worth the added complexity, it's merely syntactic sugar afterall.

It is a syntactic sugar, but it will help to improve packager experience with spec files.

> Any particular reason for this specific syntax over the others discussed in the ticket?

I asked several packagers and this was the preferred syntax.  FYI remaining possibilities are 
```%{? {_without_lua} : 0 ! 1 }```
```%{? {_without_lua} ? 0 ! 1 }```
```%{? {_without_lua} ? 0 : 1 }```
```%{?: _without_lua : 0 : 1 }```
```%{? _without_lua ?  0 : 1 }```

> Oh and to make it clear, this is strictly 4.16 material, we don't want changes this drastic at this point in 4.15 cycle, so there's all the time in the world for review and further discussion.

I have a deadline - 4th October.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/746#issuecomment-509658688
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190709/5374f7f1/attachment.html>


More information about the Rpm-maint mailing list