# HG changeset patch # User timothy.murphy@nokia.com # Date 1273581227 -3600 # Node ID e6381a1f4952ce4a1b3407c2e01a9666245bd4cc # Parent 17733b82d643bf6892f90b3e6d4fafb5789ccbbf fix tests for resources. Add python dependency manipulation because it's understandable to humans. diff -r 17733b82d643 -r e6381a1f4952 sbsv2/raptor/bin/depcrunch.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv2/raptor/bin/depcrunch.py Tue May 11 13:33:47 2010 +0100 @@ -0,0 +1,101 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# 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: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Minimise the dependencies in a C preprocessor dependency file to +# those that CPP could not find. Then add in an assumption about +# where to find them. Output is assumed to be relevant to only one target +# even if multiple dep files are analysed. +# + +import sys +from optparse import OptionParser +import os +import re + +class NoTargetException(Exception): + pass + +def depcrunch(file,extensions,assume): + target_pattern = r"^\s*(\S+):\s+" + target_re = re.compile(target_pattern) + extension_pattern = "[ \t]([^\/\\ \t]+\.(" + "|".join(["("+ t + ")" for t in extensions]) + "))\\b" + extension_re = re.compile(extension_pattern) + + target = None + + deps = [] + + for l in file.xreadlines(): + l = l.replace("\\","/").rstrip("\n\r") + + if not target: + t = target_re.match(l) + if t: + target = t.groups()[0] + + m = extension_re.match(l) + if m: + deps.append(m.groups()[0]) + + if not target: + raise NoTargetException() + + if len(deps) > 0: + print "%s: \\" % target + for d in deps[:-1]: + print " %s \\" % (assume + "/" + d) + print " %s " % (assume + "/" + deps[-1]) + + + + +## Command Line Interface #################################################### + +parser = OptionParser(prog = "depcrunch", + usage = "%prog [-h | options] []") + +parser.add_option("-e", "--extensions", + action="store", dest="extensions", type='string', help="comma separated list of file extensions of missing files to keep in the crunched dep file.") + +parser.add_option("-a", "--assume", + action="store", dest="assume", type='string', help="when cpp reports missing dependencies, assume that they are in this directory") + +(options, args) = parser.parse_args() + + +if not options.extensions: + parser.error("you must specify a comma-separated list of file extensions with the -t option.") + sys.exit(1) + +if not options.assume: + parser.error("you must specify an 'assumed directory' for correcting missing dependencies with the -a option.") + sys.exit(1) + +depfilename="stdin" +if len(args) > 0: + depfilename=args[0] + file = open(depfilename,"r") +else: + file = sys.stdin +try: + depcrunch(file,options.extensions.split(","), options.assume) +except NoTargetException,e: + sys.stderr.write("Target name not found in dependency file"); + sys.exit(2) + + +if file != sys.stdin: + file.close() + +sys.exit(0) diff -r 17733b82d643 -r e6381a1f4952 sbsv2/raptor/lib/config/locations.xml --- a/sbsv2/raptor/lib/config/locations.xml Mon May 10 19:06:11 2010 +0100 +++ b/sbsv2/raptor/lib/config/locations.xml Tue May 11 13:33:47 2010 +0100 @@ -109,6 +109,7 @@ + diff -r 17733b82d643 -r e6381a1f4952 sbsv2/raptor/lib/flm/base.xml --- a/sbsv2/raptor/lib/flm/base.xml Mon May 10 19:06:11 2010 +0100 +++ b/sbsv2/raptor/lib/flm/base.xml Tue May 11 13:33:47 2010 +0100 @@ -33,6 +33,8 @@ + + diff -r 17733b82d643 -r e6381a1f4952 sbsv2/raptor/lib/flm/resource.flm --- a/sbsv2/raptor/lib/flm/resource.flm Mon May 10 19:06:11 2010 +0100 +++ b/sbsv2/raptor/lib/flm/resource.flm Tue May 11 13:33:47 2010 +0100 @@ -118,25 +118,7 @@ # files etc. In the end don't print anything at all if we did not find the target. define DEPENDENCY_CORRECTOR -{ set +x; $(GNUSED) -rn '\% ([^ /]+)\.((rsg)|(mbg))%I {y%\\\\%\\/%;p;}' | \ - { \ - ENDL='\\\\\n'; \ - DEPTXT="$$$$RPP: $$$${ENDL}" ; \ - DEPCOUNT=0; \ - DEPS=''; read L; \ - while [ $$$$? -eq 0 ]; do \ - for i in $$$${L}; do \ - if [[ ( "$$$${i%%.[Rr][Ss][Gg]}" != "$$$$i" || "$$$${i%%.[Mm][Bb][Gg]}" != "$$$$i" ) && ( "$$$${i:1:1}" != ':' && "$$$${i:0:1}" != '/' ) ]]; then \ - DEPTXT="$$$$DEPTXT \$$$$(EPOCROOT)/epoc32/include/$$$$i $$$${ENDL}"; \ - (( DEPCOUNT += 1 )) ; \ - fi; \ - done; \ - read L; \ - done; \ - if [ $$$$DEPCOUNT -ne 0 ]; then \ - echo -e "$$$${DEPTXT:0:$$$$[ $$$${#DEPTXT} - 4 ]}\n"; fi ;\ - } ;\ -} +{ $(DEPCRUNCH) --extensions rsg,mbg --assume '$$$$(EPOCROOT)/epoc32/include' ; } endef else diff -r 17733b82d643 -r e6381a1f4952 sbsv2/raptor/test/smoke_suite/gccxml.py --- a/sbsv2/raptor/test/smoke_suite/gccxml.py Mon May 10 19:06:11 2010 +0100 +++ b/sbsv2/raptor/test/smoke_suite/gccxml.py Tue May 11 13:33:47 2010 +0100 @@ -34,7 +34,7 @@ "helloworld_exe/gccxml/HelloWorld.mmp.xml", "helloworld_exe/helloworld_HelloWorld_sc.rpp.d", "helloworld_exe/gccxml/HelloWorld.rss.rfi", - "helloworld_reg_exe/helloworld_reg_sc.rpp.d", + "helloworld_reg_exe/helloworld_reg_HelloWorld_reg_sc.rpp.d", "helloworld_exe/gccxml/HelloWorld_reg.rss.rfi", "helloworld_exe/gccxml/urel/HelloWorld_Application.xml.d", "helloworld_exe/gccxml/urel/HelloWorld_Application.xml", diff -r 17733b82d643 -r e6381a1f4952 sbsv2/raptor/test/smoke_suite/resource.py --- a/sbsv2/raptor/test/smoke_suite/resource.py Mon May 10 19:06:11 2010 +0100 +++ b/sbsv2/raptor/test/smoke_suite/resource.py Tue May 11 13:33:47 2010 +0100 @@ -82,7 +82,7 @@ t.mustnotmatch = [] t.mustmatch = [ - "3 .*.dependentresource_.dependentresource_dependentresource_sc.rpp.d" + "[23] .*.dependentresource_.dependentresource_dependentresource_sc.rpp.d" ] t.run() diff -r 17733b82d643 -r e6381a1f4952 sbsv2/raptor/test/smoke_suite/whatlog_cache.py --- a/sbsv2/raptor/test/smoke_suite/whatlog_cache.py Mon May 10 19:06:11 2010 +0100 +++ b/sbsv2/raptor/test/smoke_suite/whatlog_cache.py Tue May 11 13:33:47 2010 +0100 @@ -61,8 +61,8 @@ ] t.addbuildtargets('smoke_suite/test_resources/simple_gui/Bld.inf', [ "helloworld_exe/helloworld.mbm_bmconvcommands", - "helloworld_exe/helloworld_sc.rpp", - "helloworld_exe/helloworld_sc.rpp.d", + "helloworld_exe/helloworld_HelloWorld_sc.rpp", + "helloworld_exe/helloworld_HelloWorld_sc.rpp.d", "helloworld_exe/armv5/udeb/HelloWorld_Application.o", "helloworld_exe/armv5/udeb/HelloWorld_Application.o.d", "helloworld_exe/armv5/udeb/HelloWorld_AppUi.o", @@ -123,7 +123,7 @@ "helloworld_exe/winscw/urel/helloworld_UID_.dep", "helloworld_exe/winscw/urel/helloworld_UID_.o", "helloworld_exe/winscw/urel/helloworld_UID_.o.d", - "helloworld_reg_exe/helloworld_reg_sc.rpp.d" + "helloworld_reg_exe/helloworld_reg_HelloWorld_reg_sc.rpp.d" ]) t.countmatch = [ ["\$self->{abldcache}->{.*\\\\test\\\\smoke_suite\\\\test_resources\\\\simple_gui target (armv5|winscw) (udeb|urel) -what\'} =", 4],