Advertisement
Guest User

k3s recipe patch

a guest
Jun 27th, 2022
43
0
80 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. From c2a352a7106161bb402a9c885a1e96e2c80939ef Mon Sep 17 00:00:00 2001
  2. From: Kamil Dziezyk <kamil.dziezyk@arm.com>
  3. Date: Tue, 21 Jun 2022 14:36:50 +0100
  4. Subject: [PATCH] k3s: Bump k3s version to v1.22.8-k3s1+dirty
  5.  
  6. Also make the build compatible with golang 1.18.
  7.  
  8. Signed-off-by: Kamil Dziezyk <kamil.dziezyk@arm.com>
  9. ---
  10. ...ke-build-compatible-with-golang-1.18.patch | 25 +++++++++++
  11. recipes-containers/k3s/k3s_git.bb | 43 ++++++++++---------
  12. 2 files changed, 48 insertions(+), 20 deletions(-)
  13. create mode 100644 recipes-containers/k3s/k3s/0002-k3s-Make-build-compatible-with-golang-1.18.patch
  14.  
  15. diff --git a/recipes-containers/k3s/k3s/0002-k3s-Make-build-compatible-with-golang-1.18.patch b/recipes-containers/k3s/k3s/0002-k3s-Make-build-compatible-with-golang-1.18.patch
  16. new file mode 100644
  17. index 0000000..754b184
  18. --- /dev/null
  19. +++ b/recipes-containers/k3s/k3s/0002-k3s-Make-build-compatible-with-golang-1.18.patch
  20. @@ -0,0 +1,25 @@
  21. +From 275b3af7f4685ae2776f695b9bc0ab0e75581e05 Mon Sep 17 00:00:00 2001
  22. +From: Kamil Dziezyk <kamil.dziezyk@arm.com>
  23. +Date: Tue, 21 Jun 2022 13:18:54 +0100
  24. +Subject: [PATCH] k3s: Make build compatible with golang 1.18
  25. +
  26. +Signed-off-by: Kamil Dziezyk <kamil.dziezyk@arm.com>
  27. +---
  28. + cmd/k3s/main.go | 1 +
  29. + 1 file changed, 1 insertion(+)
  30. +
  31. +diff --git a/cmd/k3s/main.go b/cmd/k3s/main.go
  32. +index de9760d682..1425ff3709 100644
  33. +--- a/cmd/k3s/main.go
  34. ++++ b/cmd/k3s/main.go
  35. +@@ -21,6 +21,7 @@ import (
  36. + "github.com/rancher/wrangler/pkg/resolvehome"
  37. + "github.com/sirupsen/logrus"
  38. + "github.com/urfave/cli"
  39. ++ "debug/gosym"
  40. + )
  41. +
  42. + var criDefaultConfigPath = "/etc/crictl.yaml"
  43. +--
  44. +2.17.1
  45. +
  46. diff --git a/recipes-containers/k3s/k3s_git.bb b/recipes-containers/k3s/k3s_git.bb
  47. index 7f9f549..ca8db58 100644
  48. --- a/recipes-containers/k3s/k3s_git.bb
  49. +++ b/recipes-containers/k3s/k3s_git.bb
  50. @@ -11,17 +11,19 @@ SRC_URI = "git://github.com/rancher/k3s.git;branch=release-1.22;name=k3s;protoco
  51. file://k3s-clean \
  52. file://cni-containerd-net.conf \
  53. file://0001-Finding-host-local-in-usr-libexec.patch;patchdir=src/import \
  54. + file://0002-k3s-Make-build-compatible-with-golang-1.18.patch;patchdir=src/import \
  55. file://k3s-killall.sh \
  56. file://modules.txt \
  57. "
  58.  
  59. SRC_URI[k3s.md5sum] = "363d3a08dc0b72ba6e6577964f6e94a5"
  60. -SRCREV_k3s = "4262c6b91a43ef8411870f72ff8b8715949f90e2"
  61. +# works
  62. +SRCREV_k3s = "21fed356e6a180b0477702b170ae31968a084b40"
  63.  
  64. SRCREV_FORMAT = "k3s_fuse"
  65. -PV = "v1.22.6+k3s1+git${SRCREV_k3s}"
  66. +PV = "v1.22.8+k3s1+git${SRCREV_k3s}"
  67.  
  68. -include src_uri.inc
  69. +#include src_uri.inc
  70.  
  71. CNI_NETWORKING_FILES ?= "${WORKDIR}/cni-containerd-net.conf"
  72.  
  73. @@ -35,19 +37,19 @@ PACKAGECONFIG[upx] = ",,upx-native"
  74. GO_IMPORT = "import"
  75. GO_BUILD_LDFLAGS = "-X github.com/rancher/k3s/pkg/version.Version=${PV} \
  76. -X github.com/rancher/k3s/pkg/version.GitCommit=${@d.getVar('SRCREV_k3s', d, 1)[:8]} \
  77. - -w -s \
  78. + -w -s -extldflags '-static -lm -ldl -lz -lpthread'\
  79. "
  80. BIN_PREFIX ?= "${exec_prefix}/local"
  81.  
  82. inherit features_check
  83. REQUIRED_DISTRO_FEATURES ?= "seccomp"
  84.  
  85. -DEPENDS += "rsync-native"
  86. +DEPENDS += "rsync-native zlib"
  87.  
  88. do_compile() {
  89. export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
  90. export CGO_ENABLED="1"
  91. - export GOFLAGS="-mod=vendor"
  92. + export GOFLAGS="-mod=vendor -modcacherw"
  93.  
  94. TAGS="static_build ctrd no_btrfs netcgo osusergo providerless"
  95.  
  96. @@ -610,21 +612,22 @@ do_compile() {
  97. sigs.k8s.io/testing_frameworks:sigs.k8s.io/testing_frameworks \
  98. sigs.k8s.io/yaml:sigs.k8s.io/yaml \
  99. sigs.k8s.io/json:sigs.k8s.io/json"
  100. - for s in $sites; do
  101. - site_dest=$(echo $s | cut -d: -f1)
  102. - site_source=$(echo $s | cut -d: -f2)
  103. - mkdir -p vendor.copy/$site_dest
  104. - [ -n "$(ls -A vendor.copy/$site_dest/*.go 2> /dev/null)" ] && { echo "[INFO] vendor.fetch/$site_source -> $site_dest: go copy skipped (files present)" ; true ; } || { echo "[INFO] $site_dest: copying .go files" ; rsync -a --exclude='vendor/' --exclude='.git/' vendor.fetch/$site_source/ vendor.copy/$site_dest ; }
  105. - done
  106. -
  107. - ln -sf vendor.copy vendor
  108. -
  109. - # these are bad symlinks, go validates them and breaks the build if they are present
  110. - rm -f vendor/go.etcd.io/etcd/client/v3/example_*
  111. - rm -f vendor/go.etcd.io/etcd/client/v3/concurrency/example_*.go
  112. -
  113. - cp ${WORKDIR}/modules.txt vendor/
  114. +# for s in $sites; do
  115. +# site_dest=$(echo $s | cut -d: -f1)
  116. +# site_source=$(echo $s | cut -d: -f2)
  117. +# mkdir -p vendor.copy/$site_dest
  118. +# [ -n "$(ls -A vendor.copy/$site_dest/*.go 2> /dev/null)" ] && { echo "[INFO] vendor.fetch/$site_source -> $site_dest: go copy skipped (files present)" ; true ; } || { echo "[INFO] $site_dest: copying .go files" ; rsync -a --exclude='vendor/' --exclude='.git/' vendor.fetch/$site_source/ vendor.copy/$site_dest ; }
  119. +# done
  120. +#
  121. +# ln -sf vendor.copy vendor
  122. +#
  123. +# # these are bad symlinks, go validates them and breaks the build if they are present
  124. +# rm -f vendor/go.etcd.io/etcd/client/v3/example_*
  125. +# rm -f vendor/go.etcd.io/etcd/client/v3/concurrency/example_*.go
  126. +#
  127. +# cp ${WORKDIR}/modules.txt vendor/
  128.  
  129. + ${GO} mod vendor -v && ${GO} mod tidy -v
  130. ${GO} build -tags "$TAGS" -ldflags "${GO_BUILD_LDFLAGS} -w -s" -o ./dist/artifacts/k3s ./cmd/server/main.go
  131.  
  132. # Use UPX if it is enabled (and thus exists) to compress binary
  133. --
  134. 2.17.1
  135.  
  136.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement