tools/repair_obyfile.pl
author William Roberts <williamr@symbian.org>
Sat, 09 Oct 2010 18:20:42 +0100
changeset 9 b5c893269cd5
parent 8 36cb9eb36988
child 57 a44af1db196f
permissions -rw-r--r--
Update repair_obyfile.pl to handle the features and spi generation correctly - now has "-f" option to specify a "features.iby" file. Store the modified buildrom.pm here rather than in syborg_stem.

# Copyright (c) 2010 Symbian Foundation Ltd.
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Symbian Foundation - initial contribution.
#
# Contributors:
#
# Description: 
# Process file ROM log to make it suitable for re-use by buildrom.pl

use strict;
use Getopt::Long;

my $featurelist = "syborg_stem_features.iby";
GetOptions(
  "f|features=s" => \$featurelist,   # name of featurelist file
  );

print "ROM_IMAGE[0] {\n";
print "#include \"$featurelist\"\n";

my $line;
while ($line = <>)
	{
	# Put back original auto-btmap statements for any "mbm_rom" derived files
	$line =~ s/data="(.*mbm)_rom"(\s+)"(.*)"/auto-bitmap=$1$2$3/;
	
	# Put back original __ECOM_PLUGIN lines
	# REM expanded __ECOM_PLUGIN(\epoc32\release\ARMV5\urel,Sys\Bin,\epoc32\data\Z,Resource\Plugins, a3fFourCCConvertorPlugin.dll , a3fFourCCConvertorPlugin.dll ) 
	if ($line =~ /^REM expanded\s+__ECOM_PLUGIN/)
		{
		$line =~ s/REM expanded\s+//;
		my $discarded = <>;		# discard the derived file= line for the plugin
		}
	
	if ($line =~ /REM processed spidata/)
		{
		next;		# discard this line - it will be regenerated by the __ECOM_PLUGIN
		}
		
	$line =~ s/REM processed //;	# re-enable other directives
	
	if ($line =~ /^time=/)
		{
		$line = "time=##TODAY## 12:00:00\n";
		}
	
	# remove lines added by buildrom for generated files
	
	if ($line =~ /^data=\S+\\([^\\]+)\s+"\S+"/)
		{
		my $file = $1;
		if ($file =~ /features.dat|ecom-\d-\d\.s/)
			{
			# print STDERR "Discarded: $line";
			next;
			}
		}

	if ($line =~ /^REM (ROM_IMAGE\[\d\])$/)
		{
		$line = "$1 {\n";
		print "}\n";		# close the preceeding ROM_IMAGE
		}

	print $line;
	}

print "}\n";