make: Include tools/mod when checking dependency versions

Backport of ba4b2bffeb

Related issue: https://github.com/etcd-io/etcd/issues/18180

As tools/mod is not part of the test library's modules, the check to verify
consistent dependency versions ignored it. Explicitly get the dependencies from
this module when running verify-dep.

Signed-off-by: D Tripp <38776199+thedtripp@users.noreply.github.com>
This commit is contained in:
D Tripp 2024-07-04 22:31:03 +00:00
parent f2b966216c
commit 5727c64b96

View File

@ -637,7 +637,14 @@ function dump_deps_of_module() {
# Checks whether dependencies are consistent across modules # Checks whether dependencies are consistent across modules
function dep_pass { function dep_pass {
local all_dependencies local all_dependencies
local tools_mod_dependencies
all_dependencies=$(run_for_modules dump_deps_of_module | sort) || return 2 all_dependencies=$(run_for_modules dump_deps_of_module | sort) || return 2
# tools/mod is a special case. It is a module that is not included in the
# module list from test_lib.sh. However, we need to ensure that the
# dependency versions match the rest of the project. Therefore, explicitly
# execute the command for tools/mod, and append its dependencies to the list.
tools_mod_dependencies=$(run_for_module "tools/mod" dump_deps_of_module "./...") || return 2
all_dependencies="${all_dependencies}"$'\n'"${tools_mod_dependencies}"
local duplicates local duplicates
duplicates=$(echo "${all_dependencies}" | cut -d ',' -f 1,2 | sort | uniq | cut -d ',' -f 1 | sort | uniq -d) || return 2 duplicates=$(echo "${all_dependencies}" | cut -d ',' -f 1,2 | sort | uniq | cut -d ',' -f 1 | sort | uniq -d) || return 2