From 4269fce7f7cbc694a61a9f97220bacb573d98426 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Jul 30 2022 10:49:00 +0000 Subject: Introduce %golang_arches_future and stop using %go_arches This introduces a new %golang_arches_future macro that is the same as %golang_arches but without %ix86. This way, packagers can replace ExclusvieArch: %go_arches or %golang_arches with it to exclude their package from the aforementioned architecture. For packages that use %gometa, they simply need to pass the -f flag, which makes the package exclusive to %golang_arches_future, instead of %golang_arches. %gometa was also updated to generate ExclusiveArch: %{golang_arches} instead of on %{go_arches}, by default, as %{go_arches} includes %{gccgo_arches}, which only includes architectures that Fedora does not actually build against. --- diff --git a/rpm/macros.d/macros.go-srpm b/rpm/macros.d/macros.go-srpm index 884463f..a46f81f 100644 --- a/rpm/macros.d/macros.go-srpm +++ b/rpm/macros.d/macros.go-srpm @@ -25,6 +25,10 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Define arches for PA and SA + +# There is no %%go_arches_future that contains %%gccgo_arches, as +# %%gccgo_arches don't match any currently supported Fedora architectures +%golang_arches_future @@GOLANG_ARCHES_FUTURE@@ %golang_arches @@GOLANG_ARCHES@@ %gccgo_arches @@GCCGO_ARCHES@@ %go_arches %{golang_arches} %{gccgo_arches} @@ -104,9 +108,16 @@ print(go.rpmname("%1", "%{-c*}")) # -v Be verbose and print every spec variable the macro sets. # -i Print some info about the state of spec variables the macro may use or # set at the end of the processing. -%gometa(az:svi) %{lua: +# -f Use ExclusiveArch: %%{golang_arches_future}, which excludes the package +# from %ix86. All new go packages should use this option. +%gometa(az:svif) %{lua: +if rpm.expand("%{-f}") == "" then + exclusive_arches = "%{golang_arches}" +else + exclusive_arches = "%{golang_arches_future}" +end print( "BuildRequires: go-rpm-macros\\n") -print(rpm.expand("ExclusiveArch: %{go_arches}\\n")) +print(rpm.expand("ExclusiveArch: " .. exclusive_arches .. "\\n")) local fedora = require "fedora.common" local go = require "fedora.srpm.go" local verbose = rpm.expand("%{-v}") ~= ""