|
|
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 |
|
|
|
c18036 |
%global golang_version 1.13
|
|
|
c18036 |
|
|
|
c18036 |
%{!?version: %global version 0.0.1}
|
|
|
c18036 |
%{!?release: %global release 1}
|
|
|
c18036 |
|
|
|
c18036 |
%{!?commit:
|
|
|
c18036 |
# DO NOT MODIFY: the value on the line below is sed-like replaced by openshift/doozer
|
|
|
c18036 |
%global commit e0a5699f2049372633b18c43a98a522999b1f297
|
|
|
c18036 |
}
|
|
|
c18036 |
|
|
|
c18036 |
%if ! 0%{?os_git_vars:1}
|
|
|
c18036 |
# DO NOT MODIFY: the value on the line below is sed-like replaced by openshift/doozer
|
|
|
c18036 |
%global os_git_vars OS_GIT_VERSION='' OS_GIT_COMMIT='' OS_GIT_MAJOR='' OS_GIT_MINOR='' OS_GIT_TREE_STATE=''
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
%if "%{os_git_vars}" == "ignore"
|
|
|
c18036 |
%global make make
|
|
|
c18036 |
%else
|
|
|
c18036 |
%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_TREE_STATE:="${OS_GIT_TREE_STATE}"
|
|
|
c18036 |
%endif
|
|
|
c18036 |
|
|
|
c18036 |
Name: openshift-clients
|
|
|
c18036 |
Version: %{version}
|
|
|
c18036 |
Release: %{release}%{dist}
|
|
|
c18036 |
Summary: OpenShift client binaries
|
|
|
c18036 |
License: ASL 2.0
|
|
|
c18036 |
URL: https://%{import_path}
|
|
|
c18036 |
|
|
|
c18036 |
%if ! 0%{?local_build:1}
|
|
|
c18036 |
Source0: https://%{import_path}/archive/%{commit}/%{name}-%{version}.tar.gz
|
|
|
c18036 |
%endif
|
|
|
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}
|
|
|
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}
|
|
|
c18036 |
|
|
|
c18036 |
%description redistributable
|
|
|
c18036 |
%{summary}
|
|
|
c18036 |
|
|
|
c18036 |
%prep
|
|
|
c18036 |
%if ! 0%{?local_build:1}
|
|
|
c18036 |
%setup -q
|
|
|
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
|