2019-06-08 11:01:23 +00:00
|
|
|
%global forgeurl https://pagure.io/go-rpm-macros
|
2024-07-24 12:29:15 +00:00
|
|
|
Version: 3.6.0
|
2019-06-08 11:01:23 +00:00
|
|
|
%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
|
2024-07-18 07:33:37 +00:00
|
|
|
%global golang_arches_future x86_64 x86_64_v2 %{arm} aarch64 ppc64le s390x riscv64
|
2022-07-29 23:15:20 +00:00
|
|
|
%global golang_arches %{ix86} %{golang_arches_future}
|
2019-06-08 11:01:23 +00:00
|
|
|
%global gccgo_arches %{mips}
|
2021-02-11 21:48:57 +00:00
|
|
|
%if 0%{?rhel} >= 9
|
2024-07-18 07:33:37 +00:00
|
|
|
%global golang_arches x86_64 x86_64_v2 aarch64 ppc64le s390x
|
2021-02-11 21:48:57 +00:00
|
|
|
%endif
|
2019-06-08 11:01:23 +00:00
|
|
|
# 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
|
|
|
|
|
2023-06-20 21:18:09 +00:00
|
|
|
# whether to bundle golist or require it as a dependency
|
|
|
|
%if 0%{?rhel}
|
|
|
|
%ifarch %{golang_arches} %{gccgo_arches}
|
|
|
|
%global bundle_golist 1
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
2023-10-29 16:43:46 +00:00
|
|
|
%global golist_version 0.10.4
|
2023-06-20 21:18:09 +00:00
|
|
|
%if 0%{?bundle_golist}
|
|
|
|
# do not create debuginfo packages when we add a build section
|
|
|
|
%global debug_package %{nil}
|
2023-06-22 18:06:38 +00:00
|
|
|
%global golist_builddir golist-%{golist_version}
|
2023-06-20 21:18:09 +00:00
|
|
|
%global golist_goipath pagure.io/golist
|
|
|
|
# where to bundle the golist executable
|
|
|
|
%global golist_execdir %{_libexecdir}/go-rpm-macros
|
|
|
|
# define gobuild to avoid this package requiring itself to build
|
|
|
|
%define gobuild(o:) GO111MODULE=on go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '${LDFLAGS:-} '" -a -v %{?**};
|
|
|
|
%else
|
|
|
|
%global debug_package %{nil}
|
|
|
|
%endif
|
|
|
|
|
2019-06-08 11:01:23 +00:00
|
|
|
Name: go-rpm-macros
|
2024-09-03 06:23:23 +00:00
|
|
|
Release: 1%{?dist}.alma.1
|
2019-06-08 11:01:23 +00:00
|
|
|
Summary: Build-stage rpm automation for Go packages
|
|
|
|
|
2022-08-08 14:37:34 +00:00
|
|
|
License: GPL-3.0-or-later
|
2019-06-08 11:01:23 +00:00
|
|
|
URL: %{forgeurl}
|
|
|
|
Source: %{forgesource}
|
2023-06-20 21:18:09 +00:00
|
|
|
Source1: https://pagure.io/golist/archive/v%{golist_version}/golist-%{golist_version}.tar.gz
|
|
|
|
# vendored dependency tarball, to create:
|
|
|
|
# tar xf golist-%%{golist_version}.tar.gz ; pushd golist-%%{golist_version} ; \
|
|
|
|
# go mod init %%{golist_goipath} && go mod tidy && go mod vendor && \
|
|
|
|
# tar Jcf ../golist-%%{golist_version}-vendor.tar.xz go.mod go.sum vendor/ ; popd
|
|
|
|
Source2: golist-%{golist_version}-vendor.tar.xz
|
2019-06-08 11:01:23 +00:00
|
|
|
|
|
|
|
Requires: go-srpm-macros = %{version}-%{release}
|
|
|
|
Requires: go-filesystem = %{version}-%{release}
|
2023-06-20 21:18:09 +00:00
|
|
|
|
|
|
|
%if 0%{?bundle_golist}
|
|
|
|
BuildRequires: golang
|
|
|
|
Provides: bundled(golist) = %{golist_version}
|
|
|
|
%else
|
2019-06-08 11:01:23 +00:00
|
|
|
Requires: golist
|
2023-06-20 21:18:09 +00:00
|
|
|
%endif
|
2019-06-08 11:01:23 +00:00
|
|
|
|
|
|
|
%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
|
2022-08-09 00:18:31 +00:00
|
|
|
License: LicenseRef-Fedora-Public-Domain
|
2019-06-08 11:01:23 +00:00
|
|
|
|
|
|
|
%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
|
2022-03-25 18:36:52 +00:00
|
|
|
# go-rpm-macros only exists on some architectures, so this package cannot be noarch
|
2019-06-08 11:01:23 +00:00
|
|
|
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
|
2023-06-22 18:06:38 +00:00
|
|
|
%autosetup -p1 %{forgesetupargs} -a1
|
2022-07-29 23:15:20 +00:00
|
|
|
%writevars -f rpm/macros.d/macros.go-srpm golang_arches golang_arches_future gccgo_arches gopath
|
2019-06-08 11:01:23 +00:00
|
|
|
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
|
|
|
|
|
2023-06-20 21:18:09 +00:00
|
|
|
# unpack golist and vendor deps
|
|
|
|
%if 0%{?bundle_golist}
|
2023-06-22 18:06:38 +00:00
|
|
|
tar -C %{golist_builddir} -xf %{SOURCE2}
|
|
|
|
cp %{golist_builddir}/LICENSE LICENSE-golist
|
2023-06-20 21:18:09 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%build
|
|
|
|
# build golist
|
|
|
|
%if 0%{?bundle_golist}
|
|
|
|
pushd %{golist_builddir}
|
|
|
|
for cmd in cmd/* ; do
|
2023-06-22 18:06:38 +00:00
|
|
|
%gobuild -o bin/$(basename $cmd) ./$cmd
|
2023-06-20 21:18:09 +00:00
|
|
|
done
|
|
|
|
popd
|
|
|
|
%endif
|
|
|
|
|
2019-06-08 11:01:23 +00:00
|
|
|
%install
|
2022-03-25 18:36:52 +00:00
|
|
|
install -m 0755 -vd %{buildroot}%{rpmmacrodir}
|
|
|
|
|
|
|
|
install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/srpm
|
|
|
|
install -m 0644 -vp rpm/lua/srpm/*lua \
|
|
|
|
%{buildroot}%{_rpmluadir}/fedora/srpm
|
|
|
|
|
|
|
|
%ifarch %{golang_arches} %{gccgo_arches}
|
2019-06-08 11:01:23 +00:00
|
|
|
# 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}
|
|
|
|
|
2022-08-08 14:29:10 +00:00
|
|
|
install -m 0644 -vp rpm/macros.d/macros.go-*rpm* \
|
2019-06-08 11:01:23 +00:00
|
|
|
%{buildroot}%{rpmmacrodir}
|
|
|
|
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}/
|
2022-03-25 18:36:52 +00:00
|
|
|
%else
|
|
|
|
install -m 0644 -vp rpm/macros.d/macros.go-srpm \
|
|
|
|
%{buildroot}%{rpmmacrodir}
|
|
|
|
%endif
|
2019-06-08 11:01:23 +00:00
|
|
|
|
|
|
|
%ifarch %{golang_arches}
|
2022-08-08 14:29:10 +00:00
|
|
|
install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang{,-pie} \
|
|
|
|
%{buildroot}%{_rpmconfigdir}/macros.d/
|
2019-06-08 11:01:23 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%ifarch %{gccgo_arches}
|
|
|
|
install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \
|
2022-08-08 14:29:10 +00:00
|
|
|
%{buildroot}%{_rpmconfigdir}/macros.d/
|
2019-06-08 11:01:23 +00:00
|
|
|
%endif
|
|
|
|
|
2023-06-20 21:18:09 +00:00
|
|
|
# install golist
|
|
|
|
%if 0%{?bundle_golist}
|
|
|
|
install -m 0755 -vd %{buildroot}%{golist_execdir}
|
|
|
|
install -m 0755 -vp %{golist_builddir}/bin/* %{buildroot}%{golist_execdir}/
|
|
|
|
sed -i "s,golist ,%{golist_execdir}/golist ,g" \
|
|
|
|
%{buildroot}%{_bindir}/go-rpm-integration \
|
|
|
|
%{buildroot}%{_rpmconfigdir}/gosymlink.deps \
|
|
|
|
%{buildroot}%{_rpmmacrodir}/macros.go-rpm
|
|
|
|
%endif
|
|
|
|
|
2022-03-25 18:36:52 +00:00
|
|
|
%ifarch %{golang_arches} %{gccgo_arches}
|
2019-06-08 11:01:23 +00:00
|
|
|
%files
|
2023-06-22 18:06:38 +00:00
|
|
|
%license LICENSE.txt
|
|
|
|
%if %{defined bundle_golist}
|
|
|
|
%license LICENSE-golist %{golist_builddir}/vendor/modules.txt
|
|
|
|
%endif
|
2019-06-08 11:01:23 +00:00
|
|
|
%doc README.md
|
|
|
|
%{_bindir}/*
|
|
|
|
%{_rpmconfigdir}/fileattrs/*.attr
|
|
|
|
%{_rpmconfigdir}/*.prov
|
|
|
|
%{_rpmconfigdir}/*.deps
|
2022-09-02 14:23:06 +00:00
|
|
|
%{_rpmmacrodir}/macros.go-rpm*
|
|
|
|
%{_rpmmacrodir}/macros.go-compiler*
|
2019-06-08 11:01:23 +00:00
|
|
|
%{_rpmluadir}/fedora/rpm/*.lua
|
2023-06-20 21:18:09 +00:00
|
|
|
# package golist
|
|
|
|
%if 0%{?bundle_golist}
|
|
|
|
%{golist_execdir}/golist
|
|
|
|
%endif
|
|
|
|
|
2019-06-08 11:01:23 +00:00
|
|
|
|
|
|
|
%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
|
|
|
|
|
2022-03-25 18:36:52 +00:00
|
|
|
%files -n go-filesystem
|
|
|
|
%dir %{gopath}
|
|
|
|
%dir %{gopath}/src
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# we only build go-srpm-macros on all architectures
|
|
|
|
%files -n go-srpm-macros
|
|
|
|
%license LICENSE.txt
|
|
|
|
%doc README.md
|
2022-09-02 14:23:06 +00:00
|
|
|
%{_rpmmacrodir}/macros.go-srpm
|
2022-03-25 18:36:52 +00:00
|
|
|
%{_rpmluadir}/fedora/srpm/*.lua
|
|
|
|
|
2019-06-08 11:01:23 +00:00
|
|
|
%changelog
|
2024-09-03 06:23:23 +00:00
|
|
|
* Tue Sep 02 2024 Eduard Abdullin <eabdullin@almalinux.org> - 3.6.0-1.alma.1
|
|
|
|
- Add x86_64_v2 to arch list
|
|
|
|
|
|
|
|
* Wed Jul 24 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-1
|
|
|
|
- Update to 3.6.0
|
|
|
|
|
|
|
|
* Wed Jun 26 2024 Edjunior Machado <emachado@redhat.com> - 3.3.0-5
|
|
|
|
- Add rpminspect.yaml
|
|
|
|
|
|
|
|
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.3.0-4
|
|
|
|
- Bump release for June 2024 mass rebuild
|
|
|
|
|
|
|
|
* Thu May 23 2024 Alejandro Sáez <asm@redhat.com> - 3.3.0-3
|
|
|
|
- Remove explicit dependency of forge-srpm-macros
|
|
|
|
|
|
|
|
* Fri May 03 2024 Edjunior Machado <emachado@redhat.com> - 3.3.0-2
|
|
|
|
- gating.yaml: Add gating config for rhel-10
|
|
|
|
|
|
|
|
* Sun Oct 29 2023 Robert-André Mauchin <zebob.m@gmail.com> - 3.3.0-1
|
|
|
|
- Update to 3.3.0
|
|
|
|
|
|
|
|
* Sun Oct 29 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.2.0-9
|
|
|
|
- Update golist to 0.10.4
|
|
|
|
|
|
|
|
* Thu Sep 07 2023 Maxwell G <maxwell@gtmx.me> - 3.2.0-8
|
|
|
|
- Add explicit dependency on forge-srpm-macros
|
|
|
|
|
|
|
|
* Thu Jun 22 2023 Maxwell G <maxwell@gtmx.me> - 3.2.0-7
|
|
|
|
- Simplify golist tarball unpacking
|
|
|
|
|
|
|
|
* Tue Jun 20 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 3.2.0-6
|
|
|
|
- Bundle golist in RHEL builds
|
|
|
|
|
|
|
|
* Mon Apr 24 2023 Edjunior Machado <emachado@redhat.com> - 3.2.0-4
|
|
|
|
- tests: Fix fmf plan deprecated attributes
|
|
|
|
|
|
|
|
* Sun Apr 16 2023 Nianqing Yao <imbearchild@outlook.com> - 3.2.0-3
|
|
|
|
- Add riscv64 to %golang_arches
|
|
|
|
|
|
|
|
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-2
|
|
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
|
|
|
|
|
|
|
* Fri Sep 02 2022 Maxwell G <gotmax@e.email> - 3.2.0-1
|
|
|
|
- Update to 3.2.0.
|
|
|
|
|
|
|
|
* Fri Sep 02 2022 Maxwell G <gotmax@e.email> - 3.1.0-5
|
|
|
|
- Use %{_rpmmacrodir} macro
|
|
|
|
|
|
|
|
* Tue Aug 09 2022 Maxwell G <gotmax@e.email> - 3.1.0-4
|
|
|
|
- Use correct SPDX identifier for Public Domain
|
|
|
|
|
|
|
|
* Mon Aug 08 2022 Maxwell G <gotmax@e.email> - 3.1.0-3
|
|
|
|
- Convert top level license to SPDX.
|
|
|
|
|
|
|
|
* Mon Aug 08 2022 Maxwell G <gotmax@e.email> - 3.1.0-2
|
|
|
|
- Stop installing duplicate go-compilers macros
|
|
|
|
|
|
|
|
* Mon Aug 08 2022 Maxwell G <gotmax@e.email> - 3.1.0-1
|
|
|
|
- Update to 3.1.0.
|
|
|
|
|
|
|
|
* Fri Jul 29 2022 Maxwell G <gotmax@e.email> - 3.0.15-4
|
|
|
|
- Add %%golang_arches_future macro
|