|
|
c18036 |
#debuginfo not supported with Go
|
|
|
c18036 |
%global debug_package %{nil}
|
|
|
c18036 |
# modifying the Go binaries breaks the DWARF debugging
|
|
|
c18036 |
%global __os_install_post %{_rpmconfigdir}/brp-compress
|
|
|
c18036 |
|
|
|
c18036 |
%global gopath %{_datadir}/gocode
|
|
|
c18036 |
%global import_path github.com/openshift/oc
|
|
|
c18036 |
|
|
|
1eed62 |
%global golang_version 1.19
|
|
|
c18036 |
|
|
|
1eed62 |
%global version_major 4
|
|
|
46a8b2 |
%global version_minor 14
|
|
|
1eed62 |
%global version_patch 0
|
|
|
c18036 |
|
|
|
c18036 |
%{!?commit:
|
|
|
46a8b2 |
%global commit 68c710f5c29d795a8706d1e40de9099d278c059b
|
|
|
c18036 |
}
|
|
|
1eed62 |
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
1eed62 |
|
|
|
1eed62 |
%{!?version: %global version %{version_major}.%{version_minor}.%{version_patch}}
|
|
|
0709f1 |
%{!?release: %global release 1.git%{shortcommit}}
|
|
|
c18036 |
|
|
|
c18036 |
%if ! 0%{?os_git_vars:1}
|
|
|
1eed62 |
%global os_git_vars OS_GIT_VERSION=%{version}-%{release} OS_GIT_COMMIT=%{commit} OS_GIT_MAJOR=%{version_major} OS_GIT_MINOR=%{version_minor} OS_GIT_PATCH=%{version_patch} OS_GIT_TREE_STATE=clean
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
%if "%{os_git_vars}" == "ignore"
|
|
|
c18036 |
%global make make
|
|
|
c18036 |
%else
|
|
|
1eed62 |
%global make %{os_git_vars} && make SOURCE_GIT_TAG:="${OS_GIT_VERSION}" SOURCE_GIT_COMMIT:="${OS_GIT_COMMIT}" SOURCE_GIT_MAJOR:="${OS_GIT_MAJOR}" SOURCE_GIT_MINOR:="${OS_GIT_MINOR}" SOURCE_GIT_PATCH:="${OS_GIT_PATCH}" SOURCE_GIT_TREE_STATE:="${OS_GIT_TREE_STATE}"
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
Name: openshift-clients
|
|
|
c18036 |
Version: %{version}
|
|
|
1eed62 |
Release: %{release}%{?dist}
|
|
|
c18036 |
Summary: OpenShift client binaries
|
|
|
c18036 |
License: ASL 2.0
|
|
|
c18036 |
URL: https://%{import_path}
|
|
|
1eed62 |
Source0: https://%{import_path}/archive/%{commit}/oc-%{commit}.tar.gz
|
|
|
c18036 |
|
|
|
c18036 |
# If go_arches not defined fall through to implicit golang archs
|
|
|
c18036 |
%if 0%{?go_arches:1}
|
|
|
c18036 |
ExclusiveArch: %{go_arches}
|
|
|
c18036 |
%else
|
|
|
c18036 |
ExclusiveArch: x86_64 aarch64 ppc64le s390x
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
BuildRequires: golang >= %{golang_version}
|
|
|
c18036 |
BuildRequires: goversioninfo
|
|
|
c18036 |
BuildRequires: krb5-devel
|
|
|
c18036 |
BuildRequires: rsync
|
|
|
c18036 |
|
|
|
c18036 |
Provides: atomic-openshift-clients = %{version}
|
|
|
c18036 |
Obsoletes: atomic-openshift-clients <= %{version}
|
|
|
1eed62 |
Provides: origin-clients = %{version}
|
|
|
1eed62 |
Obsoletes: origin-clients <= %{version}
|
|
|
1eed62 |
Provides: okd-clients = %{version}
|
|
|
1eed62 |
Obsoletes: okd-clients <= %{version}
|
|
|
1eed62 |
Provides: oc = %{version}
|
|
|
1eed62 |
Obsoletes: oc <= %{version}
|
|
|
1eed62 |
|
|
|
c18036 |
Requires: bash-completion
|
|
|
c18036 |
|
|
|
c18036 |
%description
|
|
|
c18036 |
%{summary}
|
|
|
c18036 |
|
|
|
c18036 |
%package redistributable
|
|
|
c18036 |
Summary: OpenShift Client binaries for Linux, Mac OSX, and Windows
|
|
|
c18036 |
Provides: atomic-openshift-clients-redistributable = %{version}
|
|
|
c18036 |
Obsoletes: atomic-openshift-clients-redistributable <= %{version}
|
|
|
1eed62 |
Provides: origin-clients-redistributable = %{version}
|
|
|
1eed62 |
Obsoletes: origin-clients-redistributable <= %{version}
|
|
|
1eed62 |
Provides: okd-clients-redistributable = %{version}
|
|
|
1eed62 |
Obsoletes: okd-clients-redistributable <= %{version}
|
|
|
1eed62 |
Provides: oc-redistributable = %{version}
|
|
|
1eed62 |
Obsoletes: oc-redistributable <= %{version}
|
|
|
c18036 |
|
|
|
c18036 |
%description redistributable
|
|
|
c18036 |
%{summary}
|
|
|
c18036 |
|
|
|
c18036 |
%prep
|
|
|
c18036 |
%if ! 0%{?local_build:1}
|
|
|
1eed62 |
%setup -q -n oc-%{commit}
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
%build
|
|
|
c18036 |
%if ! 0%{?local_build:1}
|
|
|
c18036 |
mkdir -p "$(dirname __gopath/src/%{import_path})"
|
|
|
c18036 |
mkdir -p "$(dirname __gopath/src/%{import_path})"
|
|
|
c18036 |
ln -s "$(pwd)" "__gopath/src/%{import_path}"
|
|
|
c18036 |
export GOPATH=$(pwd)/__gopath:%{gopath}
|
|
|
c18036 |
cd "__gopath/src/%{import_path}"
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
%ifarch %{ix86}
|
|
|
c18036 |
GOOS=linux
|
|
|
c18036 |
GOARCH=386
|
|
|
c18036 |
%endif
|
|
|
c18036 |
%ifarch ppc64le
|
|
|
c18036 |
GOOS=linux
|
|
|
c18036 |
GOARCH=ppc64le
|
|
|
c18036 |
%endif
|
|
|
c18036 |
%ifarch %{arm} aarch64
|
|
|
c18036 |
GOOS=linux
|
|
|
c18036 |
GOARCH=arm64
|
|
|
c18036 |
%endif
|
|
|
c18036 |
%ifarch s390x
|
|
|
c18036 |
GOOS=linux
|
|
|
c18036 |
GOARCH=s390x
|
|
|
c18036 |
%endif
|
|
|
c18036 |
%{make} build GO_BUILD_PACKAGES:='./cmd/oc ./tools/genman'
|
|
|
c18036 |
|
|
|
c18036 |
%ifarch x86_64
|
|
|
c18036 |
# Create Binaries for all supported arches
|
|
|
c18036 |
%{make} cross-build-darwin-amd64 cross-build-windows-amd64 GO_BUILD_PACKAGES:='./cmd/oc'
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
%install
|
|
|
c18036 |
install -d %{buildroot}%{_bindir}
|
|
|
c18036 |
|
|
|
c18036 |
# Install for the local platform
|
|
|
c18036 |
install -p -m 755 ./oc %{buildroot}%{_bindir}/oc
|
|
|
c18036 |
ln -s ./oc %{buildroot}%{_bindir}/kubectl
|
|
|
c18036 |
[[ -e %{buildroot}%{_bindir}/kubectl ]]
|
|
|
c18036 |
|
|
|
c18036 |
%ifarch x86_64
|
|
|
c18036 |
# Install client executable for windows and mac
|
|
|
c18036 |
install -d %{buildroot}%{_datadir}/%{name}/{linux,macosx,windows}
|
|
|
c18036 |
install -p -m 755 ./oc %{buildroot}%{_datadir}/%{name}/linux/oc
|
|
|
c18036 |
ln -s ./oc %{buildroot}%{_datadir}/%{name}/linux/kubectl
|
|
|
c18036 |
[[ -e %{buildroot}%{_datadir}/%{name}/linux/kubectl ]]
|
|
|
c18036 |
install -p -m 755 ./_output/bin/darwin_amd64/oc %{buildroot}/%{_datadir}/%{name}/macosx/oc
|
|
|
c18036 |
ln -s ./oc %{buildroot}/%{_datadir}/%{name}/macosx/kubectl
|
|
|
c18036 |
[[ -e %{buildroot}/%{_datadir}/%{name}/macosx/kubectl ]]
|
|
|
c18036 |
install -p -m 755 ./_output/bin/windows_amd64/oc.exe %{buildroot}/%{_datadir}/%{name}/windows/oc.exe
|
|
|
c18036 |
ln -s ./oc.exe %{buildroot}/%{_datadir}/%{name}/windows/kubectl.exe
|
|
|
c18036 |
[[ -e %{buildroot}/%{_datadir}/%{name}/windows/kubectl.exe ]]
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
# Install man1 man pages
|
|
|
c18036 |
install -d -m 0755 %{buildroot}%{_mandir}/man1
|
|
|
c18036 |
./genman %{buildroot}%{_mandir}/man1 oc
|
|
|
c18036 |
|
|
|
c18036 |
# Install bash completions
|
|
|
c18036 |
install -d -m 755 %{buildroot}%{_sysconfdir}/bash_completion.d/
|
|
|
c18036 |
for bin in oc kubectl
|
|
|
c18036 |
do
|
|
|
c18036 |
echo "+++ INSTALLING BASH COMPLETIONS FOR ${bin} "
|
|
|
c18036 |
%{buildroot}%{_bindir}/${bin} completion bash > %{buildroot}%{_sysconfdir}/bash_completion.d/${bin}
|
|
|
c18036 |
chmod 644 %{buildroot}%{_sysconfdir}/bash_completion.d/${bin}
|
|
|
c18036 |
done
|
|
|
c18036 |
|
|
|
c18036 |
%files
|
|
|
c18036 |
%license LICENSE
|
|
|
c18036 |
%{_bindir}/oc
|
|
|
c18036 |
%{_bindir}/kubectl
|
|
|
c18036 |
%{_sysconfdir}/bash_completion.d/oc
|
|
|
c18036 |
%{_sysconfdir}/bash_completion.d/kubectl
|
|
|
c18036 |
%dir %{_mandir}/man1/
|
|
|
c18036 |
%{_mandir}/man1/oc*
|
|
|
c18036 |
|
|
|
c18036 |
%ifarch x86_64
|
|
|
c18036 |
%files redistributable
|
|
|
c18036 |
%license LICENSE
|
|
|
c18036 |
%dir %{_datadir}/%{name}/linux/
|
|
|
c18036 |
%dir %{_datadir}/%{name}/macosx/
|
|
|
c18036 |
%dir %{_datadir}/%{name}/windows/
|
|
|
c18036 |
%{_datadir}/%{name}/linux/oc
|
|
|
c18036 |
%{_datadir}/%{name}/linux/kubectl
|
|
|
c18036 |
%{_datadir}/%{name}/macosx/oc
|
|
|
c18036 |
%{_datadir}/%{name}/macosx/kubectl
|
|
|
c18036 |
%{_datadir}/%{name}/windows/oc.exe
|
|
|
c18036 |
%{_datadir}/%{name}/windows/kubectl.exe
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
%changelog
|
|
|
46a8b2 |
* Fri May 26 2023 Christian Glombek <cglombek@redhat.com> - 4.14.0-1
|
|
|
46a8b2 |
- Version 4.14
|
|
|
46a8b2 |
|
|
|
0709f1 |
* Fri May 26 2023 Christian Glombek <cglombek@redhat.com> - 4.13.0-1
|
|
|
0709f1 |
- Imported spec from https://github.com/openshift/oc/blob/68c710f5c29d795a8706d1e40de9099d278c059b/oc.spec
|
|
|
0709f1 |
- Adapted for CentOS
|