Make builds fail if go2make misbehaves

Rather than an obscure error.
This commit is contained in:
Tim Hockin 2022-01-10 15:34:42 -08:00
parent 50e07c9a12
commit 56ad63913a

View File

@ -61,7 +61,7 @@ GO_PKGDEPS_FILE = go-pkgdeps.mk
# Include the Go package dependencies file. This will cause the rule of # Include the Go package dependencies file. This will cause the rule of
# the same name to be considered and if it is updated, make will restart and # the same name to be considered and if it is updated, make will restart and
# reload the updated deps. # reload the updated deps.
sinclude $(META_DIR)/$(GO_PKGDEPS_FILE) include $(META_DIR)/$(GO_PKGDEPS_FILE)
# Only build and run go2make on the first pass. If that generates a new # Only build and run go2make on the first pass. If that generates a new
# GO_PKGDEPS_FILE, make will restart the whole process and set MAKE_RESTARTS to # GO_PKGDEPS_FILE, make will restart the whole process and set MAKE_RESTARTS to
@ -77,17 +77,23 @@ $(META_DIR)/$(GO_PKGDEPS_FILE): FORCE
fi fi
KUBE_BUILD_PLATFORMS="" \ KUBE_BUILD_PLATFORMS="" \
hack/make-rules/build.sh hack/make-rules/helpers/go2make hack/make-rules/build.sh hack/make-rules/helpers/go2make
hack/run-in-gopath.sh go2make \ hack/run-in-gopath.sh go2make \
k8s.io/kubernetes/... \ k8s.io/kubernetes/... \
--prune k8s.io/kubernetes/staging \ --prune k8s.io/kubernetes/staging \
--prune k8s.io/kubernetes/vendor \ --prune k8s.io/kubernetes/vendor \
k8s.io/kubernetes/vendor/k8s.io/... \ k8s.io/kubernetes/vendor/k8s.io/... \
> $@.tmp > $@.tmp
if ! cmp -s $@.tmp $@; then \ if [[ -s $@.tmp ]]; then \
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \ if ! cmp -s $@.tmp $@; then \
echo "DBG: $(GO_PKGDEPS_FILE) changed"; \ if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
fi; \ echo "DBG: $(GO_PKGDEPS_FILE) changed"; \
cat $@.tmp > $@; \ fi; \
cat $@.tmp > $@; \
fi \
else \
kube::log::error "go2make produced no results"; \
rm -f $@; \
false; \
fi fi
rm -f $@.tmp rm -f $@.tmp
endif # MAKE_RESTARTS endif # MAKE_RESTARTS