From 490e45a52e1c683d658fa507eb05984215b6a4ce Mon Sep 17 00:00:00 2001 From: "Hui, Chunyang" Date: Fri, 17 Apr 2020 02:50:21 +0000 Subject: [PATCH] Fix git submodule update failure in some environments Submodules of Occlum may have a very big size and under some environments git submodule update can always fail. Now OCCLUM_GIT_OPTIONS can read from environment. And user can specify the depth of the submodule like this: OCCLUM_GIT_OPTIONS="--depth 1" make submodule, which can make it more possible to succeed. --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 81968c96..7db805fa 100644 --- a/Makefile +++ b/Makefile @@ -6,20 +6,21 @@ githooks: @find .git/hooks -type l -exec rm {} \; && find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \; @echo "Add Git hooks that check Rust code format issues before commits and pushes" +OCCLUM_GIT_OPTIONS ?= GIT_MIN_VERSION := 2.11.0 GIT_CURRENT_VERSION := $(shell git --version | sed 's/[^0-9.]*//g') GIT_NEED_PROGRESS := $(shell /bin/echo -e "$(GIT_MIN_VERSION)\n$(GIT_CURRENT_VERSION)" \ | sort -V | head -n1 | grep -q $(GIT_MIN_VERSION) && echo "true" || echo "false") # If git version >= min_version, append the `--progress` option to show progress status ifeq ($(GIT_NEED_PROGRESS), true) - GIT_OPTION := --progress + OCCLUM_GIT_OPTIONS += --progress else - GIT_OPTION := + OCCLUM_GIT_OPTIONS += endif submodule: githooks git submodule init - git submodule update $(GIT_OPTION) + git submodule update $(OCCLUM_GIT_OPTIONS) @# Try to apply the patches. If failed, check if the patches are already applied cd deps/rust-sgx-sdk && git apply ../rust-sgx-sdk.patch >/dev/null 2>&1 || git apply ../rust-sgx-sdk.patch -R --check cd deps/serde-json-sgx && git apply ../serde-json-sgx.patch >/dev/null 2>&1 || git apply ../serde-json-sgx.patch -R --check