tools/filter_obyfile.pl
author William Roberts <williamr@symbian.org>
Thu, 18 Nov 2010 13:16:30 +0000
changeset 135 b9832c8d3f36
parent 100 6dfa3bdbdfba
permissions -rw-r--r--
Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2010 Symbian Foundation Ltd.
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
# All rights reserved.
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# This component and the accompanying materials are made available
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# which accompanies this distribution, and is available
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
#
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
# Initial Contributors:
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Symbian Foundation - initial contribution.
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
#
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# Contributors:
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
#
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
# Description: 
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# This script filters an OBY file given a rom_content.csv and a static_dependencies.txt
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
use strict;
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    17
use Getopt::Long;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    18
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    19
my $deleted_lines_oby = "filtered.oby";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    20
my $deletion_details_file = "filter.log";
100
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    21
my @option_prefixes;
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    22
GetOptions(
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    23
  "d|deleted=s" => \$deleted_lines_oby,   # file to hold the deleted lines
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    24
  "l|log=s" => \$deletion_details_file,   # log of whats deleted and why
100
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    25
  "options=s" => \@option_prefixes,       # prefixes for provisional What commands
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
    26
  );
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
if (scalar @ARGV < 2)
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
	{
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
	die ("Must specify at least two arguments: rom_content.csv and static_dependencies.txt");
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
	}
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
my $rom_content_csv = shift @ARGV;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
my $static_dependencies_txt = shift @ARGV;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
open ROM_CONTENT, "<$rom_content_csv" or die("Cannot read $rom_content_csv: $!\n");
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
my @rom_content = <ROM_CONTENT>;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
close ROM_CONTENT;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
my $rom_content_header = shift @rom_content;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
die("Not a valid rom_content.csv file") if ($rom_content_header !~ /^ROM file,/);
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
# read through the rom_content_csv looking for direct instructions
100
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    44
my %prefixes;
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    45
foreach my $prefix (split /,/, join(",", @option_prefixes))   # handle comma-separated lists
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    46
	{
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    47
	$prefixes{lc "$prefix"} = 1;
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    48
	}
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
my %stem_substitutions;
78
7271390ae2c2 Remember more information from rom_content.csv, to add IBY and package information to filter.log
William Roberts <williamr@symbian.org>
parents: 77
diff changeset
    50
my %rom_origins;
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
my %deletions;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
my %must_have;
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    53
my %check_import_details;
100
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    54
my $optional_commands_ignored = 0;
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
foreach my $line (@rom_content)
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
	{
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
	my ($romfile,$hostfile,$ibyfile,$package,$cmd,@rest) = split /,/, $line;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
	
78
7271390ae2c2 Remember more information from rom_content.csv, to add IBY and package information to filter.log
William Roberts <williamr@symbian.org>
parents: 77
diff changeset
    59
	$rom_origins{$romfile} = "$ibyfile,$package";
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
	next if ($cmd eq "");
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
	$cmd = lc $cmd;
100
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    63
	if ($cmd =~ /^(\S+)_([^_]+)$/)
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    64
		{
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    65
		my $prefix = $1;
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    66
		$cmd = $2;    # without the prefix
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    67
		if (!defined $prefixes{$prefix})
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    68
			{
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    69
			$optional_commands_ignored++;
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    70
			next;
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    71
			}
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    72
		# otherwise fall through and process the selected cmd
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    73
		print STDERR "Option $prefix matched to give $cmd for >$romfile<\n";
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
    74
		}
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    75
	if ($cmd eq "slim")
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    76
		{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    77
		$check_import_details{$romfile} = "";
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    78
		$stem_substitutions{$romfile} = $hostfile;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    79
		$must_have{$romfile} = 1;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    80
		next;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    81
		}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
    82
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    83
	if ($cmd eq "stem")
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    84
		{
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    85
		$stem_substitutions{$romfile} = $hostfile;
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
    86
		$must_have{$romfile} = 1;
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    87
		next;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    88
		}
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    89
	
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    90
	if ($cmd eq "out")
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    91
		{
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    92
		# print STDERR "Deletion request for >$romfile<\n";
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    93
		$deletions{$romfile} = "out";
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    94
		next;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    95
		}
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    96
	
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    97
	if ($cmd eq "in")
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    98
		{
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
    99
		$must_have{$romfile} = 1;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   100
		next;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   101
		}
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   102
	}
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   103
100
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
   104
