tools/filter_obyfile.pl
author Tom Pritchard <tomp@symbian.org>
Thu, 14 Oct 2010 17:36:00 +0100
branchsystem_startup
changeset 45 7cc18512baf6
parent 41 c57a6c85ccdc
child 57 a44af1db196f
permissions -rw-r--r--
Updating the default syborg_stem_rom.oby (and making a copy of the original in the originals folder)
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";
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
    21
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
    22
  "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
    23
  "l|log=s" => \$deletion_details_file,   # log of whats deleted and why
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
  );
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
    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
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
    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
	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
    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
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
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
    32
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
    33
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
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
    35
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
    36
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
    37
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
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
    39
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
    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
# 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
    42
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
    43
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
    44
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
    45
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
    46
	{
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
	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
    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
	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
    50
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
	$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
    52
	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
    53
		{
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
		$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
    55
		$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
    56
		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
    57
		}
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
	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
    60
		{
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    61
		# 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
    62
		$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
    63
		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
    64
		}
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
	
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
	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
    67
		{
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
		$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
    69
		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
    70
		}
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
    71
	}
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
    72
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
    73
printf STDERR "%d in (including % stem), %d out\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
    74
	scalar keys %must_have,
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
    75
	scalar keys %stem_substitutions, 
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
    76
	scalar keys %deletions; 
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
    77
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
    78
# 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
    79
my %exe_to_romfile;
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
    80
my %exe_dependencies;
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
    81
my %lc_romfiles;
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
my $line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    84
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
    85
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
    86
	{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    87
	chomp $line;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
    88
	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
    89
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
    90
	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
    91
	
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
    92
	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
    93
		{
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
    94
		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
    95
			{
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
    96
			print STDERR "Ignoring dependencies of $hostfile because of stem substitution of $romfile\n";
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
    97
			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
    98
			}
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
    99
		}
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
   100
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   101
	$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
   102
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   103
	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
   104
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   105
		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
   106
		$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
   107
		}
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
   108
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
   109
	foreach my $dependent (split /:/,$stuff)
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
   110
		{
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
   111
		next if ($dependent =~ /^sid=/);
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
   112
		$dependent = lc $dependent;
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
   113
		
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
   114
		$dependent =~ s/^sys\\bin\\//;	# no directory => sys\bin anyway
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
   115
		$dependent =~ s/\[\S+\]//;	# ignore the UIDs for now
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
   116
		
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
   117
		if (!defined $exe_dependencies{$dependent})
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
   118
			{
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
   119
			my @dependents = ($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
   120
			$exe_dependencies{$dependent} = \@dependents;
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
   121
			}
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
   122
		else
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
   123
			{
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
   124
			push @{$exe_dependencies{$dependent}}, $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
   125
			}
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
		}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   127
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   128
close STATIC_DEPENDENCIES;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   129
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
   130
# 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
   131
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   132
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
   133
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   134
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
   135
	{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   136
	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
   137
		{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   138
		my $romfile = $1;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   139
		my $newname = $2;
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   140
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   141
		$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
   142
		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
   143
		$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
   144
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   145
		$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
   146
		$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
   147
		
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   148
		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
   149
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   150
			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
   151
			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
   152
			# 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
   153
			}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   154
		}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   155
	}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   156
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   157
# 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
   158
# 	{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   159
# 	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
   160
# 	}
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   161
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
   162
# 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
   163
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
   164
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
   165
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
   166
	{
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
   167
	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
   168
	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
   169
	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
   170
	}
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
   171
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
   172
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
   173
sub delete_dependents($$$)
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   174
	{
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   175
	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
   176
	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
   177
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   178
	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
   179
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   180
		# 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
   181
		return;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   182
		}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   183
	
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
   184
	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
   185
		{
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
   186
		# 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
   187
		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
   188
		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
   189
		# 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
   190
		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
   191
		}
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
   192
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
   193
	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
   194
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   195
	$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
   196
	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
   197
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   198
		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
   199
		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
   200
			{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   201
			# 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
   202
			return;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   203
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   204
		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
   205
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   206
			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
   207
				{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   208
		  	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
   209
		  	}
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
   210
		  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
   211
				{
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
   212
				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
   213
				}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   214
			}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   215
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   216
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   217
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   218
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
   219
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
   220
	{
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
   221
	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
   222
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   223
	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
   224
	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
   225
	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
   226
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   227
		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
   228
		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
   229
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   230
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   231
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
   232
# 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
   233
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   234
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
   235
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
   236
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
   237
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   238
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
   239
	{
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
   240
	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
   241
	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
   242
		{
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
   243
		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
   244
		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
   245
		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
   246
		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
   247
		$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
   248
		
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
   249
		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
   250
			{
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
   251
			$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
   252
			$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
   253
			$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
   254
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   255
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   256
		$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
   257
		
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   258
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   259
			{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   260
			$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
   261
			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
   262
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   263
			}
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
   264
		
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
   265
		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
   266
			{
41
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   267
			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
   268
				{
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   269
				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
   270
				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
   271
				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
   272
					{
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   273
					# 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
   274
					$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
   275
					$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
   276
					}
c57a6c85ccdc Fix up the filter_obyfile.pl to make it not double "stem_" things
Tom Pritchard <tomp@symbian.org>
parents: 27
diff changeset
   277
				}
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
   278
			}
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
   279
		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
   280
		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
   281
		}
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
   282
	
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   283
	# __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
   284
	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
   285
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   286
		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
   287
		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
   288
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   289
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   290
			{
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   291
			# 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
   292
			$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
   293
			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
   294
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   295
			}		
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   296
		}
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   297
	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
   298
		{
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   299
		my $romfile = $1;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   300
		my $newname = $2;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   301
		
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   302
		$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
   303
		$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
   304
		if ($deletions{$romfile})
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   305
			{
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   306
			# 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
   307
			$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
   308
			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
   309
			next;
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   310
			}
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   311
		else
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   312
			{
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   313
			# 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
   314
			}
15
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   315
		}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   316
	
17
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   317
	# 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
   318
	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
   319
		{
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   320
		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
   321
		$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
   322
		$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
   323
		
18
142e13d70737 More updates to filter_obyfile.pl, now copes properly with aliases
William Roberts <williamr@symbian.org>
parents: 17
diff changeset
   324
		# 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
   325
		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
   326
			{
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   327
			# 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
   328
			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
   329
			next;
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   330
			}
1d230a71c389 Update filter_obyfile.pl to handle patchdata and some more alias cases.
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   331
		}
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
   332
	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
   333
	}
330c2ceccdc6 filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
   334
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
   335
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
   336
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
   337
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
   338
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
   339
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
   340
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
   341
	{
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
   342
	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
   343
	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
   344
	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
   345
		{
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
   346
		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
   347
		}
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
   348
	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
   349
	}
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
   350
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
   351
if ($deletion_details_file && scalar @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
   352
	{
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 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
   354
	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
   355
	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
   356
		{
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
   357
		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
   358
		}
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
	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
   360
	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
   361
		{
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
   362
		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
   363
		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
   364
		}
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
   365
	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
   366
	}