Packaging golang for secondary architectures, go-srpm-macros

Jan Chaloupka jchaloup at
Thu Jul 9 10:59:40 UTC 2015

On 07/09/2015 12:49 PM, Petr Pisar wrote:
> On 2015-07-09, Jan Chaloupka <jchaloup at> wrote:
>> # Define arches for PA and SA
>> %golang_arches   %{ix86} x86_64 %{arm}
> [...]
>> Recommended use in spec file:
>> 1) To choose the correct compiler:
>> %ifarch %{golang_arches}
>> BuildRequires: golang
>> %else
>> BuildRequires: gcc-go >= %{gccgo_min_vers}
>> %endif
> This will not work. A source package is built on random architecture,
> thus using %ifarch to define BuildRequire will provide random results.

Yes. SRPM is generated on random architecture. However spec file in 
generated SRPM is untouched. Once rpm is being built correct 
architectures is chosen based on BuildArch/ExclusiveArch tag. The above 
piece of a code is again reevaluated. But this time %ifarch is tested 
based on the chosen architecture. Thus the correct compiler is taken.

Even if the rpm is noarch, %ifarch x86_64 still works if it is built on 
x86_64. %ifarch noarch is false. Or maybe koji works differently?

> (And maybe while building a source package, the RPM architecture is
> redefined to `noarch' value.)
> -- Petr

More information about the devel mailing list