Skip to content
Snippets Groups Projects
Commit 7eebd77a authored by Simon Rose's avatar Simon Rose
Browse files

Merge branch 'ics_534_fix_template_substutition_order' into 'master'

ICS-534: Reverse .substitutions/.templates priority

See merge request e3/e3-require!128
parents ad206b22 b9b56a8c
No related branches found
No related tags found
1 merge request!128ICS-534: Reverse .substitutions/.templates priority
Pipeline #142884 passed
......@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Bugfixes
* Fixed an issue where .template and .substitutions files with the same name would build incorrectly
### Other changes
* Replaced `tclx` script to expand .dbd files with a python script
......
......@@ -269,16 +269,16 @@ db_internal: $(COMMON_DIR)
VPATH += $(dir $(TMPS))
VPATH += $(dir $(SUBS))
$(COMMON_DIR)/%.db: %.template
@printf "Inflating database ... %44s >>> %40s \n" "$^" "$@"
$(QUIET)$(MSI) -D $(USR_DBFLAGS) -o $(COMMON_DIR)/$(notdir $(basename $@).db) $^ > $(COMMON_DIR)/$(notdir $(basename $@).db).d
$(QUIET)$(MSI) $(USR_DBFLAGS) -o $(COMMON_DIR)/$(notdir $(basename $@).db) $^
$(COMMON_DIR)/%.db: %.substitutions
@printf "Inflating database ... %44s >>> %40s \n" "$^" "$@"
$(QUIET)$(MSI) -D $(USR_DBFLAGS) -o $(COMMON_DIR)/$(notdir $(basename $@).db) -S $^ > $(COMMON_DIR)/$(notdir $(basename $@).db).d
$(QUIET)$(MSI) $(USR_DBFLAGS) -o $(COMMON_DIR)/$(notdir $(basename $@).db) -S $^
$(COMMON_DIR)/%.db: %.template
@printf "Inflating database ... %44s >>> %40s \n" "$^" "$@"
$(QUIET)$(MSI) -D $(USR_DBFLAGS) -o $(COMMON_DIR)/$(notdir $(basename $@).db) $^ > $(COMMON_DIR)/$(notdir $(basename $@).db).d
$(QUIET)$(MSI) $(USR_DBFLAGS) -o $(COMMON_DIR)/$(notdir $(basename $@).db) $^
install build debug::
@echo "MAKING EPICS VERSION ${EPICSVERSION}"
......
......@@ -539,6 +539,37 @@ def test_expand_db_files(wrapper: Wrapper):
)
def test_substitution_template_priority(wrapper: Wrapper):
"""Test that the automated template/substitution file expansion works."""
wrapper.add_var_to_module_makefile("TMPS", "a.template")
wrapper.add_var_to_module_makefile("SUBS", "a.substitutions")
template_file = wrapper.module_dir / "a.template"
template_file_contents = "record (ai, $(FOO)) {}"
template_file.write_text(template_file_contents)
substitution_file = wrapper.module_dir / "a.substitutions"
substitution_file.write_text(
"""file "a.template"
{
pattern { FOO }
{ "$(BAR)" }
}
"""
)
base_version = wrapper.get_env_var("EPICS_VERSION_NUMBER")
common_dir = wrapper.module_dir / f"O.{base_version}_Common"
rc, *_ = wrapper.run_make("db_internal")
assert rc == 0
expanded_template_file = common_dir / "a.db"
assert "BAR" in expanded_template_file.read_text()
assert "FOO" not in expanded_template_file.read_text()
@pytest.mark.parametrize(
"installed_archs, param, expected",
[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment