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

improved error checking in dunecontrol

[[Imported from SVN: r4527]]
parent 9edd6876
No related branches found
No related tags found
No related merge requests found
...@@ -33,10 +33,16 @@ parse_control() { ...@@ -33,10 +33,16 @@ parse_control() {
local sugs=$(echo $(grep Suggests: "$1" | cut -d ':' -f2)) local sugs=$(echo $(grep Suggests: "$1" | cut -d ':' -f2))
local path=$(dirname "$1") local path=$(dirname "$1")
if test "x$module" != "x"; then if test "x$module" != "x"; then
export HAVE_${module}=yes if checkonly_modname "$module"; then
export PATH_${module}="$path" export HAVE_${module}=yes
export DEPS_${module}="$deps" export PATH_${module}="$path"
export SUGS_${module}="$sugs" export DEPS_${module}="$deps"
export SUGS_${module}="$sugs"
else
echo "ERROR: $CONTROL files $1 contain an invalid Module entry"
fi
else
echo "ERROR: $CONTROL files $1 does not contain a Module entry"
fi fi
else else
echo "ERROR: could not read file $1" echo "ERROR: could not read file $1"
...@@ -85,6 +91,9 @@ eval_control() { ...@@ -85,6 +91,9 @@ eval_control() {
# execute $command # execute $command
$command $command
) || false ) || false
else
echo "ERROR: could not find $file"
exit 1
fi fi
} }
...@@ -92,15 +101,24 @@ _build_module() { ...@@ -92,15 +101,24 @@ _build_module() {
local command=$1 local command=$1
local module=$2 local module=$2
shift 2 shift 2
check_modname $module
if test "x$(eval echo \$BUILD_DONE_${command}_${module})" != "xyes"; then if test "x$(eval echo \$BUILD_DONE_${command}_${module})" != "xyes"; then
echo "--- building $module ---" echo "--- building $module ---"
# resolve dependencies # resolve dependencies
for dep in $(eval "echo \$DEPS_$module"); do for dep in $(eval "echo \$DEPS_$module"); do
check_modname $dep
echo "--- $module depends on $dep ... calling ---" echo "--- $module depends on $dep ... calling ---"
_build_module $command $dep if test "x$(eval echo \$HAVE_$dep)" != "x"; then
echo "calling ---"
_build_module $command $dep
else
echo "ERROR: could not find module $dep"
exit 1
fi
done done
# resolve suggestions # resolve suggestions
for dep in $(eval "echo \$SUGS_$module"); do for dep in $(eval "echo \$SUGS_$module"); do
check_modname $dep
echo -n "--- $module suggests $dep ... " echo -n "--- $module suggests $dep ... "
if test "x$(eval echo \$HAVE_$dep)" != "x"; then if test "x$(eval echo \$HAVE_$dep)" != "x"; then
echo "calling ---" echo "calling ---"
...@@ -136,15 +154,31 @@ build_modules() { ...@@ -136,15 +154,31 @@ build_modules() {
build_single_module() { build_single_module() {
module=$1 module=$1
command=$2 command=$2
for m in $MODULES; do local runcommand=run_$command
if test "x$m" = "x$module"; then load_opts $command
load_opts $command check_modname $module
_build_module run_$command $MODULE if test "x$(eval echo \$HAVE_$module)" != "x"; then
return _build_module $runcommand $module
fi else
done echo "ERROR: could not find module $dep"
usage echo available modules are:
echo "ERROR: could not find module $module" echo $MODULES
exit 1
fi
}
check_modname() {
if ! echo "$1" | grep -q '^[a-zA-Z0-9_]\+$'; then
echo "ERROR: invalid module name $1"
exit 1
fi
}
checkonly_modname() {
if ! echo "$1" | grep -q '^[a-zA-Z0-9_]\+$'; then
return 1
fi
return 0
} }
load_opts() { load_opts() {
......
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