#debuginfo not supported with Go %global debug_package %{nil} # modifying the Go binaries breaks the DWARF debugging %global __os_install_post %{_rpmconfigdir}/brp-compress %global gopath %{_datadir}/gocode %global import_path github.com/openshift/oc %global golang_version 1.20 %global version 4.15.0 %global tag openshift-clients-4.15.0-202402082307 %global release 202402082307 %global commit 48dcf5980a6671b5933707e5a055def023c7a13a %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: openshift-clients Version: %{version} Release: %{release} Summary: OpenShift client binaries License: ASL 2.0 URL: https://%{import_path} Source0: https://%{import_path}/archive/%{commit}/oc-%{commit}.tar.gz # If go_arches not defined fall through to implicit golang archs %if 0%{?go_arches:1} ExclusiveArch: %{go_arches} %else ExclusiveArch: x86_64 aarch64 ppc64le s390x %endif BuildRequires: golang >= %{golang_version} BuildRequires: krb5-devel BuildRequires: gpgme-devel BuildRequires: libassuan-devel BuildRequires: rsync Provides: atomic-openshift-clients = %{version} Obsoletes: atomic-openshift-clients <= %{version} Requires: bash-completion %description %{summary} %prep %setup -n oc-%{commit} %build #%if ! 0%{?local_build:1} mkdir -p "$(dirname __gopath/src/%{import_path})" ln -s "$(pwd)" "__gopath/src/%{import_path}" export GOPATH=$(pwd)/__gopath:%{gopath} cd "__gopath/src/%{import_path}" #%endif %ifarch %{ix86} GOOS=linux GOARCH=386 %endif %ifarch ppc64le GOOS=linux GOARCH=ppc64le %endif %ifarch %{arm} aarch64 GOOS=linux GOARCH=arm64 %endif %ifarch s390x GOOS=linux GOARCH=s390x %endif make build GO_BUILD_PACKAGES:='./cmd/oc ./tools/genman' %install install -d %{buildroot}%{_bindir} # Install for the local platform install -p -m 755 ./oc %{buildroot}%{_bindir}/oc ln -s ./oc %{buildroot}%{_bindir}/kubectl [[ -e %{buildroot}%{_bindir}/kubectl ]] # Install man1 man pages install -d -m 0755 %{buildroot}%{_mandir}/man1 ./genman %{buildroot}%{_mandir}/man1 oc # Install bash completions install -d -m 755 %{buildroot}%{_sysconfdir}/bash_completion.d/ for bin in oc kubectl do echo "+++ INSTALLING BASH COMPLETIONS FOR ${bin} " %{buildroot}%{_bindir}/${bin} completion bash > %{buildroot}%{_sysconfdir}/bash_completion.d/${bin} chmod 644 %{buildroot}%{_sysconfdir}/bash_completion.d/${bin} done %files %license LICENSE %{_bindir}/oc %{_bindir}/kubectl %{_sysconfdir}/bash_completion.d/oc %{_sysconfdir}/bash_completion.d/kubectl %dir %{_mandir}/man1/ %{_mandir}/man1/oc* %changelog * Mon Dec 4 2023 Brandon Johnson 4.14.0 - changed source and cleaned up the spec for copr