File velero-plugin-for-aws.spec of Package failed_velero-plugin-for-aws
Name: velero-plugin-for-aws
Version: 1.4.0
Release: 2.1
Summary: Velero plugin for AWS
License: Apache-2.0
URL: https://github.com/vmware-tanzu/velero-plugin-for-aws
Source0: velero-plugin-for-aws-1.4.0.tar.gz
Source1: vendor.tar.gz
BuildArch: %_target_cpu
BuildRequires: go >= 1.20
Requires: /usr/bin/env
%description
Velero plugin for AWS - provides volume snapshotting and object storage support for Velero on AWS.
%prep
%setup -q -n %{name}-%{version}
# vendor.tar.gz is provided as a separate compressed tarball in the sources
if [ -f %{_sourcedir}/vendor.tar.gz ]; then
/usr/lib/rpm/rpmuncompress -x %{_sourcedir}/vendor.tar.gz || true
fi
%build
# Enable cgo because -buildmode=pie requires external (cgo) linking on some targets.
# This avoids the error: "-buildmode=pie requires external (cgo) linking, but cgo is not enabled"
export CGO_ENABLED=1
# Use the rpm-provided Go helper; pass through vendor mode and static installsuffix as upstream intended
%{__bash} -c 'if [ -x /usr/lib/rpm/golang.sh ]; then /usr/lib/rpm/golang.sh build -mod vendor -installsuffix static %{name}; else go build -mod=vendor -installsuffix static -v ./...; fi'
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_bindir}
# The built binary is expected to be named "velero-plugin-for-aws"
if [ -f ./velero-plugin-for-aws ]; then
install -m 0755 velero-plugin-for-aws %{buildroot}%{_bindir}/velero-plugin-for-aws
else
# fallback: find in GOPATH bin if golang.sh placed it there
if [ -f go/bin/velero-plugin-for-aws ]; then
install -m 0755 go/bin/velero-plugin-for-aws %{buildroot}%{_bindir}/velero-plugin-for-aws
fi
fi
%files
%defattr(-,root,root,-)
%{_bindir}/velero-plugin-for-aws
%changelog
* Tue Aug 12 2025 Packager <packager@example.org> - 1.4.0-2.1
- Enable CGO during build to allow -buildmode=pie linking on targets requiring cgo.