author | William Roberts <williamr@symbian.org> |
Sun, 10 Oct 2010 18:43:39 +0100 | |
changeset 15 | 330c2ceccdc6 |
parent 14 | 4331846fc8cb |
child 17 | 1d230a71c389 |
permissions | -rw-r--r-- |
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; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
71 |
my $line; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
72 |
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
|
73 |
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
|
74 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
75 |
chomp $line; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
76 |
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
|
77 |
my ($romfile, $hostfile, $stuff) = split /\t/, $line; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
78 |
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
|
79 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
80 |
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
|
81 |
$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
|
82 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
83 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
84 |
my %exe_dependencies; |
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 ($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
|
89 |
$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
|
90 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
91 |
close STATIC_DEPENDENCIES; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
92 |
|
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
|
93 |
# 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
|
94 |
|
15
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
95 |
sub delete_dependents($$$) |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
96 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
97 |
my ($romfile,$original_reason,$listref) = @_; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
98 |
printf STDERR " %d - deleting %s\n", scalar @{$listref}, $romfile; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
99 |
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
|
100 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
101 |
# 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
|
102 |
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
|
103 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
104 |
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
|
105 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
106 |
return; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
107 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
108 |
$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
|
109 |
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
|
110 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
111 |
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
|
112 |
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
|
113 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
114 |
# 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
|
115 |
return; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
116 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
117 |
push @{$listref}, @{$exe_dependencies{$exe}}; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
118 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
119 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
120 |
|
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
121 |
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
|
122 |
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
|
123 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
124 |
delete $deletions{$romfile}; # so that delete_dependents with iterate properly |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
125 |
my @delete_list = ($romfile); |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
126 |
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
|
127 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
128 |
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
|
129 |
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
|
130 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
131 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
132 |
|
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
|
133 |
# 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
|
134 |
|
15
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
135 |
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
|
136 |
my $deletion_count = 0; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
137 |
my %lc_romfiles; |
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
|
138 |
my $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
|
139 |
while ($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
|
140 |
{ |
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
141 |
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
|
142 |
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
|
143 |
{ |
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
144 |
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
|
145 |
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
|
146 |
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
|
147 |
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
|
148 |
$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
|
149 |
|
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
150 |
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
|
151 |
{ |
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
152 |
$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
|
153 |
$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
|
154 |
$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
|
155 |
} |
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
156 |
|
15
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
157 |
$lc_romfiles{lc $romfile} = $romfile; # for alias processing |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
158 |
|
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
159 |
if ($deletions{$romfile}) |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
160 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
161 |
$deletion_count++; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
162 |
next; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
163 |
} |
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
|
164 |
|
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
165 |
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
|
166 |
{ |
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
167 |
# 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
|
168 |
$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
|
169 |
$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
|
170 |
} |
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
171 |
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
|
172 |
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
|
173 |
} |
4331846fc8cb
Add first version of tools\filter_obyfile.pl, which uses rom_content.csv to select "stem_" versions of files.
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
174 |
|
15
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
175 |
# __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
|
176 |
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
|
177 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
178 |
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
|
179 |
my $romfile = $romdir. "\\". $exename; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
180 |
if ($deletions{$romfile}) |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
181 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
182 |
print STDERR "Deleted __ECOM_PLUGIN for $romfile\n"; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
183 |
$deletion_count++; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
184 |
next; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
185 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
186 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
187 |
if ($line =~ /alias\s+(\S+)\s+(\S+)\s*$/) |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
188 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
189 |
my $romfile = $1; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
190 |
my $newname = $2; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
191 |
|
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
192 |
$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
|
193 |
if ($deletions{$romfile}) |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
194 |
{ |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
195 |
$deletion_count++; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
196 |
# Not sure what to do about aliases - what if the alias has dependents? |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
197 |
next; |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
198 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
199 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
200 |
|
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
|
201 |
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
|
202 |
} |
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
203 |
|
330c2ceccdc6
filter_obyfile.pl now handles deletions including ECOM plugins and aliases
William Roberts <williamr@symbian.org>
parents:
14
diff
changeset
|
204 |
print STDERR "Applied $stem_count stem substitutions and deleted $deletion_count rom files\n"; |