diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-07-09 00:28:48 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-07-09 00:28:48 -0400 |
commit | 4c8a721b45ed1a9bfd83ec87e26a8c60550a15e7 (patch) | |
tree | ffd8c455babcece4352a0e34c07e4d21670dc2de /examples | |
parent | b773f715d617e5c978f7b6fb39ecb7b50ab5568a (diff) | |
download | busybox-4c8a721b45ed1a9bfd83ec87e26a8c60550a15e7.tar.gz |
depmod.pl: recurse through module dependencies
The previous fix up loaded dependencies two deep, but really that was an
incomplete fix as we need to load dependencies all the way down. So change
the code to run recursively through all dependencies.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/depmod.pl | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/examples/depmod.pl b/examples/depmod.pl index 6b47bad09..8c6548d28 100755 --- a/examples/depmod.pl +++ b/examples/depmod.pl @@ -167,21 +167,32 @@ sub maybe_unshift } unshift (@{$array}, $ele); } +sub add_mod_deps +{ + my ($depth, $mod, $mod2, $module, $this_module) = @_; + + $depth .= " "; + warn "${depth}loading deps of module: $this_module\n" if $verbose; + + foreach my $md (keys %{$mod->{$this_module}}) { + add_mod_deps ($depth, $mod, $mod2, $module, $md); + warn "${depth} outputting $md\n" if $verbose; + maybe_unshift (\@{$$mod2->{$module}}, $md); + } + + if (!%{$mod->{$this_module}}) { + warn "${depth} no deps\n" if $verbose; + } +} foreach my $module (keys %$mod) { - warn "filling out module: $module\n" if $verbose; - @{$mod2->{$module}} = (); - foreach my $md (keys %{$mod->{$module}}) { - foreach my $md2 (keys %{$mod->{$md}}) { - warn "outputting $md2\n" if $verbose; - maybe_unshift (\@{$mod2->{$module}}, $md2); - } - warn "outputting $md\n" if $verbose; - maybe_unshift (\@{$mod2->{$module}}, $md); - } + warn "filling out module: $module\n" if $verbose; + @{$mod2->{$module}} = (); + add_mod_deps ("", $mod, \$mod2, $module, $module); } # figure out where the output should go if ($stdout == 0) { + warn "writing $basedir/modules.dep\n" if $verbose; open(STDOUT, ">$basedir/modules.dep") or die "cannot open $basedir/modules.dep: $!"; } |