3
+ − 1
#
+ − 2
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+ − 3
# All rights reserved.
+ − 4
# This component and the accompanying materials are made available
+ − 5
# under the terms of the License "Eclipse Public License v1.0"
+ − 6
# which accompanies this distribution, and is available
+ − 7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ − 8
#
+ − 9
# Initial Contributors:
+ − 10
# Nokia Corporation - initial contribution.
+ − 11
#
+ − 12
# Contributors:
+ − 13
#
+ − 14
# Description:
+ − 15
# oby2linux
+ − 16
#
+ − 17
+ − 18
"""
+ − 19
Convert an OBY file into a form that rombuild on Linux can use.
+ − 20
This involves converting paths etc. In addition it finds those target
+ − 21
files whose case may not match what exists on the filesystem
+ − 22
(a build must have been completed).
+ − 23
+ − 24
It also fills in those items that weren't built from a directory
+ − 25
containing a prebuild epoc32 dir.
+ − 26
"""
+ − 27
+ − 28
+ − 29
import sys
+ − 30
import os
+ − 31
import re
+ − 32
+ − 33
sys.path.append(os.environ['SBS_HOME']+'/python')
+ − 34
import generic_path
+ − 35
+ − 36
epocroot = os.environ['EPOCROOT']
+ − 37
+ − 38
try:
+ − 39
romfillin_epocroot = os.environ['ROMFILLIN_EPOCROOT']
+ − 40
except:
+ − 41
sys.stderr.write("Please set ROMFILLIN_EPOCROOT to a path with an epoc32 directory\n")
+ − 42
sys.exit(1)
+ − 43
+ − 44
if not os.path.isdir(romfillin_epocroot+'/epoc32'):
+ − 45
sys.stderr.write("Please set ROMFILLIN_EPOCROOT to a path with an epoc32 directory\n")
+ − 46
sys.exit(1)
+ − 47
+ − 48
filestatement_re=re.compile("^(?P<pre>((((primary)|(secondary)|(extension)|(device)|(variant))(\[0x[0-9a-zA-Z]+\])?=)|((file)|(data)|(bootbinary))=))(?P<filename>\S+)(?P<tail>.*)$")
+ − 49
+ − 50
for line in sys.stdin.xreadlines():
+ − 51
line = line.rstrip()
+ − 52
m = filestatement_re.search(line)
+ − 53
if m is not None:
+ − 54
fname = m.groupdict()['filename'].replace('\\','/').strip('"')
+ − 55
filename = generic_path.Path(epocroot + fname)
+ − 56
filefound = filename.FindCaseless()
+ − 57
if filefound is not None:
+ − 58
print m.groupdict()['pre'] + str(filefound) + m.groupdict()['tail']
+ − 59
#print filefound
+ − 60
else:
+ − 61
fillinname = generic_path.Path(romfillin_epocroot+fname)
+ − 62
filefound = fillinname.FindCaseless()
+ − 63
if filefound is not None:
+ − 64
sys.stderr.write("filledinmissing: %s\n" % str(filefound))
+ − 65
print m.groupdict()['pre'] + str(filefound) + m.groupdict()['tail']
+ − 66
#print filefound
+ − 67
else:
+ − 68
sys.stderr.write("filenotfound: %s\n" % str(filename))
+ − 69
else:
+ − 70
print line
+ − 71
+ − 72
+ − 73