fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines. fix
authortimothy.murphy@nokia.com
Wed, 28 Apr 2010 01:01:42 +0100
branchfix
changeset 534 3b10c85868b1
parent 533 408bfff46ad7
child 535 3ed696bd9e5f
fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines. fix resource copy performance: remove debug fix filters: behave if someone puts 2 identically named filters into the plugin dir by mistake.
sbsv2/raptor/lib/flm/resource.flm
sbsv2/raptor/python/filter_list.py
sbsv2/raptor/python/plugins/filter_copyfile.py
sbsv2/raptor/test/smoke_suite/sysdef_layers.py
--- a/sbsv2/raptor/lib/flm/resource.flm	Mon Apr 26 17:33:17 2010 +0100
+++ b/sbsv2/raptor/lib/flm/resource.flm	Wed Apr 28 01:01:42 2010 +0100
@@ -152,10 +152,31 @@
     # This version minimises the size of dependency files, to contain only .mbg and .rsg deps.
     # It allows resources to be built in the right order but doesn't impose the weight of
     # of full dependency information which can overwhelm make in large builds.
-    # The strategy is to filter out lines (apart from the target line which is the first) which don't have .rsg or 
-    # .mbg dependencies in them.   The first line can sometimes not contain the target but  
-    # have a lonely "\" so we use a pattern to recognise the target line in order not to get confused. 
-    DEPENDENCY_CORRECTOR:={ $(GNUGREP) -E " ([^ /]+)\.((rsg)|(mbg))" | $(GNUSED) -r 's%([^ ]*\.[^rm ][^sb ][^g ])%%g;s%[\\ ]+% %g' | { DEPS=''; read L; while [ $$$$? -eq 0 ]; do DEPS="$$$${DEPS} $$$$L"; read L; done; DEPTXT="$$$$RPP: \\\\\n"; DEPCOUNT=0; for i in $$$${DEPS}; do DEPTXT="$$$$DEPTXT \$$$$(EPOCROOT)/epoc32/include/$$$$i \\\\\n"; (( DEPCOUNT += 1 )) ; done; if [ $$$$DEPCOUNT -ne 0 ]; then  echo -e "$$$${DEPTXT%%\\\\\\n}\n"; fi ; } ; }
+    # The strategy is filter lines which don't have .rsg or 
+    # .mbg dependencies in them and if to sift eah line to leave out non-relevant things like
+    # other header files, .hrh files etc.  In the end we 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;}'  |  \
+    { \
+    DEPTXT="$$$$RPP: \\\\\n"; \
+    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 \\\\\n"; \
+            (( DEPCOUNT += 1 )) ; \
+          fi; \
+        done; \
+      read L; \
+    done; \
+    if [ $$$$DEPCOUNT -ne 0 ]; then  echo -e "$$$${DEPTXT%%\\\\\\n}\n"; fi ;\
+  } ;\
+} 
+endef
+
 else
     # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default
     DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
@@ -205,13 +226,12 @@
 ###############################################################################
 define copyresource
 # $(1) is the source
-# $(2) is the destination
+# $(2) is the space separated list of destinations which must be filenames
 
    RELEASABLES:=$$(RELEASABLES) $(2)
+
    $(if $(TARGET_$(call sanitise,$2)),,$(eval TARGET_$(call sanitise,$2):=1)$(info <copy source='$1'>$2</copy>))
  
-
-
 endef # copyresource #
 
 ###############################################################################
@@ -260,7 +280,7 @@
 # $(2) is the preprocessed resource to make it from
 # $(3) is the language to use	(eg. sc)
 
-		RELEASABLES:= $$(RELEASABLES) $(1)
+        RELEASABLES:= $$(RELEASABLES) $(1)
 
         ifeq ($(TARGET_$(call sanitise,$1)),)
                 TARGET_$(call sanitise,$1):=1
--- a/sbsv2/raptor/python/filter_list.py	Mon Apr 26 17:33:17 2010 +0100
+++ b/sbsv2/raptor/python/filter_list.py	Wed Apr 28 01:01:42 2010 +0100
@@ -81,6 +81,7 @@
 		# Find all the filter plugins
 		self.pbox = pbox
 		possiblefilters = self.pbox.classesof(filter_interface.Filter)
+
 		filterdict = {}
 		for p in possiblefilters:
 			name = p.__name__.lower()
@@ -94,7 +95,7 @@
 		for f in filternames:
 			found = False
 			if f.lower() in filterdict:
-				self.filters.append(filterdict[f.lower()])
+				self.filters.append(filterdict[f.lower()]())
 			else:
 				unfound.append(f)
 
--- a/sbsv2/raptor/python/plugins/filter_copyfile.py	Mon Apr 26 17:33:17 2010 +0100
+++ b/sbsv2/raptor/python/plugins/filter_copyfile.py	Wed Apr 28 01:01:42 2010 +0100
@@ -56,7 +56,7 @@
 	def summary(self):
 		"finish off"
 		for source in self.files.keys():
-			print "<debug>self.files %s</debug>" % self.files[source]
+			#print "<debug>self.files %s</debug>" % self.files[source]
 			for dest in self.files[source]:
 				self.copyfile(source, dest)
 		
@@ -111,7 +111,6 @@
 
 		except Exception,e:
 			message = "Could not export " + source_str + " to " + dest_str + " : " + str(e)
-			print message
 
 		return 
 	
--- a/sbsv2/raptor/test/smoke_suite/sysdef_layers.py	Mon Apr 26 17:33:17 2010 +0100
+++ b/sbsv2/raptor/test/smoke_suite/sysdef_layers.py	Wed Apr 28 01:01:42 2010 +0100
@@ -82,8 +82,8 @@
 		"helloworld_reg_exe/helloworld_reg_sc.rpp"
 		])
 	t.countmatch = [
-		["<recipe .*layer='Component with Layer Dependencies' component='dependent'.*>", 38],
-		["<recipe .*layer='Build Generated Source' component='build generated source'.*>", 8]		
+		["<recipe .*layer='Component with Layer Dependencies' component='dependent'.*>", 35],
+		["<recipe .*layer='Build Generated Source' component='build generated source'.*>", 5]		
 		]
 	t.run()
 	return t