tools/repair_obyfile.pl
author Tom Pritchard <tomp@symbian.org>
Thu, 14 Oct 2010 17:36:00 +0100
branchsystem_startup
changeset 45 7cc18512baf6
parent 9 b5c893269cd5
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:
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2010 Symbian Foundation Ltd.
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
# All rights reserved.
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# This component and the accompanying materials are made available
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# which accompanies this distribution, and is available
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
#
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
# Initial Contributors:
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Symbian Foundation - initial contribution.
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
#
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# Contributors:
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
#
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
# Description: 
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# Process file ROM log to make it suitable for re-use by buildrom.pl
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
use strict;
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    17
use Getopt::Long;
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    18
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    19
my $featurelist = "syborg_stem_features.iby";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    20
GetOptions(
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    21
  "f|features=s" => \$featurelist,   # name of featurelist file
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    22
  );
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    23
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    24
print "ROM_IMAGE[0] {\n";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    25
print "#include \"$featurelist\"\n";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    26
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
my $line;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
while ($line = <>)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
	{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
	# Put back original auto-btmap statements for any "mbm_rom" derived files
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
	$line =~ s/data="(.*mbm)_rom"(\s+)"(.*)"/auto-bitmap=$1$2$3/;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
	
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
	# Put back original __ECOM_PLUGIN lines
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
	# REM expanded __ECOM_PLUGIN(\epoc32\release\ARMV5\urel,Sys\Bin,\epoc32\data\Z,Resource\Plugins, a3fFourCCConvertorPlugin.dll , a3fFourCCConvertorPlugin.dll ) 
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
	if ($line =~ /^REM expanded\s+__ECOM_PLUGIN/)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
		{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
		$line =~ s/REM expanded\s+//;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
		my $discarded = <>;		# discard the derived file= line for the plugin
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
		}
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
	
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
	if ($line =~ /REM processed spidata/)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
		{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
		next;		# discard this line - it will be regenerated by the __ECOM_PLUGIN
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
		}
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    45
		
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
	$line =~ s/REM processed //;	# re-enable other directives
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
	
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
	if ($line =~ /^time=/)
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
		{
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
		$line = "time=##TODAY## 12:00:00\n";
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
		}
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
	
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    53
	# remove lines added by buildrom for generated files
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    54
	
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    55
	if ($line =~ /^data=\S+\\([^\\]+)\s+"\S+"/)
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    56
		{
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    57
		my $file = $1;
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    58
		if ($file =~ /features.dat|ecom-\d-\d\.s/)
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    59
			{
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    60
			# print STDERR "Discarded: $line";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    61
			next;
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    62
			}
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    63
		}
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    64
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    65
	if ($line =~ /^REM (ROM_IMAGE\[\d\])$/)
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    66
		{
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    67
		$line = "$1 {\n";
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    68
		print "}\n";		# close the preceeding ROM_IMAGE
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    69
		}
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    70
8
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    71
	print $line;
36cb9eb36988 Add tools\repair_obyfile.pl to process imaker generated .oby file back into suitable input for buildrom.pl
William Roberts <williamr@symbian.org>
parents:
diff changeset
    72
	}
9
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    73
b5c893269cd5 Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file.
William Roberts <williamr@symbian.org>
parents: 8
diff changeset
    74
print "}\n";