printf STDERR "%d in (including %d slim and %d stem), %d out, (%d not selected)\n", 
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   105
	scalar keys %must_have,
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   106
	scalar keys %check_import_details,
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   107
	(scalar keys %stem_substitutions) - (scalar keys %check_import_details), 
100
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
   108
	scalar keys %deletions,
6dfa3bdbdfba Add --options argument to pass in the (comma separated lists of) prefixes for optional "What" commands
William Roberts <williamr@symbian.org>
parents: 99
diff changeset
   109
	$optional_commands_ignored; 
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   110
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   111
# read static dependencies file
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   112
my %exe_to_romfile;     # exe -> original romfile
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   113
my %exe_dependencies;   # exe -> list of romfile
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   114
my %exe_prerequisites;  # exe -> list of exe
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   115
my %exe_ordinals;       # exe -> list of valid ordinals
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   116
my %lc_romfiles;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   117
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   118
my $line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   119
open STATIC_DEPENDENCIES, "<$static_dependencies_txt" or die ("Cannot read $static_dependencies_txt: $!\n");
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   120
while ($line = <STATIC_DEPENDENCIES>)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   121
	{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   122
	chomp $line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   123
	my ($romfile, $hostfile, $stuff) = split /\t/, $line;
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   124
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   125
	next if ($romfile eq "x");	# pre-inverted dependency information
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   126
	
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   127
	if (defined $stem_substitutions{$romfile})
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   128
		{
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   129
		if ($hostfile !~ /\/stem_/)
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   130
			{
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   131
			# print STDERR "Ignoring dependencies of $hostfile because of stem substitution of $romfile\n";
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   132
			next;
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   133
			}
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   134
		}
135
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   135
	else
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   136
		{
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   137
		if ($hostfile =~ /\/stem_/)
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   138
			{
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   139
			# print STDERR "Ignoring dependencies of $hostfile because there is no stem substitution of $romfile\n";
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   140
			next;
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   141
			}
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   142
		}
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   143
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   144
	$lc_romfiles{lc $romfile} = $romfile;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   145
	
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   146
	my $romexe = "";
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   147
	if ($romfile =~ /^sys.bin.(.*)$/i)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   148
		{
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   149
		$romexe = lc $1;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   150
		$exe_to_romfile{$romexe} = $romfile;
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   151
		}
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   152
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   153
	my @prerequisite_exes = ();
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   154
	foreach my $prerequisite (split /:/,$stuff)
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   155
		{
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   156
		next if ($prerequisite =~ /^sid=/);	# not a real file
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   157
		if ($prerequisite =~ /^exports=(.*)$/)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   158
			{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   159
			my $ordinals = $1;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   160
			if (defined $check_import_details{$romfile})
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   161
				{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   162
				$exe_ordinals{$romexe} = $ordinals;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   163
				}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   164
			next;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   165
			}
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   166
		$prerequisite =~ s/^sys.bin.//;	# remove leading sys/bin, if present
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   167
		if ($prerequisite !~ /\\/)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   168
			{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   169
			my $exe = lc $prerequisite;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   170
			$exe =~ s/\[\S+\]//;	# ignore the UIDs for now
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   171
		
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   172
			push @prerequisite_exes, $exe;
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   173
			$exe =~ s/@.*$//; 	# remove the ordinals, though they remain in the prerequisite exes
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   174
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   175
			if (!defined $exe_dependencies{$exe})
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   176
				{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   177
				my @dependents = ($romfile);
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   178
				$exe_dependencies{$exe} = \@dependents;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   179
				}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   180
			else
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   181
				{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   182
				push @{$exe_dependencies{$exe}}, $romfile;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   183
				}
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   184
			}
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   185
		}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   186
	if ($romexe ne "")
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   187
		{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   188
		$exe_prerequisites{$romexe} = \@prerequisite_exes;
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   189
		}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   190
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   191
close STATIC_DEPENDENCIES;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   192
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   193
# Add static dependencies for aliases
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   194
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   195
my @obylines = <>;	# read the oby file
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   196
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   197
foreach my $line (@obylines)
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   198
	{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   199
	if ($line =~ /^\s*alias\s+(\S+)\s+(\S+)\s*$/)
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   200
		{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   201
		my $romfile = $1;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   202
		my $newname = $2;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   203
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   204
		$romfile =~ s/^\\sys/sys/;	# remove leading \, to match $romfile convention
22
76c5e260003e Calculate the inverted dependency table in filter_obyfile.pl, and make it optional (-i) in static_dependencies.pl
William Roberts <williamr@symbian.org>
parents: 19
diff changeset
   205
		next if (!defined $lc_romfiles{lc $romfile});		# ignore aliases to non-executables
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   206
		$romfile = $lc_romfiles{lc $romfile};
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   207
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   208
		$newname =~ s/^\\sys/sys/;	# remove leading \, to match $romfile convention
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   209
		$lc_romfiles{lc $newname} = $newname;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   210
		
78
7271390ae2c2 Remember more information from rom_content.csv, to add IBY and package information to filter.log
William Roberts <williamr@symbian.org>
parents: 77
diff changeset
   211
		$rom_origins{$newname} = "alias to $romfile";
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   212
		if ($romfile =~ /^sys.bin.(\S+)$/i)
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   213
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   214
			my $realexe = lc $1;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   215
			push @{$exe_dependencies{$realexe}}, $newname;		# the alias is a dependent of the real file
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   216
			
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   217
			if ($newname =~ /^sys.bin.(\S+)$/i)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   218
				{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   219
				my $newexe = lc $1;
78
7271390ae2c2 Remember more information from rom_content.csv, to add IBY and package information to filter.log
William Roberts <williamr@symbian.org>
parents: 77
diff changeset
   220
				$exe_to_romfile{$newexe} = $newname;
7271390ae2c2 Remember more information from rom_content.csv, to add IBY and package information to filter.log
William Roberts <williamr@symbian.org>
parents: 77
diff changeset
   221
				$rom_origins{$newname} = "alias " . $rom_origins{$romfile};
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   222
				my @prerequisite_exes = ($realexe);
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   223
				$exe_prerequisites{$newexe} = \@prerequisite_exes;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   224
				}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   225
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   226
			# print STDERR "added $newname as a dependent of $realexe\n"
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   227
			}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   228
		}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   229
	}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   230
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   231
if (0)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   232
	{
135
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   233
	foreach my $exe ("libopenvg.dll", "libopenvg_sw.dll", "backend.dll", "qtgui.dll", "mediaclientaudio.dll")
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   234
		{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   235
		printf STDERR "Dependents of %s = %s\n", $exe, join(", ", @{$exe_dependencies{$exe}});
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   236
		}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   237
	}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   238
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   239
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   240
my @details;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   241
sub print_detail($)
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   242
	{
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   243
	my ($message) = @_;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   244
	push @details, $message;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   245
	print STDERR $message, "\n";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   246
	}
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   247
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   248
# check the dependents of "slim" DLLs to see if they get eliminated by missing ordinals
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   249
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   250
sub expand_list($$)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   251
	{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   252
	my ($hashref, $list) = @_;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   253
	foreach my $range (split /\./, $list)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   254
		{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   255
		if ($range =~ /^(\d+)-(\d+)$/)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   256
			{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   257
			foreach my $ordinal ($1 .. $2)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   258
				{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   259
				$$hashref{$ordinal} = 1;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   260
				}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   261
			}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   262
		else
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   263
			{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   264
			$$hashref{$range} = 1;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   265
			}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   266
		}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   267
	}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   268
