From aa6678805fe18eb6d22a63295f393368c4b3fb2b Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 16 Jun 2010 19:58:15 +0300 Subject: better handling of missing deps (TEST_FRAMEWORK) TEST_FRAMEWORK and other flags from the cflags-devmode.xml would only be available if you configured asterisk with --enable-dev-mode. Yet some modules depend on them. This breaks our sanity check that a missing dependency is probably the result of a typo or a bug. * Don't allow enabling a module if a dependency is missing. * Add some information about it to our DB. --- menuselect/menuselect | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/menuselect/menuselect b/menuselect/menuselect index 20daead..0530a8b 100755 --- a/menuselect/menuselect +++ b/menuselect/menuselect @@ -443,6 +443,21 @@ sub apply_default_enabled() { } } +# We found a dependency we don't know about. Warn the user, and add +# information about it: +sub handle_unknown_dep($$) { + my ($dep_mod, $mod) = @_; + + my $mod_info = { + Type => 'Unknown', + Avail => 0, + Checked => 0, + }; + $ModInfo{$dep_mod} = $mod_info; + + warning "Unknown dependency module $dep_mod (for e.g. $mod)\n"; +} + # recursively check dependency for a module. # # We run a scan for modules. Modules marked as 'Checked' are ones we @@ -481,9 +496,8 @@ sub check_module($) { foreach my $dep_mod (@{$ModInfo{$mod}{Depend}} ) { if (!exists ${ModInfo}{$dep_mod}) { - # TODO: die here? This should never happen. - warning "module $mod depends on $dep_mod that does not exist."; - next; + handle_unknown_dep($dep_mod, $mod); + return 0; } $deps_checked &= check_module($dep_mod); last if(!$deps_checked) # no point testing further if we failed. -- cgit v1.2.3