Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] DO NOT MERGE: k3s: update to 0.10.1.
@ 2019-10-29  4:43 voidlinux-github
  2019-11-01  1:23 ` voidlinux-github
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: voidlinux-github @ 2019-10-29  4:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]

There is a new pull request by nilium against master on the void-packages repository

https://github.com/nilium/ecks-bops-packages k3s
https://github.com/void-linux/void-packages/pull/15887

DO NOT MERGE: k3s: update to 0.10.1.
Moves most vsed stuff into the given patch. Part of this is to force
reviewing it each time it doesn't apply cleanly (it probably won't most
of the time), the other is to stop cramming things into vsed, since
that's hackier than just patching the files.

0.10.x adds a dependency on ipset. Without it, k3s will crash upon
startup.

This adds a new distfile, part of which motivated the patching, to
avoid running a direct 'git clone' of a repository in the build script.

Services now redirect stderr to stdout, as they probably weren't
capturing log output before.

A patch file from https://github.com/void-linux/void-packages/pull/15887.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-k3s-15887.patch --]
[-- Type: text/x-diff, Size: 8337 bytes --]

From 5c49900a25cf185525faabe6c622b7e10c883659 Mon Sep 17 00:00:00 2001
From: Noel Cower <ncower@gmail.com>
Date: Mon, 28 Oct 2019 20:50:15 -0700
Subject: [PATCH] k3s: update to 0.10.1.

Moves most vsed stuff into the given patch. Part of this is to force
reviewing it each time it doesn't apply cleanly (it probably won't most
of the time), the other is to stop cramming things into vsed, since
that's hackier than just patching the files.

0.10.x adds a dependency on ipset. Without it, k3s will crash upon
startup.

This adds a new distfile, part of which motivated the patching, to
avoid running a direct 'git clone' of a repository in the build script.

Services now redirect stderr to stdout, as they probably weren't
capturing log output before.
---
 srcpkgs/k3s/files/k3s-agent/run           |  1 +
 srcpkgs/k3s/files/k3s-server/run          |  1 +
 srcpkgs/k3s/patches/0001-void-build.patch | 98 +++++++++++++++++++++++
 srcpkgs/k3s/template                      | 30 +++----
 4 files changed, 110 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/k3s/patches/0001-void-build.patch

diff --git a/srcpkgs/k3s/files/k3s-agent/run b/srcpkgs/k3s/files/k3s-agent/run
index 48244292cf9..efeb002ab66 100755
--- a/srcpkgs/k3s/files/k3s-agent/run
+++ b/srcpkgs/k3s/files/k3s-agent/run
@@ -7,4 +7,5 @@ if [ 0 = $# ]; then
     ${K3S_SERVER:+--server="${K3S_SERVER}"} \
     ${K3S_TOKEN:+--token="${K3S_TOKEN}"}
 fi
+exec 2>&1
 exec k3s agent ${K3S_OPTIONS} ${K3S_AGENT_OPTIONS} "$@"
diff --git a/srcpkgs/k3s/files/k3s-server/run b/srcpkgs/k3s/files/k3s-server/run
index 03ada62d4a4..38124326a38 100755
--- a/srcpkgs/k3s/files/k3s-server/run
+++ b/srcpkgs/k3s/files/k3s-server/run
@@ -2,4 +2,5 @@
 set --
 [ -r /etc/k3s/config ] && . /etc/k3s/config
 [ -r ./conf ] && . ./conf
+exec 2>&1
 exec k3s server ${K3S_OPTIONS} ${K3S_SERVER_OPTIONS} "$@"
diff --git a/srcpkgs/k3s/patches/0001-void-build.patch b/srcpkgs/k3s/patches/0001-void-build.patch
new file mode 100644
index 00000000000..2ced39a4321
--- /dev/null
+++ b/srcpkgs/k3s/patches/0001-void-build.patch
@@ -0,0 +1,98 @@
+From 6856a5336368ec2322faa30615ce92c7c5dc4693 Mon Sep 17 00:00:00 2001
+From: Noel Cower <ncower@gmail.com>
+Date: Mon, 28 Oct 2019 19:09:04 -0700
+Subject: [PATCH] Patch build and package-cli scripts for Void
+
+- Remove -w and -s linker flags.
+
+- Disable cgo and unset GOARCH when running go generate. (Breaks
+  execution of anything using 'go run' inside of a go:generate line.)
+
+- Replace git clone of plugins.git with a distfile so that its
+  SHA256SUM can be verified, similar to the traefik files. Adds a go
+  clean call to the end of the subshell since `rm -rf` on
+  a GOPATH/pkg/mod directory will fail (because everything is
+  read-only).
+
+- Nullify BIN_SUFFIX variable. This makes it needlessly hard to use
+  vinstall with binaries, so remove it.
+
+diff --git k3s-0.10.1/scripts/build k3s-0.10.1/scripts/build
+index 26b72060a2..bfa8482b19 100755
+--- k3s-0.10.1/scripts/build
++++ k3s-0.10.1/scripts/build
+@@ -15,8 +15,7 @@ VERSIONFLAGS="
+     -X $PKG_CONTAINERD/version.Version=$VERSION_CONTAINERD
+     -X $PKG_CONTAINERD/version.Package=$PKG_RANCHER_CONTAINERD
+     -X $PKG_CRICTL/pkg/version.Version=$VERSION_CRICTL"
+-LDFLAGS="
+-    -w -s"
++LDFLAGS=""
+ STATIC="
+     -extldflags '-static'
+ "
+@@ -56,19 +55,18 @@ rm -f \
+ 
+ cleanup() {
+     exit_status=$?
+-    rm -rf $TMPDIR
++    go clean -modcache
+     exit ${exit_status}
+ }
+ 
+ INSTALLBIN=$(pwd)/bin
+ (
+     echo Building cni
+-    TMPDIR=$(mktemp -d)
+     trap cleanup EXIT
+-    WORKDIR=$TMPDIR/src/github.com/containernetworking/plugins
+-    git clone -b $VERSION_CNIPLUGINS https://github.com/rancher/plugins.git $WORKDIR
+-    cd $WORKDIR
+-    GOPATH=$TMPDIR CGO_ENABLED=0 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o $INSTALLBIN/cni
++    SRCDIR=
++    cd "$XBPS_BUILDDIR/k3s-${VERSION#v}/plugins-${VERSION_CNIPLUGINS#v}"
++    [ -r go.mod ] || go mod init github.com/containernetworking/plugins
++    CGO_ENABLED=0 go build -mod=vendor -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o $INSTALLBIN/cni
+ )
+ # echo Building agent
+ # CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC" -o bin/k3s-agent ./cmd/agent/main.go
+@@ -86,7 +84,7 @@ CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC_SQ
+ # echo Building containerd
+ # CGO_ENABLED=0 go build -tags "$TAGS" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC" -o bin/containerd ./cmd/containerd/
+ echo Building runc
+-make EXTRA_LDFLAGS="-w -s" BUILDTAGS="apparmor seccomp" -C ./vendor/github.com/opencontainers/runc static
++make EXTRA_LDFLAGS="" BUILDTAGS="apparmor seccomp" -C ./vendor/github.com/opencontainers/runc static
+ cp -f ./vendor/github.com/opencontainers/runc/runc ./bin/runc
+ 
+ echo Building containerd-shim
+diff --git k3s-0.10.1/scripts/package-cli k3s-0.10.1/scripts/package-cli
+index e8b6f20a54..f4ebe53999 100755
+--- k3s-0.10.1/scripts/package-cli
++++ k3s-0.10.1/scripts/package-cli
+@@ -27,21 +27,15 @@ HASH=$(sha256sum ./build/out/data.tar.gz | awk '{print $1}')
+ 
+ cp ./build/out/data.tar.gz ./build/data/${HASH}.tgz
+ 
+-BIN_SUFFIX="-${ARCH}"
+-if [ ${ARCH} = amd64 ]; then
+-    BIN_SUFFIX=""
+-elif [ ${ARCH} = arm ]; then
+-    BIN_SUFFIX="-armhf"
+-fi
++BIN_SUFFIX=""
+ 
+ cp -f ./bin/hyperkube dist/artifacts/hyperkube${BIN_SUFFIX}
+ CMD_NAME=dist/artifacts/k3s${BIN_SUFFIX}
+ 
+-go generate
++CGO_ENABLED=0 GOARCH= go generate -x
+ LDFLAGS="
+     -X github.com/rancher/k3s/pkg/version.Version=$VERSION
+     -X github.com/rancher/k3s/pkg/version.GitCommit=${COMMIT:0:8}
+-    -w -s
+ "
+ STATIC="-extldflags '-static'"
+ CGO_ENABLED=0 go build -ldflags "$LDFLAGS $STATIC" -o ${CMD_NAME} ./cmd/k3s/main.go
+-- 
+2.23.0
+
diff --git a/srcpkgs/k3s/template b/srcpkgs/k3s/template
index 1657a9b7823..772aecaa286 100644
--- a/srcpkgs/k3s/template
+++ b/srcpkgs/k3s/template
@@ -1,13 +1,14 @@
 # Template file for 'k3s'
 pkgname=k3s
-version=0.9.1
-revision=2
+version=0.10.1
+revision=1
 create_wrksrc=yes
 build_wrksrc="${pkgname}-${version}"
 build_style=go
 go_import_path="github.com/rancher/k3s"
 hostmakedepends="git pkg-config"
 makedepends="libseccomp-devel"
+depends="ipset"
 short_desc="Lightweight Kubernetes"
 maintainer="Cameron Nemo <cnemo@tutanota.com>"
 license="Apache-2.0"
@@ -15,14 +16,18 @@ homepage="https://k3s.io"
 # _traefik_* variables' values from scripts/download in source distfile
 _traefik_version="1.77.1"
 _traefik_file="traefik-${_traefik_version}.tgz"
+_plugins_version="0.7.6-k3s1"
+_plugins_file="v${_plugins_version}.tar.gz"
 distfiles="https://${go_import_path}/archive/v${version}.tar.gz
+ https://github.com/rancher/plugins/archive/${_plugins_file}
  https://kubernetes-charts.storage.googleapis.com/${_traefik_file}"
-checksum="dee3ddfcdb61f292bcfe778d7677e436309511e15c6bbdd326ebec42ea41bbac
+checksum="75fd99206a85fbae1d65c8476214fc81831818a6ada540277ce090c8b1d04193
+ 75e02aa09edcfb2b43d41cd576e24099e9bca21d80bda0dcdc3f98f2357f1363
  15dd78d136d7c9bae7144072052ef6cd12821ae081a7c085f145d834d96c5d5c"
 skip_extraction="${_traefik_file}"
 conflicts="kubernetes"
 
-_git_commit=755bd1c63bafe80f9b5fe8d4bba527f988625364
+_git_commit=7d650d32af9643102c909c305fbebf944bd5dd6f
 
 pre_build() {
 	# Modify version.sh to use template variables' values.
@@ -30,25 +35,10 @@ pre_build() {
 		s@^COMMIT=.*@COMMIT='"${_git_commit}"'@;
 		s@^GIT_TAG=.*@GIT_TAG=v'"${version}"'@
 		'
-	# Remove -s (strip) and -w (no dwarf) linker arguments.
-	vsed -i scripts/build -e 's@-w -s@@'
-	# Remove BIN_SUFFIX, nullify GOARCH for go generate. The latter
-	# is needed because 'go run' will try to run binaries for the
-	# target given by GOOS/GOARCH. The -x prints what 'go generate'
-	# is executing. CGO_ENABLED is set to 0 because cross builds
-	# won't necessarily be able to handle 64-bit builds performed by
-	# 'go run'.
-	vsed -i scripts/package-cli -e '
-		s@BIN_SUFFIX="[^"]\+"@BIN_SUFFIX=""@;
-		s@^go generate$@CGO_ENABLED=0 GOARCH= & -x@;
-		s@-w -s@@g
-		'
 
 	# Recreate behavior of scripts/download minus downloading
 	# anything or having anything to do with busybox.
-	mkdir -p bin
-
-	mkdir -p build/static/charts
+	mkdir -p etc bin build/static/charts
 	cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${_traefik_file} build/static/charts/${_traefik_file}
 }
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-03 17:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29  4:43 [PR PATCH] DO NOT MERGE: k3s: update to 0.10.1 voidlinux-github
2019-11-01  1:23 ` voidlinux-github
2019-11-03 17:10 ` [PR PATCH] [Updated] " voidlinux-github
2019-11-03 17:10 ` voidlinux-github
2019-11-03 17:11 ` DO NOT MERGE: k3s: update to 0.10.2 voidlinux-github
2019-11-03 17:15 ` [PR PATCH] [Updated] " voidlinux-github
2019-11-03 17:15 ` voidlinux-github
2019-11-03 17:25 ` voidlinux-github
2019-11-03 17:25 ` voidlinux-github

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).