diff options
author | Loïc Hoguin <[email protected]> | 2014-07-31 15:55:39 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-07-31 15:55:39 +0200 |
commit | 3a3cc1e9e513a4e578b6d5d5d25534986a59715d (patch) | |
tree | dba32e4f84a287ce867afd7b3d1bb8e307805168 | |
parent | 02315af3eb3f716a6b92f9529ffca9496356e1b7 (diff) | |
download | erlang.mk-3a3cc1e9e513a4e578b6d5d5d25534986a59715d.tar.gz erlang.mk-3a3cc1e9e513a4e578b6d5d5d25534986a59715d.tar.bz2 erlang.mk-3a3cc1e9e513a4e578b6d5d5d25534986a59715d.zip |
Fix package fetching0.3.0
Two issues got fixed:
* The variable name for the package file got changed to PKG_FILE2
to avoid conflicts with the PKG_FILE from previous erlang.mk versions.
* The way repositories are fetched changed to fix an issue preventing
fetching the package file *and* the repositories on the same invokation.
-rw-r--r-- | core/deps.mk | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/core/deps.mk b/core/deps.mk index d907d24..9c2a49f 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -22,8 +22,8 @@ endif endif export ERL_LIBS -PKG_FILE ?= $(CURDIR)/.erlang.mk.packages.v2 -export PKG_FILE +PKG_FILE2 ?= $(CURDIR)/.erlang.mk.packages.v2 +export PKG_FILE2 PKG_FILE_URL ?= https://raw.githubusercontent.com/extend/erlang.mk/master/packages.v2.tsv @@ -42,25 +42,31 @@ distclean:: distclean-deps distclean-pkg # Deps related targets. -define dep_fetch_git - git clone -n -- $(2) $(DEPS_DIR)/$(1) - cd $(DEPS_DIR)/$(1) ; git checkout -q $(3) -endef - define dep_fetch - @mkdir -p $(DEPS_DIR) -ifeq (,$(dep_$(1))) - @if [ ! -f $(PKG_FILE) ]; then $(call core_http_get,$(PKG_FILE),$(PKG_FILE_URL)); fi - $(eval DEP_FETCH_PKG := $(shell awk 'BEGIN { FS = "\t" }; $$1 == "$(1)" { print $$2 " " $$3 " "$$4 }' $(PKG_FILE))) - $(call dep_fetch_$(word 1,$(DEP_FETCH_PKG)),$(1),$(word 2,$(DEP_FETCH_PKG)),$(word 3,$(DEP_FETCH_PKG))) -else - $(call dep_fetch_$(word 1,$(dep_$(1))),$(1),$(word 2,$(dep_$(1))),$(word 3,$(dep_$(1)))) -endif + if [ "$$$$VS" = "git" ]; then \ + git clone -n -- $$$$REPO $(DEPS_DIR)/$(1); \ + cd $(DEPS_DIR)/$(1) && git checkout -q $$$$COMMIT; \ + else \ + exit 78; \ + fi endef define dep_target $(DEPS_DIR)/$(1): + @mkdir -p $(DEPS_DIR) + @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi +ifeq (,$(dep_$(1))) + DEPPKG=$$$$(awk 'BEGIN { FS = "\t" }; $$$$1 == "$(1)" { print $$$$2 " " $$$$3 " " $$$$4 }' $(PKG_FILE2);) \ + VS=$$$$(echo $$$$DEPPKG | cut -d " " -f1); \ + REPO=$$$$(echo $$$$DEPPKG | cut -d " " -f2); \ + COMMIT=$$$$(echo $$$$DEPPKG | cut -d " " -f3); \ $(call dep_fetch,$(1)) +else + VS=$(word 1,$(dep_$(1))); \ + REPO=$(word 1,$(dep_$(2))); \ + COMMIT=$(word 1,$(dep_$(3))); \ + $(call dep_fetch,$(1)) +endif endef $(foreach dep,$(DEPS),$(eval $(call dep_target,$(dep)))) @@ -70,19 +76,19 @@ distclean-deps: # Packages related targets. -$(PKG_FILE): - $(call core_http_get,$(PKG_FILE),$(PKG_FILE_URL)) +$(PKG_FILE2): + $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)) -pkg-list: $(PKG_FILE) - @cat $(PKG_FILE) | awk 'BEGIN { FS = "\t" }; { print \ +pkg-list: $(PKG_FILE2) + @cat $(PKG_FILE2) | awk 'BEGIN { FS = "\t" }; { print \ "Name:\t\t" $$1 "\n" \ "Repository:\t" $$3 "\n" \ "Website:\t" $$5 "\n" \ "Description:\t" $$6 "\n" }' ifdef q -pkg-search: $(PKG_FILE) - @cat $(PKG_FILE) | grep -i ${q} | awk 'BEGIN { FS = "\t" }; { print \ +pkg-search: $(PKG_FILE2) + @cat $(PKG_FILE2) | grep -i ${q} | awk 'BEGIN { FS = "\t" }; { print \ "Name:\t\t" $$1 "\n" \ "Repository:\t" $$3 "\n" \ "Website:\t" $$5 "\n" \ @@ -93,7 +99,7 @@ pkg-search: endif distclean-pkg: - $(gen_verbose) rm -f $(PKG_FILE) + $(gen_verbose) rm -f $(PKG_FILE2) help:: @printf "%s\n" "" \ |