File kustomize.spec of Package kustomize
%define realname kustomize
%define srcext tar.bz2
# Common info
Name: %{realname}
Version: 0
Release: wiz%{?extraver:0.}1%{?dist}
License: Apache-2.0
Group: System/Management
URL: https://kustomize.io
Summary: Kubernetes native configuration management
# Build-time parameters
BuildRequires: go
BuildRoot: %{_tmppath}/%{name}-root
Source0: %{realname}-%{version}.%{srcext}
# cd kustomize; go mod vendor -v && cd .. ; tar -Jcvf ../vendor.tar.xz kustomize/vendor && rm -rf kustomize/vendor
Source1: vendor.tar.xz
%description
kustomize lets you customize raw, template-free YAML files for multiple
purposes, leaving the original YAML untouched and usable as is.
kustomize targets kubernetes; it understands and can patch kubernetes style API
objects. It's like make, in that what it does is declared in a file, and it's
like sed, in that it emits edited text.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver} -a1
rm -fv bin/kustomize
# Build step (compile/build binaries, documentation, etc)
%build
%define ver_mod sigs.k8s.io/kustomize/api/provenance
cd kustomize
go build -v -a -mod=vendor -buildmode=pie \
-gcflags=all=-dwarf=false \
-ldflags='all=-s -w -X %{ver_mod}.version=%{version} -X %{ver_mod}.buildDate=%(date -u +"%Y-%m-%dT%H:%M:%SZ")' \
-o ../bin/kustomize
# Install built stuff
%install
%{__install} -D -m0755 bin/kustomize %{buildroot}%{_bindir}/kustomize
# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
# Files
%files
%defattr(-,root,root)
%doc CONTRIBUTING.md LICENSE README.md code-of-conduct.md docs/
%{_bindir}/kustomize
%changelog