Skip to content
Snippets Groups Projects
Commit f23be9fd authored by Christian Engwer's avatar Christian Engwer
Browse files

[dunecontrol]

just search any module (dependencies and suggestions)
and do the splitting of DEPS and SUGS list afterwards
=> make sure a module is not listed twice

[[Imported from SVN: r6855]]
parent f2a9d5e4
No related branches found
No related tags found
No related merge requests found
......@@ -233,13 +233,11 @@ sort_modules() {
# reset lists
export SORTEDMODULES=""
export REVERSEMODULES=""
export SORTEDMODULES_INFO=""
export SORTEDMODULES_DEPS=""
export SORTEDMODULES_SUGS=""
export SORTEDMODULES_SUB=""
# handle each modules passed as parameter
for m in "$@"; do
# did we find a module file for this module?
if test "x$(eval echo \$HAVE_$m)" != "x"; then
if eval test x\$HAVE_$m != x; then
_sort_module $m MAIN
else
echo "ERROR: could not find module $(eval echo \$NAME_$m)" >&2
......@@ -248,11 +246,26 @@ sort_modules() {
done
# save result
export MODULES="$SORTEDMODULES"
# setup list of SUGS/DEPS and the INFO list
export SORTEDMODULES_INFO=""
export SORTEDMODULES_DEPS=""
export SORTEDMODULES_MAIN=""
export SORTEDMODULES_SUGS=""
local mode
for m in $MODULES; do
eval mode=\$MODE_$m
SORTEDMODULES_INFO="$SORTEDMODULES_INFO $m[$mode]"
eval SORTEDMODULES_$mode=\"\$SORTEDMODULES_$mode $m\"
done
export SORTEDMODULES_INFO
export SORTEDMODULES_DEPS
export SORTEDMODULES_SUGS
export SORTEDMODULES_MAIN
# clean up temporary variables
for m in $MODULES; do
export SORT_DONE_$m=""
export SORT_DEPS_DONE_$m=""
export SORT_SUGS_DONE_$m=""
export SORT_MAIN_DONE_$m=""
done
}
......@@ -366,21 +379,22 @@ _sort_module() {
echo "ERROR: invalid module name $module" >&2
exit 1
fi
if test "x$(eval echo \$SORT_${mode}_DONE_$module)" != "xyes"; then
mainmode=$(test $mode = MAIN && echo DEPS || echo $mode)
if eval test "x\$SORT_${mainmode}_DONE_$module" != "xyes"; then
# stop any recursion
export SORT_${mainmode}_DONE_$module=yes
# resolve dependencies
depmode=$(test $mode = SUGS && echo SUGS || echo DEPS)
_check_deps $module DEPS $depmode # it might happen that the DEPS are actually SUGS
# resolve suggestions
_check_deps $module SUGS SUGS
# insert this module into the list
export SORTEDMODULES_$mode="$(eval echo \$SORTEDMODULES_$mode) $module"
export SORT_${mode}_DONE_$module=yes
if test $mode = DEPS -o $mode = MAIN; then
# it is sufficient to check that the module hasn't been handled yet,
# as dependencies are handled before suggestions
# remember mode of the module
export MODE_$module=$mode
# topological list of the module and its dependencies/suggestions
if eval test "x\$SORT_DONE_$module" != "xyes"; then
export SORT_DONE_$module=yes
export SORTEDMODULES="$SORTEDMODULES $module"
export REVERSEMODULES="$module $REVERSEMODULES"
export SORTEDMODULES_INFO="$SORTEDMODULES_INFO $module[$mode]"
fi
fi
}
......
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