[Rpm-maint] [rpm-software-management/rpm] RFE: %ifarch expression (Issue #3165)

2024-06-13 Thread Zbigniew Jędrzejewski-Szmek
As discussed during the RPM Developers' Meetup during DevConf.cz: please allow %ifarch to be used inline, i.e. make it an expression or provide an a new syntax for an expression. The problem is that %ifarch is very verbose and requires at least 3 lines. It'd be nice to replace this by an inline

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: %ifarch expression (Issue #3165)

2024-06-13 Thread Michael Schroeder
That would be easy to implement with an expression: ``` %pytest %[isarch("s390x") ? "|| :" : ""] ``` Would that be ok or is it not short enough? -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/3165#issuecomment-2165629605 You are receivi

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: %ifarch expression (Issue #3165)

2024-06-13 Thread Zbigniew Jędrzejewski-Szmek
Sure, that would work. Ideally the syntax/semantics of the arg would be the same as for `%ifarch`, so that people don't introduce mistakes when moving between the two forms. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/3165#issuecom

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: %ifarch expression (Issue #3165)

2024-06-13 Thread Panu Matilainen
Well, %isarch() in all its glory is just: `%isarch() %[ "%{_target_cpu}" == "%1" ? 1 : 0 ]` And then: > $ rpm --eval "%{isarch:x86_64}" 1 $ rpm --eval "%{isarch:s390}" 0 -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/3165#issuecommen

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: %ifarch expression (Issue #3165)

2024-06-14 Thread Michael Schroeder
That's `%isarch` the macro, i used `isarch()` the expression function. But we can certainly do it with a macro. But it needs to be able a accept multiple architectures like `%{isarch:%x86_64}`. (And do we want `%{isarch %x86_64}` to work as well?) -- Reply to this email directly or view it on

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: %ifarch expression (Issue #3165)

2024-06-14 Thread Panu Matilainen
Oh, I just assumed isarch() meant a macro in there and missed some of the subtleties suggesting otherwise. Seems to be one of those days... I have no strong opinions on the details, but seems like a sane thing to have. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: %ifarch expression (Issue #3165)

2024-06-14 Thread Michael Schroeder
Using a bit of lua: ``` %contains() %{lua: for i, n in ipairs(arg) do if i > 1 and arg[1] == arg[i] then return 1 end end return 0 } %isarch() %{contains %{quote:%_target_cpu} %*} ``` -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issu