Compare commits

...

No commits in common. "c9-beta" and "c9s" have entirely different histories.
c9-beta ... c9s

10 changed files with 90 additions and 54 deletions

8
.gitignore vendored
View File

@ -1,2 +1,6 @@
SOURCES/go-rpm-macros-3.6.0.tar.gz /go-rpm-macros-3.0.8.tar.gz
SOURCES/golist-0.10.4.tar.gz /go-rpm-macros-3.0.9.tar.gz
/golist-0.10.1.tar.gz
/go-rpm-macros-3.2.0.tar.gz
/go-rpm-macros-3.6.0.tar.gz
/golist-0.10.4.tar.gz

View File

@ -1,2 +0,0 @@
9db262bd1b5acd1c3490d55b839819a878e6659c SOURCES/go-rpm-macros-3.6.0.tar.gz
4a105131658d029fe0b2d312b078a056748af2b4 SOURCES/golist-0.10.4.tar.gz

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# go-rpm-macros
The go-rpm-macros package

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -18,25 +18,26 @@ Version: 3.6.0
# make Go devel packages archful # make Go devel packages archful
%global gopath %{_datadir}/gocode %global gopath %{_datadir}/gocode
# whether to bundle golist or require it as a dependency
%global bundle_golist 1 %global bundle_golist 1
%if 0%{?bundle_golist}
# do not create debuginfo packages when we add a build section
%global debug_package %{nil}
%global golist_version 0.10.4 %global golist_version 0.10.4
%global golist_builddir %{_builddir}/golist-%{golist_version}/_build %if 0%{?bundle_golist}
%global golist_builddir golist-%{golist_version}
%global golist_goipath pagure.io/golist %global golist_goipath pagure.io/golist
# where to bundle the golist executable # where to bundle the golist executable
%global golist_execdir %{_libexecdir}/go-rpm-macros/ %global golist_execdir %{_libexecdir}/go-rpm-macros
# define gobuild to avoid this package requiring itself to build # define gobuild to avoid this package requiring itself to build
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v %{?**}; %undefine _auto_set_build_flags
%global _dwz_low_mem_die_limit 0
%define gobuild(o:) GO111MODULE=on go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${GO_BUILDTAGS-${BUILDTAGS-}}" -a -v -x -ldflags "${GO_LDFLAGS-${LDFLAGS-}} -B 0x$(echo "%{name}-%{version}-%{release}-${SOURCE_DATE_EPOCH:-}" | sha1sum | cut -d ' ' -f1) -compressdwarf=false -linkmode=external -extldflags '%{build_ldflags}'" %{?**};
%else
%global debug_package %{nil}
%endif %endif
ExclusiveArch: %{golang_arches} %{gccgo_arches} ExclusiveArch: %{golang_arches} %{gccgo_arches}
Name: go-rpm-macros Name: go-rpm-macros
Release: 3%{?dist} Release: 7%{?dist}
Summary: Build-stage rpm automation for Go packages Summary: Build-stage rpm automation for Go packages
License: GPLv3+ License: GPLv3+
@ -51,6 +52,7 @@ Requires: go-filesystem = %{version}-%{release}
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
BuildRequires: golang BuildRequires: golang
Provides: bundled(golist) = %{golist_version}
%else %else
Requires: golist Requires: golist
%endif %endif
@ -142,23 +144,11 @@ done
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
# Add libexec to PATH # Add libexec to PATH
%patch2 -p1 %patch2 -p1
pushd %{_builddir} tar -xf %{SOURCE1}
tar -xf %{_sourcedir}/golist-%{golist_version}.tar.gz pushd %{golist_builddir}
cd golist-%{golist_version}
%patch1 -p1 %patch1 -p1
cp %{_builddir}/golist-%{golist_version}/LICENSE %{_builddir}/go-rpm-macros-%{version}/LICENSE-golist
popd popd
cp %{golist_builddir}/LICENSE LICENSE-golist
# create directory structure for a Go build
if [[ ! -e %{golist_builddir}/bin ]]; then
install -m 0755 -vd %{golist_builddir}/bin
export GOPATH=%{golist_builddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode
fi
if [[ ! -e %{golist_builddir}/src/%{golist_goipath} ]]; then
install -m 0755 -vd %{golist_builddir}/src/pagure.io
ln -sf $(dirname %{golist_builddir}) %{golist_builddir}/src/%{golist_goipath}
fi
%endif %endif
%patch3 -p1 %patch3 -p1
@ -167,15 +157,22 @@ fi
%build %build
# build golist # build golist
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
pushd %{golist_builddir}/src/%{golist_goipath} pushd %{golist_builddir}
export GOPATH=%{golist_builddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode go mod init %{golist_goipath} && go mod tidy
for cmd in cmd/* ; do for cmd in cmd/* ; do
%gobuild -o %{golist_builddir}/bin/$(basename $cmd) %{golist_goipath}/$cmd %gobuild -o bin/$(basename $cmd) ./$cmd
done done
popd popd
%endif %endif
%install %install
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}
# Some of those probably do not work with gcc-go right now # Some of those probably do not work with gcc-go right now
# This is not intentional, but mips is not a primary Fedora architecture # This is not intentional, but mips is not a primary Fedora architecture
# Patches and PRs are welcome # Patches and PRs are welcome
@ -184,20 +181,14 @@ install -m 0755 -vd %{buildroot}%{gopath}/src
install -m 0755 -vd %{buildroot}%{_spectemplatedir} install -m 0755 -vd %{buildroot}%{_spectemplatedir}
if ls templates/rpm/*\.spec; then
install -m 0644 -vp templates/rpm/*spec \ install -m 0644 -vp templates/rpm/*spec \
%{buildroot}%{_spectemplatedir} %{buildroot}%{_spectemplatedir}
fi
install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vd %{buildroot}%{_bindir}
install -m 0755 bin/* %{buildroot}%{_bindir} install -m 0755 bin/* %{buildroot}%{_bindir}
install -m 0755 -vd %{buildroot}%{rpmmacrodir} install -m 0644 -vp rpm/macros.d/macros.go-*rpm* \
install -m 0644 -vp rpm/macros.d/macros.go-* \
%{buildroot}%{rpmmacrodir} %{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 0755 -vd %{buildroot}%{_rpmluadir}/fedora/rpm
install -m 0644 -vp rpm/lua/rpm/*lua \ install -m 0644 -vp rpm/lua/rpm/*lua \
%{buildroot}%{_rpmluadir}/fedora/rpm %{buildroot}%{_rpmluadir}/fedora/rpm
@ -206,47 +197,50 @@ install -m 0644 -vp rpm/fileattrs/*.attr \
%{buildroot}%{_rpmconfigdir}/fileattrs/ %{buildroot}%{_rpmconfigdir}/fileattrs/
install -m 0755 -vp rpm/*\.{prov,deps} \ install -m 0755 -vp rpm/*\.{prov,deps} \
%{buildroot}%{_rpmconfigdir}/ %{buildroot}%{_rpmconfigdir}/
%else
install -m 0644 -vp rpm/macros.d/macros.go-srpm \
%{buildroot}%{rpmmacrodir}
%endif
%ifarch %{golang_arches} %ifarch %{golang_arches}
install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \ install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang{,-pie} \
%{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-golang %{buildroot}%{_rpmconfigdir}/macros.d/
%endif %endif
%ifarch %{gccgo_arches} %ifarch %{gccgo_arches}
install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \ install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \
%{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-gcc %{buildroot}%{_rpmconfigdir}/macros.d/
%endif %endif
# install golist # install golist
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
install -m 0755 -vd %{buildroot}%{golist_execdir} install -m 0755 -vd %{buildroot}%{golist_execdir}
install -m 0755 -vp %{golist_builddir}/bin/* %{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 %endif
%ifarch %{golang_arches} %{gccgo_arches}
%files %files
%license LICENSE.txt LICENSE-golist %license LICENSE.txt
%if %{defined bundle_golist}
%license LICENSE-golist
%endif
%doc README.md %doc README.md
%{_bindir}/* %{_bindir}/*
%{_rpmconfigdir}/fileattrs/*.attr %{_rpmconfigdir}/fileattrs/*.attr
%{_rpmconfigdir}/*.prov %{_rpmconfigdir}/*.prov
%{_rpmconfigdir}/*.deps %{_rpmconfigdir}/*.deps
%{_rpmconfigdir}/macros.d/macros.go-rpm* %{_rpmmacrodir}/macros.go-rpm*
%{_rpmconfigdir}/macros.d/macros.go-compiler* %{_rpmmacrodir}/macros.go-compiler*
%{_rpmluadir}/fedora/rpm/*.lua %{_rpmluadir}/fedora/rpm/*.lua
# package golist # package golist
%if 0%{?bundle_golist} %if 0%{?bundle_golist}
%{golist_execdir}/golist %{golist_execdir}/golist
%endif %endif
%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 %files -n go-rpm-templates
%license LICENSE-templates.txt %license LICENSE-templates.txt
@ -256,7 +250,36 @@ install -m 0755 -vp %{golist_builddir}/bin/* %{buildroot}%{golist_execdir}/
%dir %{_spectemplatedir} %dir %{_spectemplatedir}
%{_spectemplatedir}/*.spec %{_spectemplatedir}/*.spec
%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
%{_rpmmacrodir}/macros.go-srpm
%{_rpmluadir}/fedora/srpm/*.lua
%changelog %changelog
* Wed Nov 13 2024 Alejandro Sáez <asm@redhat.com>
- Revert go-rpm-templates to noarch
- Resolves: RHEL-67300
- Related: RHEL-52226
* Wed Nov 06 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-6
- Add back again ExclusiveArch, it was removed by mistake.
- Resolves: RHEL-52226
* Mon Nov 04 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-5
- Make golist non optional
- Resolves: RHEL-52226
* Thu Oct 31 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-4
- Enable debuginfo package
- Resolves: RHEL-52226
* Wed Jul 31 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-3 * Wed Jul 31 2024 Alejandro Sáez <asm@redhat.com> - 3.6.0-3
- Fix typo in add-gobuild-and-gotest.patch - Fix typo in add-gobuild-and-gotest.patch
- Resolves: RHEL-7437 - Resolves: RHEL-7437

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (go-rpm-macros-3.6.0.tar.gz) = 904406180a1bedb70dd0bacc3794dee7f1ff8e4329230750ef903338f22c2beb995e23f1d647191a4e094860b31933ae7b3acfa35d6ca67aed8c591bdd45c3bb
SHA512 (golist-0.10.4.tar.gz) = 81fc9cdc4cb0fa1b78ade56c60cb2ac0070dcb11130a333e61053a266e2312b03e64a6705415d6d20883ae4f8cd0be57722c93835c3efffdfaeb9330f4cc12ea