tools/filter_obyfile.pl
author William Roberts <williamr@symbian.org>
Sun, 10 Oct 2010 22:36:56 +0100
changeset 18 142e13d70737
parent 17 1d230a71c389
child 19 b1cc137d8adb
permissions -rw-r--r--
More updates to filter_obyfile.pl, now copes properly with aliases Can remove bluetooth.dll (+ 2107 other files!) to give a ROM which still links but it clearly doomed. Can remove FileList.dll (from gsprofilesrv, takes out 158 files).
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;
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
    17
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
    18
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
    19
	{
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
    20
	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
    21
	}
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
    22
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
    23
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
    24
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
    25
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
    26
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
    27
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
    28
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
    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
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
    31
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
    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
# read through the rom_content_csv looking for direct instructions
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 %stem_substitutions;
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
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
    36
my %must_have;
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
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
    38
	{
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
	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
    40
	
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
	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
    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
	$cmd = lc $cmd;
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
    44
	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
    45
		{
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
    46
		$stem_substitutions{$romfile} = $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
    47
		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
    48
		}
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
	
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
    50
	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
    51
		{
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    52
		# 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
    53
		$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
    54
		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
    55
		}
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
	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
    58
		{
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
    59
		$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
    60
		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
    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
	}
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
    63
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
    64
printf STDERR "%d stem, %d out, %d in\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
    65
	scalar keys %stem_substitutions, 
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
    66
	scalar keys %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
    67
	scalar keys %must_have;
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
    68
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
    69
# read static dependencies file
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    70
my %exe_to_romfile;
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
    71
my %lc_romfiles;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
    72
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    73
my $line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    74
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
    75
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
    76
	{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    77
	chomp $line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    78
	last if ($line eq "");	# blank line between the two sections
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    79
	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
    80
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
    81
	$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
    82
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    83
	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
    84
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    85
		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
    86
		$exe_to_romfile{$exe} = $romfile;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    87
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    88
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    89
my %exe_dependencies;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    90
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
    91
	{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    92
	chomp $line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    93
	my ($x, $exename, @dependencies) = split /\t/,$line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    94
	$exe_dependencies{$exename} = \@dependencies;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    95
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    96
close STATIC_DEPENDENCIES;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    97
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
    98
# Create static dependencies for aliases
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
    99
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   100
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
   101
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   102
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
   103
	{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   104
	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
   105
		{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   106
		my $romfile = $1;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   107
		my $newname = $2;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   108
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   109
		$romfile =~ 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
   110
		next if (!defined $lc_romfiles{lc $romfile});		# aliases to non-executables
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   111
		$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
   112
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   113
		$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
   114
		$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
   115
		
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   116
		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
   117
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   118
			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
   119
			push @{$exe_dependencies{$realexe}}, $newname;		# the alias is a dependent of the real file
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   120
			# 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
   121
			}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   122
		}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   123
	}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   124
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   125
# foreach my $exe ("libopenvg.dll", "libopenvg_sw.dll")
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   126
# 	{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   127
# 	printf STDERR "Dependents of %s = %s\n", $exe, join(", ", @{$exe_dependencies{$exe}});
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   128
# 	}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   129
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
   130
# process the "out" commands to recursively expand the 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
   131
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   132
sub delete_dependents($$$)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   133
	{
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   134
	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
   135
	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
   136
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   137
	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
   138
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   139
		# 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
   140
		if ($original_reason eq $romfile && $deletions{$romfile} ne $original_reason)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   141
			{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   142
			print STDERR "$romfile already deleted by removing $deletions{$romfile}\n";
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   143
			}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   144
		return;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   145
		}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   146
	
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   147
	# We should keep the following information, but it's rather verbose
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   148
	# printf STDERR "  %d - deleting %s (%s)\n", scalar @{$listref}, $romfile, $trail;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   149
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   150
	$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
   151
	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
   152
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   153
		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
   154
		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
   155
			{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   156
			# 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
   157
			return;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   158
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   159
		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
   160
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   161
			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
   162
				{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   163
		  	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
   164
		  	}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   165
			}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   166
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   167
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   168
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   169
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
   170
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
   171
	{
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   172
	delete $deletions{$romfile}; 	# so that delete_dependents will iterate properly
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   173
	my @delete_list = ("$romfile\tout");
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   174
	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
   175
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   176
		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
   177
		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
   178
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   179
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   180
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
   181
# 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
   182
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   183
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
   184
my $deletion_count = 0;
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   185
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
   186
	{
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
   187
	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
   188
	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
   189
		{
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
   190
		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
   191
		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
   192
		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
   193
		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
   194
		$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
   195
		
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
   196
		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
   197
			{
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
   198
			$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
   199
			$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
   200
			$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
   201
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   202
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   203
		$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
   204
		
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   205
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   206
			{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   207
			$deletion_count++;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   208
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   209
			}
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
   210
		
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
   211
		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
   212
			{
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
   213
			# print STDERR "Applying stem_ prefix to $hostfile in $line\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
   214
			$hostfile =~ s/(\/|\\)([^\\\/]+)$/$1stem_$2/;
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   215
			$stem_count++;
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
   216
			}
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
   217
		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
   218
		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
   219
		}
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
   220
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   221
	# __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
   222
	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
   223
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   224
		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
   225
		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
   226
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   227
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   228
			{
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   229
			# 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
   230
			$deletion_count++;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   231
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   232
			}		
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   233
		}
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   234
	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
   235
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   236
		my $romfile = $1;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   237
		my $newname = $2;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   238
		
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   239
		$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
   240
		$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
   241
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   242
			{
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   243
			# 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
   244
			$deletion_count++;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   245
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   246
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   247
		else
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   248
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   249
			# 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
   250
			}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   251
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   252
	
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   253
	# patchdata  sys\bin\eiksrv.dll addr 0x0000c944 4 5
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   254
	if ($line =~ /^\s*patchdata\s*(\S+)/)
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   255
		{
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   256
		my $romfile = $1;
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   257
		$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
   258
		$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
   259
		
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   260
		# 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
   261
		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
   262
			{
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   263
			# don't count these lines as deletions - they are just extra lines relating to deleted files.
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   264
			next;
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   265
			}
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   266
		}
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
   267
	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
   268
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   269
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   270
print STDERR "Applied $stem_count stem substitutions and deleted $deletion_count rom files\n";