diff --git a/CHANGELOG.md b/CHANGELOG.md index 794416aa8f3a363e58eb79f1cb558dffcdda750c..91d52757d5fbdc610d30031a79f15dd53f28f46d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed issue where updated dependencies of substitution files did not retrigger a .db expansion. ### Other changes +* Patch system now applies all patches in the `patch/` directory. Versioning for patches should be handled by git, + not by require. ## [4.0.0] diff --git a/configure/E3/DEFINES_FT b/configure/E3/DEFINES_FT index b88cb9c47ffa8e0015d0aadf793869476466539e..0d0e6474164310081ec50af5b8bb7a139e8a2806 100644 --- a/configure/E3/DEFINES_FT +++ b/configure/E3/DEFINES_FT @@ -13,7 +13,7 @@ git submodule update --remote --merge $@/ endef define patch_site -patches=$$(ls $(TOP)/patch/Site/$(E3_MODULE_VERSION)/*.p0.patch 2> /dev/null); \ +patches=$$(ls $(TOP)/patch/*.p0.patch 2> /dev/null); \ if [ -n "$$patches" ]; then \ for i in $$patches; do \ printf "\nPatching %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \ @@ -25,7 +25,7 @@ fi endef define patch_revert_site -patches=$$(ls $(TOP)/patch/Site/$(E3_MODULE_VERSION)/*.p0.patch 2> /dev/null); \ +patches=$$(ls $(TOP)/patch/*.p0.patch 2> /dev/null); \ if [ -n "$$patches" ]; then \ for i in $$patches; do\ printf "\nReverting applied patch %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \ diff --git a/configure/E3/RULES_PATCH b/configure/E3/RULES_PATCH index d2a6d0f6613be31117328fd8f01c4ba5b3fad9e8..94220c6bd44634235739d0b40da9e48835c2c413 100644 --- a/configure/E3/RULES_PATCH +++ b/configure/E3/RULES_PATCH @@ -1,15 +1,10 @@ .PHONY: patch patchrevert -.PHONY: check_for_old_patches -check_for_old_patches: - $(if $(wildcard $(TOP)/patch/Site/$(patsubst %+0,%,$(E3_MODULE_VERSION))*.p0.patch),$(warning Warning: old-style patches detected. Please move them to patch/Site/$$E3_MODULE_VERSION/.)) - - ## Apply Patch Files -patch: check_for_old_patches +patch: $(QUIET) $(call patch_site) ## Revert Patch Files -patchrevert: check_for_old_patches +patchrevert: $(QUIET) $(call patch_revert_site) diff --git a/tests/test_build.py b/tests/test_build.py index f3f4022ae2cd8630bd61d6a640d9a0bcde2209d5..f58cb98ca7b7fc709ae2744d3023b6160c826052 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -35,19 +35,9 @@ def test_patch(wrapper): with open(db_path, "w") as f: f.write(db_file_contents) - patch_dir = wrapper.path / "patch" / "Site" - create_patch_file(patch_dir / MODULE_VERSION / "apply.p0.patch", "OK") - create_patch_file( - patch_dir / MODULE_VERSION_NO_BUILD / "dont-apply.p0.patch", "Bad" - ) - create_patch_file(patch_dir / (MODULE_VERSION + "-dont-apply.p0.patch"), "Bad") - - rc, outs, _ = wrapper.run_make( - "init", - module_version=MODULE_VERSION, - ) - assert rc == 0 - assert "You are in the local source mode" in outs + patch_dir = wrapper.path / "patch" + create_patch_file(patch_dir / "apply.p0.patch", "OK") + create_patch_file(patch_dir / MODULE_VERSION / "do-not-apply.p0.patch", "Bad") rc, _, _ = wrapper.run_make("patch", module_version=MODULE_VERSION) assert rc == 0 @@ -65,6 +55,15 @@ def test_patch(wrapper): assert any((wrapper.path / "cellMods").glob("**/*.db")) +def test_local_module(wrapper): + rc, outs, _ = wrapper.run_make( + "init", + module_version=MODULE_VERSION, + ) + assert rc == 0 + assert "You are in the local source mode" in outs + + def test_missing_dbd_file(wrapper): wrapper.add_var_to_makefile("DBDS", "nonexistent.dbd") rc, _, errs = wrapper.run_make("build")