From 2163fef859c46ebe5f3d7827ce8ddfd45ee56691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 3 Dec 2018 20:50:42 +0100 Subject: Print a changelog when updating Erlang.mk --- CHANGELOG.asciidoc | 9 +++++++++ Makefile | 7 ++++++- core/core.mk | 14 +++++++------- test/core_upgrade.mk | 24 ++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 CHANGELOG.asciidoc diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc new file mode 100644 index 0000000..ef5d2f2 --- /dev/null +++ b/CHANGELOG.asciidoc @@ -0,0 +1,9 @@ +2018/12/03: Changelog introduced. + +2018/12/03: Relx has been updated to v3.27.0. + +2018/12/03: Dependencies are no longer always rebuilt by + default. Please check the documentation for + information. A quick fix if this causes an + issue is to add `FULL = 1` at the top of your + Makefile. diff --git a/Makefile b/Makefile index 89015a0..b6b245c 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,12 @@ ERLANG_MK_VERSION = $(shell git describe --dirty --tags --always) .PHONY: all check all: - export LC_COLLATE=C; \ +# Temporarily force the printing of the CHANGELOG. +# The required variable hadn't been introduced yet. +#ifdef UPGRADE + @cat CHANGELOG.asciidoc +#endif + @export LC_COLLATE=C; \ awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \ | sed 's/^ERLANG_MK_VERSION =.*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' \ | sed 's:^ERLANG_MK_WITHOUT =.*:ERLANG_MK_WITHOUT = $(WITHOUT):' > $(ERLANG_MK) diff --git a/core/core.mk b/core/core.mk index bc4d306..27e8a87 100644 --- a/core/core.mk +++ b/core/core.mk @@ -196,15 +196,15 @@ ERLANG_MK_BUILD_DIR ?= .erlang.mk.build erlang-mk: WITHOUT ?= $(ERLANG_MK_WITHOUT) erlang-mk: ifdef ERLANG_MK_COMMIT - git clone $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR) - cd $(ERLANG_MK_BUILD_DIR) && git checkout $(ERLANG_MK_COMMIT) + $(verbose) git clone $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR) + $(verbose) cd $(ERLANG_MK_BUILD_DIR) && git checkout $(ERLANG_MK_COMMIT) else - git clone --depth 1 $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR) + $(verbose) git clone --depth 1 $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR) endif - if [ -f $(ERLANG_MK_BUILD_CONFIG) ]; then cp $(ERLANG_MK_BUILD_CONFIG) $(ERLANG_MK_BUILD_DIR)/build.config; fi - $(MAKE) -C $(ERLANG_MK_BUILD_DIR) WITHOUT='$(strip $(WITHOUT))' - cp $(ERLANG_MK_BUILD_DIR)/erlang.mk ./erlang.mk - rm -rf $(ERLANG_MK_BUILD_DIR) + $(verbose) if [ -f $(ERLANG_MK_BUILD_CONFIG) ]; then cp $(ERLANG_MK_BUILD_CONFIG) $(ERLANG_MK_BUILD_DIR)/build.config; fi + $(gen_verbose) $(MAKE) --no-print-directory -C $(ERLANG_MK_BUILD_DIR) WITHOUT='$(strip $(WITHOUT))' UPGRADE=1 + $(verbose) cp $(ERLANG_MK_BUILD_DIR)/erlang.mk ./erlang.mk + $(verbose) rm -rf $(ERLANG_MK_BUILD_DIR) # The erlang.mk package index is bundled in the default erlang.mk build. # Search for the string "copyright" to skip to the rest of the code. diff --git a/test/core_upgrade.mk b/test/core_upgrade.mk index 3a2a43e..9567518 100644 --- a/test/core_upgrade.mk +++ b/test/core_upgrade.mk @@ -6,6 +6,30 @@ CORE_UPGRADE_TARGETS = $(call list_targets,core-upgrade) core-upgrade: $(CORE_UPGRADE_TARGETS) +core-upgrade-changelog: build clean + + $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 "Fork erlang.mk locally and set a test CHANGELOG.asciidoc" + $t git clone -q https://github.com/ninenines/erlang.mk $(APP)/alt-erlangmk-repo + $t echo "$(APP)$(APP)" > $(APP)/alt-erlangmk-repo/CHANGELOG.asciidoc +# Since part of this functionality needs the main Makefile, copy it. + $t cp ../Makefile $(APP)/alt-erlangmk-repo/ + $t (cd $(APP)/alt-erlangmk-repo && \ + git config user.email "testsuite@erlang.mk" && \ + git config user.name "test suite" && \ + git add CHANGELOG.asciidoc Makefile && \ + git commit -q --no-gpg-sign -a -m 'Add test changelog') + + $i "Point application to an alternate erlang.mk repository" + $t perl -ni.bak -e 'print;if ($$.==1) {print "ERLANG_MK_REPO = file://$(abspath $(APP)/alt-erlangmk-repo)\n"}' $(APP)/Makefile + + $i "Update erlang.mk; CHANGELOG.asciidoc should be printed" + $t $(MAKE) -C $(APP) erlang-mk | grep -c "$(APP)$(APP)" | grep -q 1 + core-upgrade-conflicting-configs: build clean $i "Bootstrap a new OTP library named $(APP)" -- cgit v1.2.3