aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-07-09 00:28:48 -0400
committerMike Frysinger <vapier@gentoo.org>2009-07-09 00:30:40 -0400
commitbbc31e5f3cb2482f752ab6251b1d7491b5ea73eb (patch)
tree0aa14ad08bd551edf8c7fb7d97bb9574c7642db4
parentfbb12ddc6a53ad97ff6bcc7ed9b253c09001ad2f (diff)
downloadbusybox-w32-bbc31e5f3cb2482f752ab6251b1d7491b5ea73eb.tar.gz
busybox-w32-bbc31e5f3cb2482f752ab6251b1d7491b5ea73eb.tar.bz2
busybox-w32-bbc31e5f3cb2482f752ab6251b1d7491b5ea73eb.zip
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>
-rwxr-xr-xexamples/depmod.pl31
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
167 } 167 }
168 unshift (@{$array}, $ele); 168 unshift (@{$array}, $ele);
169} 169}
170sub add_mod_deps
171{
172 my ($depth, $mod, $mod2, $module, $this_module) = @_;
173
174 $depth .= " ";
175 warn "${depth}loading deps of module: $this_module\n" if $verbose;
176
177 foreach my $md (keys %{$mod->{$this_module}}) {
178 add_mod_deps ($depth, $mod, $mod2, $module, $md);
179 warn "${depth} outputting $md\n" if $verbose;
180 maybe_unshift (\@{$$mod2->{$module}}, $md);
181 }
182
183 if (!%{$mod->{$this_module}}) {
184 warn "${depth} no deps\n" if $verbose;
185 }
186}
170foreach my $module (keys %$mod) { 187foreach my $module (keys %$mod) {
171 warn "filling out module: $module\n" if $verbose; 188 warn "filling out module: $module\n" if $verbose;
172 @{$mod2->{$module}} = (); 189 @{$mod2->{$module}} = ();
173 foreach my $md (keys %{$mod->{$module}}) { 190 add_mod_deps ("", $mod, \$mod2, $module, $module);
174 foreach my $md2 (keys %{$mod->{$md}}) {
175 warn "outputting $md2\n" if $verbose;
176 maybe_unshift (\@{$mod2->{$module}}, $md2);
177 }
178 warn "outputting $md\n" if $verbose;
179 maybe_unshift (\@{$mod2->{$module}}, $md);
180 }
181} 191}
182 192
183# figure out where the output should go 193# figure out where the output should go
184if ($stdout == 0) { 194if ($stdout == 0) {
195 warn "writing $basedir/modules.dep\n" if $verbose;
185 open(STDOUT, ">$basedir/modules.dep") 196 open(STDOUT, ">$basedir/modules.dep")
186 or die "cannot open $basedir/modules.dep: $!"; 197 or die "cannot open $basedir/modules.dep: $!";
187} 198}