Use vendored dependencies for RHEL builds

This commit is contained in:
Yaakov Selkowitz 2023-06-29 17:04:51 -04:00
parent 818796f407
commit 9ad48faf97

View File

@ -26,6 +26,8 @@ License: MIT
URL: %{gourl} URL: %{gourl}
Source0: %{gosource} Source0: %{gosource}
# RHEL builds with vendored dependencies
%if %{undefined rhel}
# This dependencies are only in use in x86_64 # This dependencies are only in use in x86_64
%ifarch x86_64 %ifarch x86_64
BuildRequires: golang(github.com/cilium/ebpf) BuildRequires: golang(github.com/cilium/ebpf)
@ -51,6 +53,7 @@ BuildRequires: golang(gopkg.in/yaml.v2)
BuildRequires: golang(go.starlark.net/resolve) BuildRequires: golang(go.starlark.net/resolve)
BuildRequires: golang(go.starlark.net/starlark) BuildRequires: golang(go.starlark.net/starlark)
BuildRequires: golang(go.starlark.net/syntax) BuildRequires: golang(go.starlark.net/syntax)
%endif
BuildRequires: lsof BuildRequires: lsof
BuildRequires: git BuildRequires: git
@ -59,10 +62,16 @@ BuildRequires: git
%prep %prep
echo "=== Start prep ===" echo "=== Start prep ==="
%if %{defined rhel}
%goprep -k
# unpack vendored dependencies to GOPATH
tar c -C vendor/ . | tar x -C %{gobuilddir}/src
%else
%goprep %goprep
%generate_buildrequires %generate_buildrequires
%go_generate_buildrequires %go_generate_buildrequires
%endif
%build %build
echo "=== Start build ===" echo "=== Start build ==="
@ -77,7 +86,7 @@ install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
%if %{with check} %if %{with check}
%check %check
export GO111MODULE=off export GO111MODULE=off
export GOPATH=%{buildroot}/%{gopath}:%{gopath} export GOPATH=%{buildroot}/%{gopath}:%{gobuilddir}:%{gopath}
delvepath=%{buildroot}/%{gopath}/src/%{goipath} delvepath=%{buildroot}/%{gopath}/src/%{goipath}
cp -r _fixtures $delvepath cp -r _fixtures $delvepath
cp -r pkg/dwarf/line/_testdata $delvepath/pkg/dwarf/line cp -r pkg/dwarf/line/_testdata $delvepath/pkg/dwarf/line
@ -92,7 +101,7 @@ popd
%endif %endif
%files %files
%license LICENSE %license LICENSE %{?rhel:vendor/modules.txt}
%doc CONTRIBUTING.md CHANGELOG.md %doc CONTRIBUTING.md CHANGELOG.md
%doc Documentation/* %doc Documentation/*
%{_bindir}/dlv %{_bindir}/dlv