Add patch to add libexec to $PATH for golist

Resolves: RHEL-7367
This commit is contained in:
Robert-André Mauchin 2022-07-05 19:58:37 +02:00 committed by Alejandro Sáez
parent ff734f1c6f
commit 35036ed020
2 changed files with 58 additions and 3 deletions

View File

@ -0,0 +1,52 @@
From 948c86d17904abf5d9d9c42c55ab78f6b970b972 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Tue, 5 Jul 2022 19:50:30 +0200
Subject: [PATCH] Add libexec to path for EPEL9 golist
---
bin/go-rpm-integration | 2 ++
rpm/gosymlink.deps | 2 ++
rpm/macros.d/macros.go-rpm | 3 ++-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/bin/go-rpm-integration b/bin/go-rpm-integration
index 8a0f6b2..d460a61 100755
--- a/bin/go-rpm-integration
+++ b/bin/go-rpm-integration
@@ -17,6 +17,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+export PATH="${PATH}:/usr/libexec/go-rpm-macros"
+
usage() {
cat >&2 << EOF_USAGE
Usage: $0 <action> [ [-h] ]
diff --git a/rpm/gosymlink.deps b/rpm/gosymlink.deps
index d7f2866..a6d6538 100755
--- a/rpm/gosymlink.deps
+++ b/rpm/gosymlink.deps
@@ -16,6 +16,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+export PATH="${PATH}:/usr/libexec/go-rpm-macros"
+
usage() {
cat >&2 << EOF_USAGE
Usage: $0 <action> [ [-h] ]
diff --git a/rpm/macros.d/macros.go-rpm b/rpm/macros.d/macros.go-rpm
index f773f34..9cad4df 100644
--- a/rpm/macros.d/macros.go-rpm
+++ b/rpm/macros.d/macros.go-rpm
@@ -186,6 +186,7 @@ else
end
print(rpm.expand('GOPATH="%{?gobuilddir:%{gobuilddir}:}${GOPATH:+${GOPATH}:}%{?gopath}" ' ..
'GO111MODULE=off ' ..
+ 'PATH="${PATH}:%{_libexecdir}/go-rpm-macros" ' ..
"golist --imported " .. golistargs ..
" --template 'golang({{.}})\\\\n'" ..
" --with-tests --skip-self\\n"))
--
2.36.1

View File

@ -73,6 +73,8 @@ Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release}
# command line parser backend to bootstrap golist
# without dependencies.
Patch1: golist-bootstrap-cli-no-vendor.patch
# Add libexec to PATH in order to launch golist in every script
Patch2: 0001-Add-libexec-to-path-for-EPEL9-golist.patch
# RHEL 8 only provides the macros.go-srpm file which includes gobuild and gotest.
# C9S also only provides the macros.go-srpm file but it also follows upstream which includes gobuild and gotest in the macros.go-compilers-gcc.
@ -80,7 +82,7 @@ Patch1: golist-bootstrap-cli-no-vendor.patch
# This also sets the GOAMD64 variable to v2
# Resolves: rhbz#1965292
# Resolves: RHEL-5529
Patch2: add-gobuild-and-gotest.patch
Patch3: add-gobuild-and-gotest.patch
%description
This package provides build-stage rpm automation to simplify the creation of Go
@ -135,6 +137,8 @@ done
# unpack golist and patch
%if 0%{?bundle_golist}
# Add libexec to PATH
%patch2 -p1
pushd %{_builddir}
tar -xf %{_sourcedir}/golist-%{golist_version}.tar.gz
cd golist-%{golist_version}
@ -154,7 +158,7 @@ if [[ ! -e %{golist_builddir}/src/%{golist_goipath} ]]; then
fi
%endif
%patch2 -p1
%patch3 -p1
%build
# build golist
@ -213,7 +217,6 @@ install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \
%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
%endif
%files