From 84fbf9b766722c438e60d0d6d9f229a181874f8a Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Sat, 8 Jun 2019 13:01:23 +0200 Subject: [PATCH] Initial import (#1717188) --- .gitignore | 1 + go-rpm-macros.spec | 167 +++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 169 insertions(+) create mode 100644 .gitignore create mode 100644 go-rpm-macros.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6998b12 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/go-rpm-macros-3.0.8.tar.gz diff --git a/go-rpm-macros.spec b/go-rpm-macros.spec new file mode 100644 index 0000000..8cc29bf --- /dev/null +++ b/go-rpm-macros.spec @@ -0,0 +1,167 @@ +%global forgeurl https://pagure.io/go-rpm-macros +Version: 3.0.8 +%forgemeta + +#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 +%global _spectemplatedir %{_datadir}/rpmdevtools/fedora +%global _docdir_fmt %{name} + +# Master definition that will be written to macro files +%global golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x +%global gccgo_arches %{mips} +# Go sources can contain arch-specific files and our macros will package the +# correct files for each architecture. Therefore, move gopath to _libdir and +# make Go devel packages archful +%global gopath %{_datadir}/gocode + +ExclusiveArch: %{golang_arches} %{gccgo_arches} + +Name: go-rpm-macros +Release: 3%{?dist} +Summary: Build-stage rpm automation for Go packages + +License: GPLv3+ +URL: %{forgeurl} +Source: %{forgesource} + +Requires: go-srpm-macros = %{version}-%{release} +Requires: go-filesystem = %{version}-%{release} +Requires: golist + +%ifarch %{golang_arches} +Requires: golang +Provides: compiler(golang) +Provides: compiler(go-compiler) = 2 +Obsoletes: go-compilers-golang-compiler < %{version}-%{release} +%endif + +%ifarch %{gccgo_arches} +Requires: gcc-go +Provides: compiler(gcc-go) +Provides: compiler(go-compiler) = 1 +Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release} +%endif + +%description +This package provides build-stage rpm automation to simplify the creation of Go +language (golang) packages. + +It does not need to be included in the default build root: go-srpm-macros will +pull it in for Go packages only. + +%package -n go-srpm-macros +Summary: Source-stage rpm automation for Go packages +BuildArch: noarch +Requires: redhat-rpm-config + +%description -n go-srpm-macros +This package provides SRPM-stage rpm automation to simplify the creation of Go +language (golang) packages. + +It limits itself to the automation subset required to create Go SRPM packages +and needs to be included in the default build root. + +The rest of the automation is provided by the go-rpm-macros package, that +go-srpm-macros will pull in for Go packages only. + +%package -n go-filesystem +Summary: Directories used by Go packages +License: Public Domain + +%description -n go-filesystem +This package contains the basic directory layout used by Go packages. + +%package -n go-rpm-templates +Summary: RPM spec templates for Go packages +License: MIT +BuildArch: noarch +Requires: go-rpm-macros = %{version}-%{release} +#https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 +#Requires: redhat-rpm-templates + +%description -n go-rpm-templates +This package contains documented rpm spec templates showcasing how to use the +macros provided by go-rpm-macros to create Go packages. + +%prep +%forgesetup +%writevars -f rpm/macros.d/macros.go-srpm golang_arches gccgo_arches gopath +for template in templates/rpm/*\.spec ; do + target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g") + grep -v '^#' "${template}" > "${target}" + touch -r "${template}" "${target}" +done + +%install +# Some of those probably do not work with gcc-go right now +# This is not intentional, but mips is not a primary Fedora architecture +# Patches and PRs are welcome + +install -m 0755 -vd %{buildroot}%{gopath}/src + +install -m 0755 -vd %{buildroot}%{_spectemplatedir} + +install -m 0644 -vp templates/rpm/*spec \ + %{buildroot}%{_spectemplatedir} + +install -m 0755 -vd %{buildroot}%{_bindir} +install -m 0755 bin/* %{buildroot}%{_bindir} + +install -m 0755 -vd %{buildroot}%{rpmmacrodir} +install -m 0644 -vp rpm/macros.d/macros.go-* \ + %{buildroot}%{rpmmacrodir} +install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/srpm +install -m 0644 -vp rpm/lua/srpm/*lua \ + %{buildroot}%{_rpmluadir}/fedora/srpm +install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/rpm +install -m 0644 -vp rpm/lua/rpm/*lua \ + %{buildroot}%{_rpmluadir}/fedora/rpm +install -m 0755 -vd %{buildroot}%{_rpmconfigdir}/fileattrs +install -m 0644 -vp rpm/fileattrs/*.attr \ + %{buildroot}%{_rpmconfigdir}/fileattrs/ +install -m 0755 -vp rpm/*\.{prov,deps} \ + %{buildroot}%{_rpmconfigdir}/ + +%ifarch %{golang_arches} +install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \ + %{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-golang +%endif + +%ifarch %{gccgo_arches} +install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \ + %{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-gcc +%endif + +%files +%license LICENSE.txt +%doc README.md +%{_bindir}/* +%{_rpmconfigdir}/fileattrs/*.attr +%{_rpmconfigdir}/*.prov +%{_rpmconfigdir}/*.deps +%{_rpmconfigdir}/macros.d/macros.go-rpm* +%{_rpmconfigdir}/macros.d/macros.go-compiler* +%{_rpmluadir}/fedora/rpm/*.lua + +%files -n go-srpm-macros +%license LICENSE.txt +%doc README.md +%{_rpmconfigdir}/macros.d/macros.go-srpm +%{_rpmluadir}/fedora/srpm/*.lua + +%files -n go-filesystem +%dir %{gopath} +%dir %{gopath}/src + +%files -n go-rpm-templates +%license LICENSE-templates.txt +%doc README.md +# https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 +%dir %{dirname:%{_spectemplatedir}} +%dir %{_spectemplatedir} +%{_spectemplatedir}/*.spec + +%changelog +* Wed Jun 05 2019 Nicolas Mailhot +- 3.0.8-3 +- initial Fedora import, for golist 0.10.0 and redhat-rpm-config 130 diff --git a/sources b/sources new file mode 100644 index 0000000..cfcc20a --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (go-rpm-macros-3.0.8.tar.gz) = 1ad7054125f8e1bcad49984bcd695f57eb9410ee79d9f0d63bfba7f8a65ffa62f82e3e071922823091fe4c3445b1bb0f788a625529d1a226a5192cb9ccf6e3cd