fix: depcrunch was using re.match where re.findall was what was wanted. Add a test.
--- a/sbsv2/raptor/bin/depcrunch.py Tue May 11 15:56:19 2010 +0100
+++ b/sbsv2/raptor/bin/depcrunch.py Tue May 11 20:22:35 2010 +0100
@@ -29,24 +29,35 @@
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"
+ # Not the use of (?i) in the following expression. re.I seems to cause re.findall
+ # to not actually find all files matching the extension whereas (?i) provides
+ # case insensitivity at the right point and it works. Really don't understand this.
+ extension_pattern = r"\s([^/ \t]+\.((?i)" + "|".join([t for t in extensions]) + r"))\b"
extension_re = re.compile(extension_pattern)
target = None
deps = []
- for l in file.xreadlines():
+ # Read through the dependencies.
+ for l in file:
l = l.replace("\\","/").rstrip("\n\r")
+ # Look out for the target name if
+ # we have not found it yet
if not target:
t = target_re.match(l)
if t:
target = t.groups()[0]
-
- m = extension_re.match(l)
+
+ # Look for prerequisites matching the
+ # extensions. There may be one or more on
+ # the same line as the target name.
+ # Don't use re.I - somehow prevents
+ # all but one match in a line which may have several files
+ m = extension_re.findall(l)
if m:
- deps.append(m.groups()[0])
+ deps.extend([d[0] for d in m])
if not target:
raise NoTargetException()
@@ -75,7 +86,7 @@
if not options.extensions:
- parser.error("you must specify a comma-separated list of file extensions with the -t option.")
+ parser.error("you must specify a comma-separated list of file extensions with the -e option.")
sys.exit(1)
if not options.assume:
@@ -91,7 +102,7 @@
try:
depcrunch(file,options.extensions.split(","), options.assume)
except NoTargetException,e:
- sys.stderr.write("Target name not found in dependency file");
+ sys.stderr.write("Target name not found in dependency file\n");
sys.exit(2)
--- a/sbsv2/raptor/lib/flm/resource.flm Tue May 11 15:56:19 2010 +0100
+++ b/sbsv2/raptor/lib/flm/resource.flm Tue May 11 20:22:35 2010 +0100
@@ -67,7 +67,6 @@
INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_lower)_$(notdir $(basename $(SOURCE)))
INTERBASE:=$(OUTPUTPATH)/$(TARGET_lower)
-$(call makepath,$(INTERBASE))
# common pre-processor options
@@ -78,7 +77,7 @@
CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\
-I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-I$(I) ) -I- $(foreach J,$(SYSTEMINCLUDE),-I$(J) )
-CREATABLEPATHS:=$(CREATABLEPATHS) $(RSCDIR) $(RSGDIR) $(OUTPUTPATH) $(INTERBASE_TMP) $(INTERBASE)
+CREATABLEPATHS:=$(CREATABLEPATHS) $(RSCDIR) $(RSGDIR) $(OUTPUTPATH)
# We intend to generate the resource in an intermediate location and copy to the targetpath to
# ensure that when the "same" resource is built into separare target paths, it doesn't have to be
--- a/sbsv2/raptor/python/plugins/filter_copyfile.py Tue May 11 15:56:19 2010 +0100
+++ b/sbsv2/raptor/python/plugins/filter_copyfile.py Tue May 11 20:22:35 2010 +0100
@@ -74,7 +74,10 @@
def flushcopies(self):
for source in self.files.keys():
for dest in self.files[source]:
- copyfile(source, dest)
+ try:
+ copyfile(source, dest)
+ except IOError, e:
+ print "<error>%s</error>" % str(e)
self.files = {}
--- a/sbsv2/raptor/python/raptor_utilities.py Tue May 11 15:56:19 2010 +0100
+++ b/sbsv2/raptor/python/raptor_utilities.py Tue May 11 20:22:35 2010 +0100
@@ -192,7 +192,6 @@
nulllog = NullLog()
-
def copyfile(_source, _destination):
"""Copy the source file to the destination file (create a directory
to copy into if it does not exist). Don't copy if the destination
@@ -210,7 +209,6 @@
os.makedirs(str(destDir))
shutil.copyfile(source_str, dest_str)
return
-
# Destination file exists so we have to think about updating it
sourceMTime = 0
destMTime = 0
@@ -218,11 +216,13 @@
try:
sourceStat = os.stat(source_str)
sourceMTime = sourceStat[stat.ST_MTIME]
+ except OSError, e:
+ message = "Source of copyfile does not exist: " + str(source)
+ raise IOError(message)
+ try:
destMTime = os.stat(dest_str)[stat.ST_MTIME]
except OSError, e:
- if sourceMTime == 0:
- message = "Source of copyfile does not exist: " + str(source)
- print message
+ pass # destination doesn't have to exist
if destMTime == 0 or destMTime < sourceMTime:
if os.path.exists(dest_str):
@@ -234,6 +234,7 @@
except Exception,e:
- message = "Could not export " + source_str + " to " + dest_str + " : " + str(e)
+ message = "Could not update " + dest_str + " from " + source_str + " : " + str(e)
+ raise IOError(message)
return
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/depcrunch_test.py Tue May 11 20:22:35 2010 +0100
@@ -0,0 +1,46 @@
+#
+# 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:
+#
+
+from raptor_tests import SmokeTest
+
+def run():
+ t = SmokeTest()
+ t.usebash = True
+
+ t.description = "Test that dependency crunching for resource dependency files produces expected output"
+
+ t.id = "43562999"
+ t.name = "depcrunch"
+ t.command = "python $SBS_HOME/bin/depcrunch.py --extensions mbg,rsg --assume EPOCROOT < smoke_suite/test_resources/depcrunch/dep2.rpp.d"
+ t.stdout = [
+ r"EPOCROOT/epoc32/build/resource/c_98665870f0168225/dependentresource_/dependentresource_dependentresource_sc.rpp: \\",
+ r" EPOCROOT/testresource1.mbg \\",
+ r" EPOCROOT/testresource2.rsg \\",
+ r" EPOCROOT/testresource3.rsg \\",
+ r" EPOCROOT/testresource4.mbg \\",
+ r" EPOCROOT/testresource5.rsg \\",
+ r" EPOCROOT/testresource6.mbg \\",
+ r" EPOCROOT/testresource7.rsg \\",
+ r" EPOCROOT/testresource8.mbg \\",
+ r" EPOCROOT/testresource9.rsg "
+ ]
+ t.run()
+
+
+ t.print_result()
+
+ return t
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/depcrunch/dep2.rpp.d Tue May 11 20:22:35 2010 +0100
@@ -0,0 +1,11 @@
+EPOCROOT/epoc32/build/resource/c_98665870f0168225/dependentresource_/dependentresource_dependentresource_sc.rpp: testresource1.mbg \
+ /home/tnmurphy/x/build/sbsv2/raptor/test/smoke_suite/test_resources/resource/dependentresource.rss \
+ /home/tnmurphy/x/test-epocroot/epoc32/include/variant/Symbian_OS.hrh \
+ /home/tnmurphy/x/test-epocroot/epoc32/include/testresource_badef.rh \
+ /home/tnmurphy/x/test-epocroot/epoc32/include/e32capability.h testresource2.rsg \
+ /home/tnmurphy/x/build/sbsv2/raptor/test/smoke_suite/test_resources/resource/inc/../inc/testresource.rh \
+ testresource3.rsg /home/tnmurphy/x/build/sbsv2/raptor/test/smoke_suite/test_resources/resource/inc/../inc/testresource.hrh \
+ /home/tnmurphy/x/build/sbsv2/raptor/test/smoke_suite/test_resources/resource/testresource.rls \
+ testresource4.mbg testresource5.rsg \
+ testresource6.mbg testresource7.rsg
+ testresource8.mbg testresource9.rsg
--- a/sbsv2/raptor/test/smoke_suite/timing.py Tue May 11 15:56:19 2010 +0100
+++ b/sbsv2/raptor/test/smoke_suite/timing.py Tue May 11 20:22:35 2010 +0100
@@ -24,7 +24,7 @@
t.id = "0103b"
t.name = "timing_on"
- t.command = "sbs -b smoke_suite/test_resources/simple/bld.inf --timing " + \
+ t.command = "sbs -b smoke_suite/test_resources/simple/bld.inf" + \
"--filters=FilterLogfile,FilterTiming -f ${SBSLOGFILE} && " + \
"grep progress:duration ${SBSLOGFILE}.timings"
t.mustmatch = [