Skip to content
Snippets Groups Projects
Commit ca02cbe0 authored by Lucas Magalhães's avatar Lucas Magalhães
Browse files

Merge branch 'E3-884' into 'master'

E3-884: Make non numeric version reinstall prohibited

See merge request e3/e3-require!100
parents 9de76918 25122873
No related branches found
No related tags found
1 merge request!100E3-884: Make non numeric version reinstall prohibited
Pipeline #120249 passed with warnings
......@@ -399,18 +399,9 @@ install build:
else
ifeq ($(shell echo "${LIBVERSION}" | grep -v -E "^$(VERSIONREGEX)\$$"),)
install:: build
$(if $(wildcard ${MODULE_LOCATION}/lib/${T_A}),$(error ${MODULE_LOCATION}/lib/${T_A} already exists. If you really want to overwrite then uninstall first.))
else
install:: build
$(if $(wildcard ${MODULE_LOCATION}/lib/${T_A}),\
$(warning Re-installing ${MODULE_LOCATION}/lib/${T_A})\
$(RMDIR) ${MODULE_LOCATION}/lib/${T_A}\
)
endif
install build debug:: O.${EPICSVERSION}_${T_A}
@${MAKE} -C O.${EPICSVERSION}_${T_A} -f ../${USERMAKEFILE} $@
......
......@@ -587,50 +587,17 @@ def test_build_fails_if_nth_architecture_fails(wrapper: Wrapper, archs, failing_
)
def test_double_install_fails(wrapper: Wrapper):
@pytest.mark.parametrize("module_version", ["0.0.0+0", "test"])
def test_double_install_fails(wrapper: Wrapper, module_version):
RE_ERR_MOD_VER_EXISTS = ".*{module}/{version}.* already exists"
rc, *_ = wrapper.run_make("install")
rc, *_ = wrapper.run_make("install", module_version = module_version)
assert rc == 0
rc, _, errs = wrapper.run_make("install")
rc, _, errs = wrapper.run_make("install", module_version = module_version)
assert rc == 2
assert re.search(
RE_ERR_MOD_VER_EXISTS.format(
module=re.escape(wrapper.name), version=re.escape(wrapper.version)
),
module=re.escape(wrapper.name), version=re.escape(module_version)),
errs,
)
def test_double_install_test_version_succeeds(wrapper: Wrapper):
RE_WARN_MOD_VER_EXISTS = "Re-installing .*{module}/{version}.*"
test_version = "test"
wrapper.write_dot_local_data("CONFIG_MODULE", {"E3_MODULE_VERSION": test_version})
cell_path = wrapper.get_env_var("E3_MODULES_INSTALL_LOCATION")
wrapper.add_file("header.h")
rc, _, errs = wrapper.run_make("install")
assert rc == 0
assert not re.search(
RE_WARN_MOD_VER_EXISTS.format(
module=re.escape(wrapper.name), version=test_version
),
errs,
)
assert not (Path(cell_path) / "include" / "header.h").is_file()
wrapper.add_var_to_module_makefile("HEADERS", "header.h")
rc, _, errs = wrapper.run_make("install")
assert rc == 0
assert re.search(
RE_WARN_MOD_VER_EXISTS.format(
module=re.escape(wrapper.name), version=test_version
),
errs,
)
assert (Path(cell_path) / "include" / "header.h").is_file()
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