3
0
Fork 0
forked from mirrors/nixpkgs

kubernetes: patch broken go version check

fixes #35403
patch from https://github.com/kubernetes/kubernetes/pull/58207
already merged upstream - remove for next version
This commit is contained in:
xeji 2018-02-23 22:56:36 +01:00
parent b492e2a164
commit b54e5b908d
2 changed files with 16 additions and 0 deletions

View file

@ -29,6 +29,11 @@ stdenv.mkDerivation rec {
outputs = ["out" "man" "pause"]; outputs = ["out" "man" "pause"];
# patch broken go version check, see issue #35403
# patch is from https://github.com/kubernetes/kubernetes/pull/58207
#TODO: patch already merged upstream - remove for next k8s version
patches = [ ./go-version-check.patch ];
postPatch = '' postPatch = ''
substituteInPlace "hack/lib/golang.sh" --replace "_cgo" "" substituteInPlace "hack/lib/golang.sh" --replace "_cgo" ""
substituteInPlace "hack/generate-docs.sh" --replace "make" "make SHELL=${stdenv.shell}" substituteInPlace "hack/generate-docs.sh" --replace "make" "make SHELL=${stdenv.shell}"

View file

@ -0,0 +1,11 @@
--- a/hack/lib/golang.sh
+++ b/hack/lib/golang.sh
@@ -323,7 +323,7 @@ EOF
go_version=($(go version))
local minimum_go_version
minimum_go_version=go1.9.1
- if [[ "${go_version[2]}" < "${minimum_go_version}" && "${go_version[2]}" != "devel" ]]; then
+ if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
kube::log::usage_from_stdin <<EOF
Detected go version: ${go_version[*]}.
Kubernetes requires ${minimum_go_version} or greater.