64 # If that fails, create an archive by cloning the SCM repo, |
64 # If that fails, create an archive by cloning the SCM repo, |
65 # updating to the selected changeset, archiving that directory, and cleaning up |
65 # updating to the selected changeset, archiving that directory, and cleaning up |
66 # when complete. |
66 # when complete. |
67 # |
67 # |
68 # GIT CLONE ARGS |
68 # GIT CLONE ARGS |
69 # --depth=1 arg to git clone takes only the top level (named) commits on any |
69 # A shallow clone (--depth=1) to git clone takes only the top level (named) |
70 # branches or tags. Attempts to use other commit IDs will fail. |
70 # commits on any branches or tags and can cause use of other commit IDs to |
|
71 # fail. As such, it should never be used here as it can make it impossible to |
|
72 # reliably reproduce archives created from the result since git clone (unlike |
|
73 # mercurial) currently has no way of cloning to a specific commit id. |
71 $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ) |
74 $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ) |
72 $$(FETCH) --file $$@ \ |
75 $$(FETCH) --file $$@ \ |
73 $$(GIT_HASH$(1):%=--hash %) || \ |
76 $$(GIT_HASH$(1):%=--hash %) || \ |
74 ( \ |
77 ( \ |
75 $$(FETCH) --file $$@ \ |
78 $$(FETCH) --file $$@ \ |
76 $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) || \ |
79 $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) || \ |
77 (TMP_REPO=$$$$(mktemp --directory) && \ |
80 (TMP_REPO=$$$$(mktemp --directory) && \ |
78 $(GIT) clone --depth=1 $$(GIT_REPO$(1)) $$(GIT_BRANCH_ARG$(1)) $$$${TMP_REPO} && \ |
81 $(GIT) clone $$(GIT_REPO$(1)) $$(GIT_BRANCH_ARG$(1)) $$$${TMP_REPO} && \ |
79 (cd $$$${TMP_REPO} ; $(GIT) checkout \ |
82 (cd $$$${TMP_REPO} ; $(GIT) checkout \ |
80 $$(GIT_COMMIT_ID$(1))) && \ |
83 $$(GIT_COMMIT_ID$(1))) && \ |
81 (cd $$$${TMP_REPO} ; $(GIT) archive --format tar.gz \ |
84 (cd $$$${TMP_REPO} ; $(GIT) archive --format tar.gz \ |
82 --prefix $$(COMPONENT_SRC$(1))/ \ |
85 --prefix $$(COMPONENT_SRC$(1))/ \ |
83 $$(or $$(GIT_COMMIT_ID$(1)),$$(GIT_BRANCH$(1)))) > $$@ && \ |
86 $$(or $$(GIT_COMMIT_ID$(1)),$$(GIT_BRANCH$(1)))) > $$@ && \ |