aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-02-25 15:51:34 +0100
committerLoïc Hoguin <[email protected]>2020-03-04 13:17:38 +0100
commit7edc30ad40cd5dc033bc8f0e914b951abf6d0527 (patch)
tree34bd46dc848b90aca43150395f9607f47a0ff7e7
parent47038dcd2b440dcfd955339b35ad98767301f65d (diff)
downloaderlang.mk-7edc30ad40cd5dc033bc8f0e914b951abf6d0527.tar.gz
erlang.mk-7edc30ad40cd5dc033bc8f0e914b951abf6d0527.tar.bz2
erlang.mk-7edc30ad40cd5dc033bc8f0e914b951abf6d0527.zip
Add the query-deps family of targets2020.03.05
The query-deps, query-doc-deps, query-rel-deps, query-test-deps and query-shell-deps targets go through dependencies and print some information about them: $ make query-deps ... cowboy: cowlib git https://github.com/ninenines/cowlib 2.7.3 cowboy: ranch git https://github.com/ninenines/ranch 1.7.1 $ make query-deps QUERY="name repo version absolute_path" ... cowboy: cowlib https://github.com/ninenines/cowlib 2.7.3 /path/to/deps/cowlib cowboy: ranch https://github.com/ninenines/ranch 1.7.1 /path/to/deps/ranch The query-deps target is recursive; the others aren't. This mirrors the behavior when fetching and building dependencies. The full list of options is: QUERY="fetch_method name repo version extra absolute_path" When an option has no corresponding value, "-" will be printed. For example most fetch methods do not have extra information to print. When there is extra information, the value will be prefixed with a descriptive name. For example: package-name=uuid_erl This commit also introduces changes to deps handling: some of the functions for querying will now be used directly. In the future the goal is to remove the old dep_name, dep_commit, etc. functions and replace their usage with the new query functions. Custom fetch methods should implement query functions in order to have information about the relevant dependencies printed properly.
-rw-r--r--core/deps-tools.mk40
-rw-r--r--core/deps.mk77
-rw-r--r--doc/src/guide/deps.asciidoc42
-rw-r--r--test/core_query.mk290
4 files changed, 436 insertions, 13 deletions
diff --git a/core/deps-tools.mk b/core/deps-tools.mk
index e3eb913..2a632e4 100644
--- a/core/deps-tools.mk
+++ b/core/deps-tools.mk
@@ -97,3 +97,43 @@ list-shell-deps: $(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST)
list-deps list-doc-deps list-rel-deps list-test-deps list-shell-deps:
$(verbose) cat $^
+
+# Query dependencies recursively.
+
+.PHONY: query-deps query-doc-deps query-rel-deps query-test-deps \
+ query-shell-deps
+
+QUERY ?= name fetch_method repo version
+
+define query_target
+$(1): $(2) clean-tmp-query.log
+ifeq ($(IS_APP)$(IS_DEP),)
+ $(verbose) rm -f $(4)
+endif
+ $(verbose) $(foreach dep,$(3),\
+ echo $(PROJECT): $(foreach q,$(QUERY),$(call query_$(q),$(dep))) >> $(4) ;)
+ $(if $(filter-out query-deps,$(1)),,\
+ $(verbose) set -e; for dep in $(3) ; do \
+ if grep -qs ^$$$$dep$$$$ $(ERLANG_MK_TMP)/query.log; then \
+ :; \
+ else \
+ echo $$$$dep >> $(ERLANG_MK_TMP)/query.log; \
+ $(MAKE) -C $(DEPS_DIR)/$$$$dep $$@ QUERY="$(QUERY)" IS_DEP=1 || true; \
+ fi \
+ done)
+ifeq ($(IS_APP)$(IS_DEP),)
+ $(verbose) touch $(4)
+ $(verbose) cat $(4)
+endif
+endef
+
+clean-tmp-query.log:
+ifeq ($(IS_DEP),)
+ $(verbose) rm -f $(ERLANG_MK_TMP)/query.log
+endif
+
+$(eval $(call query_target,query-deps,$(ERLANG_MK_RECURSIVE_DEPS_LIST),$(BUILD_DEPS) $(DEPS),$(ERLANG_MK_QUERY_DEPS_FILE)))
+$(eval $(call query_target,query-doc-deps,$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST),$(DOC_DEPS),$(ERLANG_MK_QUERY_DOC_DEPS_FILE)))
+$(eval $(call query_target,query-rel-deps,$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST),$(REL_DEPS),$(ERLANG_MK_QUERY_REL_DEPS_FILE)))
+$(eval $(call query_target,query-test-deps,$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST),$(TEST_DEPS),$(ERLANG_MK_QUERY_TEST_DEPS_FILE)))
+$(eval $(call query_target,query-shell-deps,$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST),$(SHELL_DEPS),$(ERLANG_MK_QUERY_SHELL_DEPS_FILE)))
diff --git a/core/deps.mk b/core/deps.mk
index 6bbb05b..d928fb1 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -44,9 +44,64 @@ $(foreach p,$(DEP_EARLY_PLUGINS),\
$(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\
$(call core_dep_plugin,$p/early-plugins.mk,$p))))
-dep_name = $(if $(dep_$(1)),$(1),$(if $(pkg_$(1)_name),$(pkg_$(1)_name),$(1)))
-dep_repo = $(patsubst git://github.com/%,https://github.com/%, \
- $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo)))
+# Query functions.
+
+query_fetch_method = $(if $(dep_$(1)),$(call _qfm_dep,$(word 1,$(dep_$(1)))),$(call _qfm_pkg,$(1)))
+_qfm_dep = $(if $(dep_fetch_$(1)),$(1),$(if $(IS_DEP),legacy,fail))
+_qfm_pkg = $(if $(pkg_$(1)_fetch),$(pkg_$(1)_fetch),fail)
+
+query_name = $(if $(dep_$(1)),$(1),$(if $(pkg_$(1)_name),$(pkg_$(1)_name),$(1)))
+
+query_repo = $(call _qr,$(1),$(call query_fetch_method,$(1)))
+_qr = $(if $(query_repo_$(2)),$(call query_repo_$(2),$(1)),$(call dep_repo,$(1)))
+
+query_repo_default = $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo))
+query_repo_git = $(patsubst git://github.com/%,https://github.com/%,$(call query_repo_default,$(1)))
+query_repo_git-subfolder = $(call query_repo_git,$(1))
+query_repo_git-submodule = -
+query_repo_hg = $(call query_repo_default,$(1))
+query_repo_svn = $(call query_repo_default,$(1))
+query_repo_cp = $(call query_repo_default,$(1))
+query_repo_ln = $(call query_repo_default,$(1))
+query_repo_hex = https://hex.pm/packages/$(if $(word 3,$(dep_$(1))),$(word 3,$(dep_$(1))),$(1))
+query_repo_fail = -
+query_repo_legacy = -
+
+query_version = $(call _qv,$(1),$(call query_fetch_method,$(1)))
+_qv = $(if $(query_version_$(2)),$(call query_version_$(2),$(1)),$(call dep_commit,$(1)))
+
+query_version_default = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)))
+query_version_git = $(call query_version_default,$(1))
+query_version_git-subfolder = $(call query_version_git,$(1))
+query_version_git-submodule = -
+query_version_hg = $(call query_version_default,$(1))
+query_version_svn = -
+query_version_cp = -
+query_version_ln = -
+query_version_hex = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_commit)))
+query_version_fail = -
+query_version_legacy = -
+
+query_extra = $(call _qe,$(1),$(call query_fetch_method,$(1)))
+_qe = $(if $(query_extra_$(2)),$(call query_extra_$(2),$(1)),-)
+
+query_extra_git = -
+query_extra_git-subfolder = $(if $(dep_$(1)),subfolder=$(word 4,$(dep_$(1))),-)
+query_extra_git-submodule = -
+query_extra_hg = -
+query_extra_svn = -
+query_extra_cp = -
+query_extra_ln = -
+query_extra_hex = $(if $(dep_$(1)),package-name=$(word 3,$(dep_$(1))),-)
+query_extra_fail = -
+query_extra_legacy = -
+
+query_absolute_path = $(addprefix $(DEPS_DIR)/,$(call query_name,$(1)))
+
+# Deprecated legacy query functions.
+dep_fetch = $(call query_fetch_method,$(1))
+dep_name = $(call query_name,$(1))
+dep_repo = $(call query_repo_git,$(1))
dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(if $(filter hex,$(word 1,$(dep_$(1)))),$(word 2,$(dep_$(1))),$(word 3,$(dep_$(1)))),$(pkg_$(1)_commit)))
LOCAL_DEPS_DIRS = $(foreach a,$(LOCAL_DEPS),$(if $(wildcard $(APPS_DIR)/$(a)),$(APPS_DIR)/$(a)))
@@ -671,16 +726,6 @@ define dep_fetch_legacy
cd $(DEPS_DIR)/$(1) && git checkout -q $(if $(word 2,$(dep_$(1))),$(word 2,$(dep_$(1))),master);
endef
-define dep_fetch
- $(if $(dep_$(1)), \
- $(if $(dep_fetch_$(word 1,$(dep_$(1)))), \
- $(word 1,$(dep_$(1))), \
- $(if $(IS_DEP),legacy,fail)), \
- $(if $(filter $(1),$(PACKAGES)), \
- $(pkg_$(1)_fetch), \
- fail))
-endef
-
define dep_target
$(DEPS_DIR)/$(call dep_name,$1): | $(ERLANG_MK_TMP)
$(eval DEP_NAME := $(call dep_name,$1))
@@ -762,3 +807,9 @@ ERLANG_MK_RECURSIVE_DOC_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-doc-deps-list.log
ERLANG_MK_RECURSIVE_REL_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-rel-deps-list.log
ERLANG_MK_RECURSIVE_TEST_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-test-deps-list.log
ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-shell-deps-list.log
+
+ERLANG_MK_QUERY_DEPS_FILE = $(ERLANG_MK_TMP)/query-deps.log
+ERLANG_MK_QUERY_DOC_DEPS_FILE = $(ERLANG_MK_TMP)/query-doc-deps.log
+ERLANG_MK_QUERY_REL_DEPS_FILE = $(ERLANG_MK_TMP)/query-rel-deps.log
+ERLANG_MK_QUERY_TEST_DEPS_FILE = $(ERLANG_MK_TMP)/query-test-deps.log
+ERLANG_MK_QUERY_SHELL_DEPS_FILE = $(ERLANG_MK_TMP)/query-shell-deps.log
diff --git a/doc/src/guide/deps.asciidoc b/doc/src/guide/deps.asciidoc
index 11f09fa..066a3d8 100644
--- a/doc/src/guide/deps.asciidoc
+++ b/doc/src/guide/deps.asciidoc
@@ -180,6 +180,7 @@ The following table lists all existing methods:
| hex | hex version [pkg] | Download the given project version from hex.pm
| fail | N/A | Always fail, reserved for internal use
| legacy | N/A | Legacy Erlang.mk fetcher, reserved for internal use
+| default | N/A | Reserved
|===
The `git` and `hg` methods both have a repository and commit.
@@ -369,6 +370,47 @@ of those files directly instead. The reason is that `make fetch-*` and
`make list-*` may have unwanted content in their output, such as actual
fetching of dependencies.
+=== Querying dependencies
+
+You can obtain information about all dependencies with
+the `make query-deps` family of commands:
+
+* `make query-deps` will list dependencies found in `BUILD_DEPS`
+ and `DEPS` recursively.
+* `make query-doc-deps` will list documentation dependencies
+ of the current project.
+* `make query-rel-deps` will list release dependencies
+ of the current project.
+* `make query-shell-deps` will list shell dependencies
+ of the current project.
+* `make query-test-deps` will list test dependencies
+ of the current project.
+
+By default the information printed will be the dependency name,
+fetch method, repository and version, prefixed by the current
+project's name. But this output can be customized via the
+variable `QUERY`:
+
+[source,bash]
+$ make query-deps QUERY="name fetch_method repo version extra absolute_path"
+
+The following options are available:
+
+name:: The dependency name.
+fetch_method:: The dependency's fetch method.
+repo:: The dependency's repository.
+version:: The dependency's version, tag or commit.
+extra:: Any additional information specific to the fetch method used.
+absolute_path:: The dependency's location after it has been fetched.
+
+Fields that have no value will print `-`. For example
+not all fetch methods have a value for the `version`.
+
+The value for `extra`, when available, will be formatted
+with the name of the information printed prefixed. For
+example the hex fetch method will add
+`package-name=uuid_erl` for the `uuid` application.
+
=== Ignoring unwanted dependencies
Sometimes, you may want to ignore dependencies entirely.
diff --git a/test/core_query.mk b/test/core_query.mk
new file mode 100644
index 0000000..df44c2c
--- /dev/null
+++ b/test/core_query.mk
@@ -0,0 +1,290 @@
+# Core: Querying dependencies.
+
+CORE_QUERY_TARGETS = $(call list_targets,core-query)
+
+.PHONY: core-query $(CORE_QUERY_TARGETS)
+
+core-query: $(CORE_QUERY_TARGETS)
+
+core-query-deps: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 to DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add Cowboy to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Query the dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
+ "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0" \
+ "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-deps-c-lz4: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add lz4 to the list of build dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = lz4_src\ndep_lz4_src = git https://github.com/lz4/lz4 v1.8.2\n"}' $(APP)/Makefile
+
+ $i "Query the dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): lz4_src git https://github.com/lz4/lz4 v1.8.2" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-deps-extra: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add uuid 1.8.0 to DEPS via hex"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = uuid\ndep_uuid = hex 1.8.0 uuid_erl\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add uuid to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tuuid,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Query the dependencies of $(APP) with the extra option"
+ $t $(MAKE) -C $(APP) query-deps QUERY="name fetch_method repo version extra" $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): uuid hex https://hex.pm/packages/uuid_erl 1.8.0 package-name=uuid_erl" \
+ "uuid: quickrand git https://github.com/okeuday/quickrand.git v1.8.0 -" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-deps-hex: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add cowboy 2.7.0 to DEPS via hex"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 2.7.0\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add Cowboy to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Query the dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy hex https://hex.pm/packages/cowboy 2.7.0" \
+ "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0" \
+ "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-deps-hex-hex: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add observer_cli 1.5.3 to DEPS via hex"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = observer_cli\ndep_observer_cli = hex 1.5.3\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add observer_cli to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tobserver_cli,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Query the dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): observer_cli hex https://hex.pm/packages/observer_cli 1.5.3" \
+ "observer_cli: recon hex https://hex.pm/packages/recon 2.5.0" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-deps-no-duplicates: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 and Farwest master to DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy farwest\ndep_cowboy_commit = 2.7.0\ndep_farwest = git https://github.com/ninenines/farwest master\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add Cowboy and Farwest to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\t\tfarwest,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Query the dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
+ "$(APP): farwest git https://github.com/ninenines/farwest master" \
+ "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0" \
+ "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1" \
+ "farwest: cowlib git https://github.com/ninenines/cowlib master" \
+ "farwest: cowboy git https://github.com/ninenines/cowboy master" \
+ "farwest: gun git https://github.com/ninenines/gun master" \
+ "gun: cowlib git https://github.com/ninenines/cowlib master" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-deps-opts: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 to DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add Cowboy to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Query the dependencies of $(APP) with all options"
+ $t $(MAKE) -C $(APP) query-deps QUERY="name fetch_method repo version extra absolute_path" $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0 - $(CURDIR)/$(APP)/deps/cowboy" \
+ "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0 - $(CURDIR)/$(APP)/deps/cowlib" \
+ "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1 - $(CURDIR)/$(APP)/deps/ranch" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-deps-opts-in-makefile: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 to DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add Cowboy to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Define the QUERY variable with all options in $(APP)'s Makefile"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "QUERY = name fetch_method repo version extra absolute_path\n"}' $(APP)/Makefile
+
+ $i "Query the dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0 - $(CURDIR)/$(APP)/deps/cowboy" \
+ "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0 - $(CURDIR)/$(APP)/deps/cowlib" \
+ "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1 - $(CURDIR)/$(APP)/deps/ranch" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
+
+core-query-doc-deps: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 to DOC_DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
+
+ $i "Query the documentation dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-doc-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-doc-deps.log
+
+core-query-rel-deps: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 to REL_DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
+
+ $i "Query the release dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-rel-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-rel-deps.log
+
+core-query-shell-deps: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 to SHELL_DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
+
+ $i "Query the shell dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-shell-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-shell-deps.log
+
+core-query-test-deps: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy 2.7.0 to TEST_DEPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
+
+ $i "Query the test dependencies of $(APP)"
+ $t $(MAKE) -C $(APP) query-test-deps $v
+
+ $i "Confirm that the expected applications were found"
+ $t printf "%s\n" \
+ "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
+ > $(APP)/expected-deps.txt
+ $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-test-deps.log