aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-containers/kubernetes/kubernetes/0001-Makefile.generated_files-Fix-race-issue-for-installi.patch
blob: 02bb5e91337270cdd4dd27d350c87a9c40c1f300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 441df8a24a2c80e320f140b5d9bc352c7ce8a64a Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Thu, 15 Oct 2020 07:27:35 +0000
Subject: [PATCH] src/import/build/root/Makefile.generated_files: Fix race issue for installing
 go2make

The src/import/build/root/Makefile.generated_files are called several times during the build, so the
following target which installs go2make will also run several times:

$(META_DIR)/$(GO_PKGDEPS_FILE): FORCE

It runs automatically when the Makefile is called because of:
sinclude $(META_DIR)/$(GO_PKGDEPS_FILE)

So there is a race issue of go2make when parallel build:
hack/run-in-gopath.sh: line 34: build/tmp-glibc/work/corei7-64-wrs-linux/kubernetes/1.18.8-r0/git/src/import/_output/local/go/bin/go2make: No such file or directory

It is because the first process is using go2make, but then the second process
removes it and reinstall it.

Check whether go2make has been installed or not before install it can fix the
problem.

Upstream-Status: Pending

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 src/import/build/root/Makefile.generated_files | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630/src/import/build/root/Makefile.generated_files
===================================================================
--- kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630.orig/src/import/build/root/Makefile.generated_files
+++ kubernetes-v1.21.1+git45da3fc33872083fb225c1a8c4d03e530d6f7630/src/import/build/root/Makefile.generated_files
@@ -67,7 +67,9 @@
 	if [[ "$(DBG_CODEGEN)" == 1 ]]; then          \
 	    echo "DBG: calculating Go dependencies";  \
 	fi
-	hack/run-in-gopath.sh go install ./hack/make-rules/helpers/go2make
+	if [ ! -e _output/local/go/bin/go2make ]; then \
+		hack/run-in-gopath.sh go install ./hack/make-rules/helpers/go2make; \
+	fi
 	hack/run-in-gopath.sh go2make                       \
 	    k8s.io/kubernetes/...                           \
 	    --prune  k8s.io/kubernetes/staging              \