[packages/kubectl] switch to building from source

atler atler at pld-linux.org
Wed Feb 23 20:24:05 CET 2022


commit 44d6b6fb5246364bb2fd5f239aa988f8034c3bbb
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Feb 23 19:21:24 2022 +0100

    switch to building from source
    
    ldflags based on freebsd

 kubectl.spec | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/kubectl.spec b/kubectl.spec
index fe7e7c3..206f80f 100644
--- a/kubectl.spec
+++ b/kubectl.spec
@@ -1,17 +1,23 @@
+%define		major	1
+%define		minor	23
+%define		patch	4
+%define		vendor_version	1.23.4
+
 Summary:	Kubectl (Kubernetes client tools)
 Name:		kubectl
-Version:	1.23.4
+Version:	%{major}.%{minor}.%{patch}
 Release:	1
 License:	Apache v2.0
 Group:		Applications
-Source0:	https://storage.googleapis.com/kubernetes-release/release/v%{version}/bin/linux/amd64/%{name}
-# Source0-md5:	da75d443396d667edfc66f34662ea153
+Source0:	https://dl.k8s.io/v%{version}/kubernetes-src.tar.gz
+# Source0-md5:	f895c16fd87ceeaa945e006f0e0e981c
 URL:		http://kubernetes.io/
-ExclusiveArch:	%{x8664}
+BuildRequires:	golang >= 1.16
+BuildRequires:	rpmbuild(macros) >= 2.009
+ExclusiveArch:	%go_arches
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-# nothing to put there
-%define		_enable_debug_packages	0
+%define		_debugsource_packages	0
 
 %description
 Kubectl (Kubernetes client tool). This package contains only the
@@ -22,16 +28,21 @@ It groups containers that make up an application into logical units
 for management and discovery.
 
 %prep
-%setup -qcT
-install -p %{SOURCE0} .
+%setup -qc
 
 %build
-./kubectl version --client --short
+ldflags="-X k8s.io/component-base/version.gitMajor=%{major} \
+	-X k8s.io/component-base/version.gitMinor=%{minor} \
+	-X k8s.io/component-base/version.buildDate=$(date +'%Y-%m-%dT%H:%M:%SZ') \
+	-X k8s.io/component-base/version.gitCommit= \
+	-X k8s.io/component-base/version.gitVersion=v%{version} \
+	-X k8s.io/client-go/pkg/version.gitVersion=v%{version}"
+%__go build -v -ldflags="$ldflags" -o target/kubectl k8s.io/kubernetes/cmd/kubectl
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_bindir}
-install -p kubectl $RPM_BUILD_ROOT%{_bindir}
+install -p target/kubectl $RPM_BUILD_ROOT%{_bindir}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kubectl.git/commitdiff/53a59a69ff0f4a1e1f58729a88447a3a2067a5f7



More information about the pld-cvs-commit mailing list