# HG changeset patch # User William Roberts # Date 1286832788 -3600 # Node ID 76c5e260003ee8ae75f4e8c76bef7390513409f0 # Parent 4a02a61ca23ab5535239d4067c06b14a6d05d85a Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl Select the stem_ version of the file if stem_ is specified in the rom_content.csv diff -r 4a02a61ca23a -r 76c5e260003e tools/filter_obyfile.pl --- a/tools/filter_obyfile.pl Mon Oct 11 15:56:10 2010 +0100 +++ b/tools/filter_obyfile.pl Mon Oct 11 22:33:08 2010 +0100 @@ -44,6 +44,7 @@ if ($cmd eq "stem") { $stem_substitutions{$romfile} = $hostfile; + $must_have{$romfile} = 1; next; } @@ -68,6 +69,7 @@ # read static dependencies file my %exe_to_romfile; +my %exe_dependencies; my %lc_romfiles; my $line; @@ -75,9 +77,19 @@ while ($line = ) { chomp $line; - last if ($line eq ""); # blank line between the two sections my ($romfile, $hostfile, $stuff) = split /\t/, $line; + next if ($romfile eq "x"); # pre-inverted dependency information + + if (defined $stem_substitutions{$romfile}) + { + if ($hostfile !~ /\/stem_/) + { + print STDERR "Ignoring dependencies of $hostfile because of stem substitution of $romfile\n"; + next; + } + } + $lc_romfiles{lc $romfile} = $romfile; if ($romfile =~ /^sys.bin.(.*)$/i) @@ -85,17 +97,29 @@ my $exe = lc $1; $exe_to_romfile{$exe} = $romfile; } - } -my %exe_dependencies; -while ($line = ) - { - chomp $line; - my ($x, $exename, @dependencies) = split /\t/,$line; - $exe_dependencies{$exename} = \@dependencies; + + foreach my $dependent (split /:/,$stuff) + { + next if ($dependent =~ /^sid=/); + $dependent = lc $dependent; + + $dependent =~ s/^sys\\bin\\//; # no directory => sys\bin anyway + $dependent =~ s/\[\S+\]//; # ignore the UIDs for now + + if (!defined $exe_dependencies{$dependent}) + { + my @dependents = ($romfile); + $exe_dependencies{$dependent} = \@dependents; + } + else + { + push @{$exe_dependencies{$dependent}}, $romfile; + } + } } close STATIC_DEPENDENCIES; -# Create static dependencies for aliases +# Add static dependencies for aliases my @obylines = <>; # read the oby file @@ -107,7 +131,7 @@ my $newname = $2; $romfile =~ s/^\\sys/sys/; # remove leading \, to match $romfile convention - next if (!defined $lc_romfiles{lc $romfile}); # aliases to non-executables + next if (!defined $lc_romfiles{lc $romfile}); # ignore aliases to non-executables $romfile = $lc_romfiles{lc $romfile}; $newname =~ s/^\\sys/sys/; # remove leading \, to match $romfile convention diff -r 4a02a61ca23a -r 76c5e260003e tools/static_dependencies.pl --- a/tools/static_dependencies.pl Mon Oct 11 15:56:10 2010 +0100 +++ b/tools/static_dependencies.pl Mon Oct 11 22:33:08 2010 +0100 @@ -14,6 +14,12 @@ # This script generates a list of static dependencies for files in a ROM use strict; +use Getopt::Long; + +my $inverted_table = 0; +GetOptions( + "i|invert" => \$inverted_table, # add the inverted table + ); my %romfiles; my @contents; @@ -36,6 +42,8 @@ my ($romfile,$hostfile,@dependencies) = @_; print "$romfile\t$hostfile\t", join(":",@dependencies), "\n"; + next unless $inverted_table; + # Create inverted table foreach my $dependent (@dependencies) { @@ -133,8 +141,11 @@ # Assume that the rest don't depend on anything, and leave them out. } -print "\n"; -foreach my $inverted (sort keys %dependents) +if ($inverted_table) { - print "x\t$inverted\t$dependents{$inverted}\n"; + print "\n"; + foreach my $inverted (sort keys %dependents) + { + print "x\t$inverted\t$dependents{$inverted}\n"; + } }