The package rpms/go-srpm-macros.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s): https://src.fedoraproject.org/cgit/rpms/go-srpm-macros.git/commit/?id=f0446f....
Change: +ExclusiveArch: %{go_arches}
Thanks.
Full change: ============
commit f0446f4fcb8bab1e8b1eca16975e9a3ba5804c5c Author: Jan Chaloupka jchaloup@redhat.com Date: Fri Feb 23 13:45:26 2018 +0100
Update only the macros.go-srpm file, the upstream tarball can not be found
diff --git a/go-srpm-macros.spec b/go-srpm-macros.spec index 5800ca0..ae50eaf 100644 --- a/go-srpm-macros.spec +++ b/go-srpm-macros.spec @@ -1,13 +1,10 @@ -%global commit 032dc836b8d97a494b555764245ca00d3f1c062e -%global shortcommit %(c=%{commit}; echo ${c:0:7}) - Name: go-srpm-macros Version: 2 -Release: 12%{?dist} +Release: 13%{?dist} Summary: RPM macros for building Golang packages for various architectures Group: Development/Libraries License: GPLv3+ -Source0: https://github.com/gofed/go-macros/archive/%%7Bcommit%7D/go-macros-%%7Bshort... +Source0: macros.go-srpm BuildArch: noarch # for install command BuildRequires: coreutils @@ -17,19 +14,22 @@ The package provides macros for building projects in Go on various architectures.
%prep -%setup -q -n go-macros-%{commit} +# nothing to build, just for hooks
%build # nothing to build, just for hooks
%install -install -m 644 -D rpm/macros.d/macros.go-srpm \ - %{buildroot}%{_rpmconfigdir}/macros.d/macros.go-srpm +install -m 644 -D %{SOURCE0} \ + '%{buildroot}%{_rpmconfigdir}/macros.d/macros.go-srpm'
%files %{_rpmconfigdir}/macros.d/macros.go-srpm
%changelog +* Fri Feb 23 2018 Jan Chaloupka jchaloup@redhat.com - 2-13 +- Update only the macros.go-srpm file, the upstream tarball can not be found + * Fri Feb 23 2018 Jan Chaloupka jchaloup@redhat.com - 2-12 - Install go-srpm macros from an upstream tarball
diff --git a/macros.go-srpm b/macros.go-srpm index 90b3c78..ef60f37 100644 --- a/macros.go-srpm +++ b/macros.go-srpm @@ -1,4 +1,6 @@ -# Copyright (c) 2015 Jakub Cajka jcajka@redhat.com, Jan Chaloupka jchaloup@redhat.com +# Copyright (c) 2015-2018 Jakub Cajka jcajka@redhat.com, +# Jan Chaloupka jchaloup@redhat.com, +# Nicolas Mailhot nim@fedoraproject.org # This file is distributed under the terms of GNU GPL license version 3, or # any later version.
@@ -6,7 +8,8 @@ # with golang compiler or gcc-go compiler based on an architecture. # Golang is primarly for primary architectures, gcc-go for secondary. # -# This file provides only macros and must not use any other package. +# This file provides only macros and must not use any other package except +# redhat-rpm-macros.
# Define arches for PA and SA %golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x @@ -18,3 +21,119 @@
# Define go_compilers macro to signal go-compiler package is available %go_compiler 1 + +# Sanitize a Go import path that can then serve as rpm package name +# Mandatory parameter: a Go import path +%gorpmname() %{lua: +local goname = rpm.expand("%1") +-- add a golang prefix and lowercase +goname = string.lower("golang-" .. goname .. "/") +-- replace various separators rpm does not like with - +-- special-case x.y.z number-strings as that’s an exception in our naming +-- guidelines +goname = string.gsub(goname, "^([^/]+)%.([^%./]+)/", "%1/") +goname = string.gsub(goname, "(%d)%.(%d)", "%1|%2") +goname = string.gsub(goname, "[%._/%-]+", "-") +-- Tokenize along - separators and remove duplicates to avoid +-- golang-foo-foo-bar-foo names +local result = "" +local tokens = {} +tokens["go"] = true +tokens["git"] = true +for token in string.gmatch(goname, "[^%-]+") do + if not tokens[token] then + result = result .. "-" .. token + tokens[token] = true + end +end +-- reassemble the string, restore x.y.z runs, convert the vx.y.z +-- Go convention to x.y.z as prefered in rpm naming +result = string.gsub(result, "^-", "") +result = string.gsub(result, "|", ".") +result = string.gsub(result, "%-v([%.%d])", "%1") +print(result) +} + +# forgemeta macro is available in Rawhide only. Thus, it can't be used to generate +# source URL for other Fedora distribution. Until the macro is available there, +# the source URL needs to be crafted manually +%gocraftmeta(vi) %{expand:%{lua: +-- Be explicit about the spec variables we’re setting +local function explicitset(rpmvariable,value) + rpm.define(rpmvariable .. " " .. value) + if (rpm.expand("%{?-v}") ~= "") then + rpm.expand("%{echo:Setting %%{" .. rpmvariable .. "} = " .. value .. "\n}") + end +end +-- Never ever stomp on a spec variable the packager already set +local function safeset(rpmvariable,value) + if (rpm.expand("%{?" .. rpmvariable .. "}") == "") then + explicitset(rpmvariable,value) + end +end +function string.starts(String,Start) + return string.sub(String,1,string.len(Start))==Start +end +-- All the Go packaging automation relies on gobaseipath being set +local gobaseipath = rpm.expand("%{?gobaseipath}") +if (gobaseipath == "") then + rpm.expand("%{error:Please set the Go import path in the “gobaseipath” variable before calling “gometa”!}") +end +local commit = rpm.expand("%{?commit}") +if (commit == "") then + rpm.expand("%{error:Please set the Go import path commit in the “commit” variable before calling “gometa”!}") +end +local provider_prefix = rpm.expand("%{?provider_prefix}") +if (provider_prefix == "") then + rpm.expand("%{error:Please set the Go project provider prefix in the “provider_prefix” variable before calling “gometa”!}") +end +------------------------------------ +-- Compute and set spec variables -- +------------------------------------ +safeset("gourl", "https://" .. gobaseipath) +safeset("goname", "%gorpmname %{gobaseipath}") +------------------------ +-- gosource & gosetup -- +------------------------ +if string.starts(provider_prefix, "github.com") then +-- github.com/PROJECT/REPO + index = 0 + for part in string.gmatch(provider_prefix, "[^/]+") do + if index == 2 then + safeset("gosource", "https://%%7Bprovider_prefix%7D/%%7Bcommit%7D/" .. part .. "-" .. rpm.expand("%{shortcommit}") .. ".tar.gz") + safeset("gosetup", "%setup -q -n " .. part .. "-%{commit}") + end + index = index + 1 + end + safeset("shortcommit", rpm.expand("%(c=%{commit}; echo ${c:0:7})")) +elseif string.starts(provider_prefix, "bitbucket.org") then + index = 0 + project = "" + for part in string.gmatch(provider_prefix, "[^/]+") do + if index == 1 then + project = part + elseif index == 2 then + safeset("gosource", "https://%%7Bprovider_prefix%7D/get/" .. rpm.expand("%{shortcommit}") .. ".tar.gz") + safeset("gosetup", "%setup -q -n " .. project .. "-" .. part .. "-" .. rpm.expand("%{shortcommit}")) + end + index = index + 1 + end + safeset("shortcommit", rpm.expand("%(c=%{commit}; echo ${c:0:12})")) +end +-- Final spec variable summary if the macro was called with -i +if (rpm.expand("%{?-i}") ~= "") then + rpm.expand("%{echo:Go-specific packaging variables\n}") + rpm.expand("%{echo: gobaseipath: %{?gobaseipath}\n}") + rpm.expand("%{echo: goname: %{?goname}\n}") + rpm.expand("%{echo: gourl: %{?gourl}\n}") + rpm.expand("%{echo: gosource: %{?gosource}\n}") + rpm.expand("%{echo: gosetup: %{?gosetup}\n}") + rpm.expand("%{echo: shortcommit: %{?shortcommit}\n}") +end +} +# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required +ExclusiveArch: %{go_arches} +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +} +
arch-excludes@lists.fedoraproject.org