sub check_list($$)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   269
	{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   270
	my ($hashref, $list) = @_;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   271
	foreach my $range (split /\./, $list)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   272
		{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   273
		if ($range =~ /^(\d+)-(\d+)$/)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   274
			{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   275
			foreach my $ordinal ($1 .. $2)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   276
				{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   277
				if (!defined $$hashref{$ordinal})
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   278
					{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   279
					return "Missing ordinal $ordinal";
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   280
					}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   281
				}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   282
			}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   283
		else
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   284
			{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   285
			return "Missing ordinal $range" if (!defined $$hashref{$range});
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   286
			}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   287
		}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   288
	return "OK";
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   289
	}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   290
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   291
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   292
foreach my $romexe (keys %exe_ordinals)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   293
	{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   294
	my $exported_ordinals = $exe_ordinals{$romexe};
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   295
	my %exports;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   296
	expand_list(\%exports, $exported_ordinals);
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   297
	my $namelength = length($romexe);
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   298
	foreach my $dependent (@{$exe_dependencies{$romexe}})
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   299
		{
135
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   300
		if (defined $deletions{$dependent})
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   301
			{
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   302
			# print STDERR "Already deleted $dependent of $romexe\n";
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   303
			next;   # already deleted
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   304
			}
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   305
		
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   306
		if ($dependent =~ /^sys.bin.(.*)$/i)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   307
			{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   308
			my $depexe = lc $1;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   309
			my $imports;
135
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   310
			# print STDERR "Checking $depexe for detailed dependency on $romexe\n";
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   311
			foreach my $prerequisite (@{$exe_prerequisites{$depexe}})
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   312
				{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   313
				if (substr($prerequisite, 0, $namelength) eq $romexe)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   314
					{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   315
					$imports = substr($prerequisite, $namelength+1);	# skip name and "@"
135
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   316
					# print STDERR "Found imports >$imports<\n";
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   317
					last;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   318
					}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   319
				}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   320
			if (!defined $imports)
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   321
				{
135
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   322
				printf STDERR "Internal error: Failed to find ordinals imported from %s by %s (in %s)\n", 
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   323
					$romexe, $dependent, join(":",@{$exe_prerequisites{$depexe}});
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   324
				next;
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   325
				}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   326
			my $compatible = check_list(\%exports,$imports);
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   327
			if ($compatible ne "OK")
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   328
				{
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   329
				$deletions{$dependent} = "$romexe $compatible";
135
b9832c8d3f36 Update filter_obyfile.pl to ignore stem_* executables if the substitution is not requested
William Roberts <williamr@symbian.org>
parents: 100
diff changeset
   330
				print_detail("Deleting $dependent because of slimmed $romexe ($compatible)");
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   331
				}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   332
			}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   333
		}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   334
	}
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   335
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   336
# process the "out" commands to recursively expand the deletions
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   337
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   338
my @problems;	# list of romtrails which will be a problem
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   339
sub delete_dependents($$$)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   340
	{
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   341
	my ($romtrail,$original_reason,$listref) = @_;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   342
	my ($romfile,$trail) = split /\t/, $romtrail;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   343
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   344
	if (defined $deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   345
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   346
		# already marked for deletion
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   347
		return;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   348
		}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   349
	
19
b1cc137d8adb Update filter_obyfile.pl to support the "In" command, which detects conflicts with the scope of removals
William Roberts <williamr@symbian.org>
parents: 18
diff changeset
   350
	if (defined $must_have{$romfile})
b1cc137d8adb Update filter_obyfile.pl to support the "In" command, which detects conflicts with the scope of removals
William Roberts <williamr@symbian.org>
parents: 18
diff changeset
   351
		{
b1cc137d8adb Update filter_obyfile.pl to support the "In" command, which detects conflicts with the scope of removals
William Roberts <williamr@symbian.org>
parents: 18
diff changeset
   352
		# Problem! We won't be able to build this ROM
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   353
		print_detail("WARNING: $romfile is being kept, but will fail to link because of deletion trail $trail");
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   354
		push @problems, $romtrail;
19
b1cc137d8adb Update filter_obyfile.pl to support the "In" command, which detects conflicts with the scope of removals
William Roberts <williamr@symbian.org>
parents: 18
diff changeset
   355
		# keep that file and see what happens anyway
b1cc137d8adb Update filter_obyfile.pl to support the "In" command, which detects conflicts with the scope of removals
William Roberts <williamr@symbian.org>
parents: 18
diff changeset
   356
		return;
b1cc137d8adb Update filter_obyfile.pl to support the "In" command, which detects conflicts with the scope of removals
William Roberts <williamr@symbian.org>
parents: 18
diff changeset
   357
		}
b1cc137d8adb Update filter_obyfile.pl to support the "In" command, which detects conflicts with the scope of removals
William Roberts <williamr@symbian.org>
parents: 18
diff changeset
   358
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   359
	push @details, sprintf "deleting %s (%s)", scalar $romfile, $trail;
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   360
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   361
	$deletions{$romfile} = $original_reason;	# this ensures that it gets deleted
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   362
	if ($romfile =~ /^sys.bin.(.*)$/i)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   363
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   364
		my $exe = lc $1;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   365
		if (!defined $exe_dependencies{$exe})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   366
			{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   367
			# print STDERR "No dependencies for $exe ($romfile)\n";
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   368
			return;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   369
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   370
		foreach my $dependent (@{$exe_dependencies{$exe}})
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   371
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   372
			if (!defined $deletions{$dependent})
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   373
				{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   374
		  	push @{$listref}, "$dependent\t$romfile $trail";
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   375
		  	}
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   376
		  elsif ($deletions{$romfile} eq "out")
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   377
				{
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   378
				print_detail("NOTE: direct deletion of $romfile is not needed - it would be removed by $original_reason");
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   379
				}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   380
			}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   381
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   382
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   383
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   384
my @delete_cmds = sort keys %deletions;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   385
foreach my $romfile (@delete_cmds)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   386
	{
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   387
	push @details, "", "===Deleting $romfile", "";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   388
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   389
	my $reason = $deletions{$romfile};
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   390
	delete $deletions{$romfile}; 	# so that delete_dependents will iterate properly
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   391
	my @delete_list = ("$romfile\t$reason");
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   392
	while (scalar @delete_list > 0)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   393
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   394
		my $next_victim = shift @delete_list;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   395
		delete_dependents($next_victim, $romfile, \@delete_list);
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   396
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   397
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   398
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   399
# read the oby file and apply the commands
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   400
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   401
my $stem_count = 0;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   402
my $deletion_count = 0;
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   403
my @deleted_lines;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   404
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   405
foreach my $line (@obylines)
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   406
	{
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   407
	chomp $line;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   408
	if ($line =~ /^(.*=)(\S+\s+)(\S+)(\s.*)?$/)
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   409
		{
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   410
		my $romcmd = $1;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   411
		my $hostfile = $2;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   412
		my $romfile = $3;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   413
		my $rest = $4;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   414
		$rest = "" if (!defined $rest);
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   415
		
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   416
		if ($romfile =~ /^"(.*)"$/)
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   417
			{
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   418
			$romfile = $1;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   419
			$hostfile .= '"';
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   420
			$rest = '"'. $rest;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   421
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   422
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   423
		$lc_romfiles{lc $romfile} = $romfile;
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   424
		
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   425
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   426
			{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   427
			$deletion_count++;
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   428
			push @deleted_lines, $line;
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   429
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   430
			}
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   431
		
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   432
		if (defined $stem_substitutions{$romfile})
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   433
			{
41
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   434
			if ($hostfile =~ /^(.*(\/|\\))([^\\\/]+)$/)
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   435
				{
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   436
				my $path=$1;
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   437
				my $filename=$3;
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   438
				if ($filename !~ /^stem_/)
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   439
					{
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   440
					# print STDERR "Applying stem_ prefix to $hostfile in $line\n";
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   441
					$hostfile = "${path}stem_$filename";
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   442
					$stem_count++;
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   443
					}
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   444
				}
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   445
			}
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   446
		print $romcmd, $hostfile, $romfile, $rest, "\n";
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   447
		next;
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   448
		}
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   449
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   450
	# __ECOM_PLUGIN(emulator directory, file rom dir, dataz_, resource rom dir, filename, resource filename)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   451
	if ($line =~ /__ECOM_PLUGIN\(([^)]+)\)/)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   452
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   453
		my ($emudir, $romdir, $dataz, $resourcedir, $exename, $rscname) = split /\s*,\s*/, $1;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   454
		my $romfile = $romdir. "\\". $exename;
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   455
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   456
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   457
			{
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   458
			# print STDERR "Deleted __ECOM_PLUGIN for $romfile\n";
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   459
			$deletion_count++;
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   460
			push @deleted_lines, $line;
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   461
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   462
			}		
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   463
		}
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   464
	if ($line =~ /^\s*alias\s+(\S+)\s+(\S+)\s*$/)
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   465
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   466
		my $romfile = $1;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   467
		my $newname = $2;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   468
		
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   469
		$romfile =~ s/^\\sys/sys/;	# remove leading \, to match $romfile convention
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   470
		$romfile = $lc_romfiles{lc $romfile};
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   471
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   472
			{
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   473
			# delete the alias if the real file is marked for deletion
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   474
			$deletion_count++;
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   475
			push @deleted_lines, $line;
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   476
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   477
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   478
		else
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   479
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   480
			# print STDERR "$romfile is not deleted - saving $line\n";
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   481
			}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   482
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   483
	
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   484
	# patchdata  sys\bin\eiksrv.dll addr 0x0000c944 4 5
57
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 41
diff changeset
   485
	# patchdata rawip.dll@KRMtuIPv6 0x578
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 41
diff changeset
   486
	if ($line =~ /^\s*patchdata\s*(\S+)(\s*@|\s+addr)/i)
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   487
		{
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   488
		my $romfile = $1;
57
a44af1db196f Update buildrom.pm to keep better information for patchdata, with corresponding changes in repair_obyfile.pl and filter_obyfile.pl
William Roberts <williamr@symbian.org>
parents: 41
diff changeset
   489
		$romfile = "sys\\bin\\$romfile" if ($romfile !~ /\\/);
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   490
		$romfile =~ s/^\\//;	# remove leading \, to match $romfile convention
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   491
		$romfile = $lc_romfiles{lc $romfile};
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   492
		
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   493
		# print STDERR "deleting patchdata line for $romfile\n";
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   494
		if ($deletions{$romfile})
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   495
			{
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   496
			# don't count these lines as deletions - they are just extra lines relating to deleted files.
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   497
			push @deleted_lines, $line;
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   498
			next;
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   499
			}
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   500
		}
14
4331846fc8cb Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff changeset
   501
	print $line,"\n";
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   502
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   503
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   504
print_detail("Applied $stem_count stem substitutions and deleted $deletion_count rom files");
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   505
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   506
# Caculate what else could be removed
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   507
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   508
my %must_have_exes;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   509
sub mark_prerequisites($);	# prototype for recursion
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   510
sub mark_prerequisites($)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   511
	{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   512
	my ($exe) = @_;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   513
	return if (defined $must_have_exes{$exe});	# already marked
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   514
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   515
	$must_have_exes{$exe} = 1;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   516
	if (!defined $exe_prerequisites{$exe})
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   517
		{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   518
		# printf STDERR "$exe has no prerequisites to be marked!\n";
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   519
		return;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   520
		}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   521
	foreach my $prerequisite (@{$exe_prerequisites{$exe}})
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   522
		{
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   523
		$prerequisite =~ s/@.*$//;	# remove any ordinal information
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   524
		mark_prerequisites($prerequisite);
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   525
		}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   526
	}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   527
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   528
foreach my $romfile (keys %must_have)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   529
	{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   530
	if ($romfile =~ /^sys.bin.(.*)$/i)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   531
		{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   532
		my $exe = lc $1;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   533
		mark_prerequisites($exe);
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   534
		}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   535
	}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   536
printf STDERR "Minimum ROM now has %d exes\n", scalar keys %must_have_exes;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   537
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   538
sub count_dependents($$);	# prototype for recursion
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   539
sub count_dependents($$)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   540
	{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   541
	my ($exe, $hashref) = @_;
77
4bb92ff6576a Don't count files already deleted from the ROM in the "Deleting X would remove N files" analysis
William Roberts <williamr@symbian.org>
parents: 76
diff changeset
   542
	return if (defined $deletions{$exe_to_romfile{$exe}});
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   543
	return if (defined $$hashref{$exe});
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   544
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   545
	$$hashref{$exe} = 1;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   546
	foreach my $dependent (@{$exe_dependencies{$exe}})
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   547
		{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   548
		next if ($dependent =~ /^sid=/);
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   549
		if ($dependent =~ /^sys.bin.(.*)$/i)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   550
			{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   551
			my $depexe = lc $1;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   552
			count_dependents($depexe, $hashref);
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   553
			}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   554
		}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   555
	}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   556
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   557
my @deletion_roots;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   558
foreach my $exe (sort keys %exe_dependencies)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   559
	{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   560
	next if (defined $must_have_exes{$exe});
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   561
	my %dependents;
76
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   562
	my $deletion_root = "";
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   563
	foreach my $prerequisite (@{$exe_prerequisites{$exe}})
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   564
		{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   565
		next if (defined $must_have_exes{$prerequisite});
76
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   566
		$deletion_root = $prerequisite;	# at least one prerequisite is not a must_have, so will delete this exe if removed
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   567
		last;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   568
		}
76
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   569
	if (defined $deletions{$exe_to_romfile{$exe}})
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   570
		{
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   571
		if ($deletion_root ne "")
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   572
			{
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   573
			#print STDERR "Explicit deletion of $exe is not efficient - $deletion_root would remove it\n";
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   574
			}
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   575
			next;	# no need to report this one
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   576
		}
af2426f01bab Further tweak to avoid reporting deletion roots already marked as "Out".
William Roberts <williamr@symbian.org>
parents: 75
diff changeset
   577
	next if ($deletion_root ne "");
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   578
	
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   579
	count_dependents($exe, \%dependents);
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   580
	my $count = scalar keys %dependents;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   581
	push @deletion_roots, sprintf "%-4d\t%s", scalar keys %dependents, $exe;
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   582
	}
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   583
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   584
my $deleted_lines_oby = "filtered.oby";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   585
my $deletion_details_file = "filter.log";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   586
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   587
if ($deleted_lines_oby && scalar @deleted_lines)
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   588
	{
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   589
	print STDERR "Writing deleted lines to $deleted_lines_oby\n";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   590
	open FILE, ">$deleted_lines_oby" or die("Unable to write to file $deleted_lines_oby: $!\n");
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   591
	foreach my $line (@deleted_lines)
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   592
		{
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   593
		print FILE $line, "\n";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   594
		}
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   595
	close FILE;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   596
	}
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   597
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   598
if ($deletion_details_file && scalar (@details, @problems, @deletion_roots))
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   599
	{
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   600
	print STDERR "Writing deletion details to $deletion_details_file\n";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   601
	open FILE, ">$deletion_details_file" or die("Unable to write to file $deletion_details_file: $!\n");
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   602
	foreach my $line (@details)
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   603
		{
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   604
		print FILE $line, "\n";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   605
		}
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   606
		
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   607
	print FILE "\n====\n";
80
3ab0df073c86 Add support for "slim", which is "stem" + removal of some exports and checking of import details
William Roberts <williamr@symbian.org>
parents: 78
diff changeset
   608
	printf FILE "Minimum ROM now has %d exes\n", scalar keys %must_have_exes;
99
e23a8d7ea8bb Update filter_obyfile.pl to report the "minimal ROM" executables
William Roberts <williamr@symbian.org>
parents: 80
diff changeset
   609
	print FILE join("\n", sort keys %must_have_exes), "\n";
e23a8d7ea8bb Update filter_obyfile.pl to report the "minimal ROM" executables
William Roberts <williamr@symbian.org>
parents: 80
diff changeset
   610
	
e23a8d7ea8bb Update filter_obyfile.pl to report the "minimal ROM" executables
William Roberts <williamr@symbian.org>
parents: 80
diff changeset
   611
	print FILE "\n====\n";
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   612
	foreach my $deletion_root (sort {$b <=> $a} @deletion_roots)
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   613
		{
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   614
		my ($count,$exe) = split /\s+/, $deletion_root;
78
7271390ae2c2 Remember more information from rom_content.csv, to add IBY and package information to filter.log
William Roberts <williamr@symbian.org>
parents: 77
diff changeset
   615
		printf FILE "Remove %d files by deleting %s (%s)\n", $count, $exe, $rom_origins{$exe_to_romfile{$exe}};
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   616
		}	
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   617
27
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   618
	print FILE "\n====\n";
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   619
	foreach my $problem (sort @problems)
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   620
		{
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   621
		my ($romfile, $trail) = split /\t/, $problem;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   622
		print FILE "$romfile depends on removed files $trail\n"
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   623
		}
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   624
	close FILE;
c29882e1d694 Add filter_obyfile.pl -l filter.log and -d filtered.oby options, to capture details of the deletions
William Roberts <williamr@symbian.org>
parents: 22
diff changeset
   625
	}
75
b0f4d5be8407 Extend filter_obyfile.pl to report on good exes to delete - see new info in filter.log
William Roberts <williamr@symbian.org>
parents: 57
diff changeset
   626