Hello packaging folks.
I was in need of computing an intersection of 2 arches today.
Consider this:
%java_arches: aarch64 ppc64le s390x x86_64
%my_arches: i686 x86_64
Plan:
ExclusiveArch: <intersection of %java_arches and %my_arches>
Is there some idiomatic way of doing this? I came up with:
ExclusiveArch: %(comm -12 <(echo %{java_arches} | tr ' ' '\n' | sort) \
<(echo %{my_arches} | tr ' ' '\n' | sort) | tr '\n' ' ')
Which I consider quite horrible.
I was considering Lua to avid shelling out to nested Shell, but Lua has no easy
sets, so the code would be much longer.
Is there some easier way? Should there be? Something like:
ExclusiveArch: %{arch_intersect %java_arches & %my_arches}
Note the & that serves as a separator, otherwise the arches would be mixed and
would need to be put in some kind of quotes. Alternatively, the macro names
could be passed instead to avoid a need of a separator
ExclusiveArch: %{arch_intersect java_arches my_arches}
(Both approaches allow to intersect arbitrary number of sets.)
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok