core_query.mk 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. # Core: Querying dependencies.
  2. CORE_QUERY_TARGETS = $(call list_targets,core-query)
  3. .PHONY: core-query $(CORE_QUERY_TARGETS)
  4. core-query: $(CORE_QUERY_TARGETS)
  5. core-query-deps: init
  6. $i "Bootstrap a new OTP library named $(APP)"
  7. $t mkdir $(APP)/
  8. $t cp ../erlang.mk $(APP)/
  9. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  10. $i "Add Cowboy 2.7.0 to DEPS"
  11. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
  12. ifdef LEGACY
  13. $i "Add Cowboy to the applications key in the .app.src file"
  14. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  15. endif
  16. $i "Query the dependencies of $(APP)"
  17. $t $(MAKE) -C $(APP) query-deps $v
  18. $i "Confirm that the expected applications were found"
  19. $t printf "%s\n" \
  20. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
  21. "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0" \
  22. "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1" \
  23. > $(APP)/expected-deps.txt
  24. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  25. core-query-deps-c-lz4: init
  26. $i "Bootstrap a new OTP library named $(APP)"
  27. $t mkdir $(APP)/
  28. $t cp ../erlang.mk $(APP)/
  29. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  30. $i "Add lz4 to the list of build dependencies"
  31. $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
  32. $i "Query the dependencies of $(APP)"
  33. $t $(MAKE) -C $(APP) query-deps $v
  34. $i "Confirm that the expected applications were found"
  35. $t printf "%s\n" \
  36. "$(APP): lz4_src git https://github.com/lz4/lz4 v1.8.2" \
  37. > $(APP)/expected-deps.txt
  38. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  39. core-query-deps-extra: init
  40. $i "Bootstrap a new OTP library named $(APP)"
  41. $t mkdir $(APP)/
  42. $t cp ../erlang.mk $(APP)/
  43. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  44. $i "Add uuid 1.8.0 to DEPS via hex"
  45. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = uuid\ndep_uuid = hex 1.8.0 uuid_erl\n"}' $(APP)/Makefile
  46. ifdef LEGACY
  47. $i "Add uuid to the applications key in the .app.src file"
  48. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tuuid,\n"}' $(APP)/src/$(APP).app.src
  49. endif
  50. $i "Query the dependencies of $(APP) with the extra option"
  51. $t $(MAKE) -C $(APP) query-deps QUERY="name fetch_method repo version extra" $v
  52. $i "Confirm that the expected applications were found"
  53. $t printf "%s\n" \
  54. "$(APP): uuid hex https://hex.pm/packages/uuid_erl 1.8.0 package-name=uuid_erl" \
  55. "uuid: quickrand git https://github.com/okeuday/quickrand.git v1.8.0 -" \
  56. > $(APP)/expected-deps.txt
  57. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  58. core-query-deps-hex: init
  59. $i "Bootstrap a new OTP library named $(APP)"
  60. $t mkdir $(APP)/
  61. $t cp ../erlang.mk $(APP)/
  62. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  63. $i "Add cowboy 2.7.0 to DEPS via hex"
  64. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 2.7.0\n"}' $(APP)/Makefile
  65. ifdef LEGACY
  66. $i "Add Cowboy to the applications key in the .app.src file"
  67. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  68. endif
  69. $i "Query the dependencies of $(APP)"
  70. $t $(MAKE) -C $(APP) query-deps $v
  71. $i "Confirm that the expected applications were found"
  72. $t printf "%s\n" \
  73. "$(APP): cowboy hex https://hex.pm/packages/cowboy 2.7.0" \
  74. "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0" \
  75. "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1" \
  76. > $(APP)/expected-deps.txt
  77. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  78. core-query-deps-hex-hex: init
  79. $i "Bootstrap a new OTP library named $(APP)"
  80. $t mkdir $(APP)/
  81. $t cp ../erlang.mk $(APP)/
  82. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  83. $i "Add observer_cli 1.5.3 to DEPS via hex"
  84. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = observer_cli\ndep_observer_cli = hex 1.5.3\n"}' $(APP)/Makefile
  85. ifdef LEGACY
  86. $i "Add observer_cli to the applications key in the .app.src file"
  87. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tobserver_cli,\n"}' $(APP)/src/$(APP).app.src
  88. endif
  89. $i "Query the dependencies of $(APP)"
  90. $t $(MAKE) -C $(APP) query-deps $v
  91. $i "Confirm that the expected applications were found"
  92. $t printf "%s\n" \
  93. "$(APP): observer_cli hex https://hex.pm/packages/observer_cli 1.5.3" \
  94. "observer_cli: recon hex https://hex.pm/packages/recon 2.5.0" \
  95. > $(APP)/expected-deps.txt
  96. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  97. core-query-deps-no-duplicates: init
  98. $i "Bootstrap a new OTP library named $(APP)"
  99. $t mkdir $(APP)/
  100. $t cp ../erlang.mk $(APP)/
  101. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  102. $i "Add Cowboy 2.7.0 and Farwest master to DEPS"
  103. $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 017dc36b59f028e7014bad927e745a2c0b529018\n"}' $(APP)/Makefile
  104. ifdef LEGACY
  105. $i "Add Cowboy and Farwest to the applications key in the .app.src file"
  106. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\t\tfarwest,\n"}' $(APP)/src/$(APP).app.src
  107. endif
  108. $i "Query the dependencies of $(APP)"
  109. $t $(MAKE) -C $(APP) query-deps $v
  110. $i "Confirm that the expected applications were found"
  111. $t printf "%s\n" \
  112. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
  113. "$(APP): farwest git https://github.com/ninenines/farwest 017dc36b59f028e7014bad927e745a2c0b529018" \
  114. "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0" \
  115. "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1" \
  116. "farwest: cowlib git https://github.com/ninenines/cowlib master" \
  117. "farwest: cowboy git https://github.com/ninenines/cowboy master" \
  118. "farwest: gun git https://github.com/ninenines/gun master" \
  119. "gun: cowlib git https://github.com/ninenines/cowlib 2.11.0" \
  120. > $(APP)/expected-deps.txt
  121. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  122. core-query-deps-opts: init
  123. $i "Bootstrap a new OTP library named $(APP)"
  124. $t mkdir $(APP)/
  125. $t cp ../erlang.mk $(APP)/
  126. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  127. $i "Add Cowboy 2.7.0 to DEPS"
  128. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
  129. ifdef LEGACY
  130. $i "Add Cowboy to the applications key in the .app.src file"
  131. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  132. endif
  133. $i "Query the dependencies of $(APP) with all options"
  134. $t $(MAKE) -C $(APP) query-deps QUERY="name fetch_method repo version extra absolute_path" $v
  135. $i "Confirm that the expected applications were found"
  136. $t printf "%s\n" \
  137. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0 - $(CURDIR)/$(APP)/deps/cowboy" \
  138. "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0 - $(CURDIR)/$(APP)/deps/cowlib" \
  139. "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1 - $(CURDIR)/$(APP)/deps/ranch" \
  140. > $(APP)/expected-deps.txt
  141. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  142. core-query-deps-opts-in-makefile: init
  143. $i "Bootstrap a new OTP library named $(APP)"
  144. $t mkdir $(APP)/
  145. $t cp ../erlang.mk $(APP)/
  146. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  147. $i "Add Cowboy 2.7.0 to DEPS"
  148. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
  149. ifdef LEGACY
  150. $i "Add Cowboy to the applications key in the .app.src file"
  151. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  152. endif
  153. $i "Define the QUERY variable with all options in $(APP)'s Makefile"
  154. $t perl -ni.bak -e 'print;if ($$.==1) {print "QUERY = name fetch_method repo version extra absolute_path\n"}' $(APP)/Makefile
  155. $i "Query the dependencies of $(APP)"
  156. $t $(MAKE) -C $(APP) query-deps $v
  157. $i "Confirm that the expected applications were found"
  158. $t printf "%s\n" \
  159. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0 - $(CURDIR)/$(APP)/deps/cowboy" \
  160. "cowboy: cowlib git https://github.com/ninenines/cowlib 2.8.0 - $(CURDIR)/$(APP)/deps/cowlib" \
  161. "cowboy: ranch git https://github.com/ninenines/ranch 1.7.1 - $(CURDIR)/$(APP)/deps/ranch" \
  162. > $(APP)/expected-deps.txt
  163. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  164. core-query-doc-deps: init
  165. $i "Bootstrap a new OTP library named $(APP)"
  166. $t mkdir $(APP)/
  167. $t cp ../erlang.mk $(APP)/
  168. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  169. $i "Add Cowboy 2.7.0 to DOC_DEPS"
  170. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
  171. $i "Query the documentation dependencies of $(APP)"
  172. $t $(MAKE) -C $(APP) query-doc-deps $v
  173. $i "Confirm that the expected applications were found"
  174. $t printf "%s\n" \
  175. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
  176. > $(APP)/expected-deps.txt
  177. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-doc-deps.log
  178. core-query-no-deps: init
  179. $i "Bootstrap a new OTP library named $(APP)"
  180. $t mkdir $(APP)/
  181. $t cp ../erlang.mk $(APP)/
  182. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  183. $i "Query the dependencies of $(APP)"
  184. $t $(MAKE) -C $(APP) query-deps $v
  185. $i "Confirm that nothing was found"
  186. $t touch $(APP)/expected-deps.txt
  187. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
  188. core-query-rel-deps: init
  189. $i "Bootstrap a new OTP library named $(APP)"
  190. $t mkdir $(APP)/
  191. $t cp ../erlang.mk $(APP)/
  192. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  193. $i "Add Cowboy 2.7.0 to REL_DEPS"
  194. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
  195. $i "Query the release dependencies of $(APP)"
  196. $t $(MAKE) -C $(APP) query-rel-deps $v
  197. $i "Confirm that the expected applications were found"
  198. $t printf "%s\n" \
  199. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
  200. > $(APP)/expected-deps.txt
  201. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-rel-deps.log
  202. core-query-shell-deps: init
  203. $i "Bootstrap a new OTP library named $(APP)"
  204. $t mkdir $(APP)/
  205. $t cp ../erlang.mk $(APP)/
  206. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  207. $i "Add Cowboy 2.7.0 to SHELL_DEPS"
  208. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
  209. $i "Query the shell dependencies of $(APP)"
  210. $t $(MAKE) -C $(APP) query-shell-deps $v
  211. $i "Confirm that the expected applications were found"
  212. $t printf "%s\n" \
  213. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
  214. > $(APP)/expected-deps.txt
  215. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-shell-deps.log
  216. core-query-test-deps: init
  217. $i "Bootstrap a new OTP library named $(APP)"
  218. $t mkdir $(APP)/
  219. $t cp ../erlang.mk $(APP)/
  220. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  221. $i "Add Cowboy 2.7.0 to TEST_DEPS"
  222. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = cowboy\ndep_cowboy_commit = 2.7.0\n"}' $(APP)/Makefile
  223. $i "Query the test dependencies of $(APP)"
  224. $t $(MAKE) -C $(APP) query-test-deps $v
  225. $i "Confirm that the expected applications were found"
  226. $t printf "%s\n" \
  227. "$(APP): cowboy git https://github.com/ninenines/cowboy 2.7.0" \
  228. > $(APP)/expected-deps.txt
  229. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-test-deps.log