mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-23 21:43:30 +08:00
pkg-download: Make a shallow clone for git downloads
When downloading from git, we clone the whole repository and then only use the latest commit. That's a lot of redundant stuff. So instead, make a shallow clone. Unfortunately that's only possible when downloading a branch or tag, so fall back to the old method if git gives an error. This speeds up the cloning of a linux git from more than 2 hours to 20 minutes on a 200KB/s link). Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Acked-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
efc10eb6b8
commit
3dd4bcf1eb
@ -73,10 +73,13 @@ domainseparator=$(if $(1),$(1),/)
|
||||
# "external dependencies" of a given build configuration.
|
||||
################################################################################
|
||||
|
||||
# Try a shallow clone - but that only works if the version is a ref (tag or
|
||||
# branch). Fall back on a full clone if it's a generic sha1.
|
||||
define DOWNLOAD_GIT
|
||||
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
||||
(pushd $(DL_DIR) > /dev/null && \
|
||||
$(GIT) clone --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME) && \
|
||||
($(GIT) clone --depth 1 -b $($(PKG)_DL_VERSION) --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME) || \
|
||||
$(GIT) clone --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME)) && \
|
||||
pushd $($(PKG)_BASE_NAME) > /dev/null && \
|
||||
$(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \
|
||||
gzip -c > $(DL_DIR)/$($(PKG)_SOURCE) && \
|
||||
|
Loading…
Reference in New Issue
Block a user