scripts/dl_github_archive.py: rename from download.py

- Make the code more GitHub-specific
 - Requires mirror hash to work with .gitattributes
 - Use different API depending on whether PKG_SOURCE_VERSION is a
   complete commit id or other ref types like tags
 - Fix removing symbolic link
 - pre-clean dir_untar for possible leftovers from previous run

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
Yousong Zhou
2018-06-28 18:27:27 +08:00
parent e48ea13b3b
commit 04b9f85873
2 changed files with 130 additions and 125 deletions

View File

@@ -172,25 +172,25 @@ endef
define DownloadMethod/git
$(call wrap_mirror,$(1),$(2), \
$(call DownloadMethod/git-raw) \
$(call DownloadMethod/rawgit) \
)
endef
define DownloadMethod/github-tarball
define DownloadMethod/github_archive
$(call wrap_mirror,$(1),$(2), \
$(SCRIPT_DIR)/download.py dl \
$(SCRIPT_DIR)/dl_github_archive.py \
--dl-dir="$(DL_DIR)" \
--url $(foreach url,$(URL),"$(url)") \
--proto="$(PROTO)" \
--url="$(URL)" \
--version="$(VERSION)" \
--subdir="$(SUBDIR)" \
--source="$(FILE)" \
|| ( $(call DownloadMethod/git-raw) ); \
--hash="$(MIRROR_HASH)" \
|| ( $(call DownloadMethod/rawgit) ); \
)
endef
# Only intends to be called as a submethod from other DownloadMethod
define DownloadMethod/git-raw
define DownloadMethod/rawgit
echo "Checking out files from the git repository..."; \
mkdir -p $(TMP_DIR)/dl && \
cd $(TMP_DIR)/dl && \