Add tools to create file tree deltas and integrate them into build f/w
authorShabeR@UK-SHABER
Tue, 14 Apr 2009 17:44:14 +0100
changeset 39 9edae8fe1416
parent 38 c7be4c65f97e
child 40 54444a2ae2db
Add tools to create file tree deltas and integrate them into build f/w
common/build.xml
common/tools/difflist.pl
common/tools/listdir.pl
sf-platform/build.xml
--- a/common/build.xml	Thu Apr 09 15:12:09 2009 +0100
+++ b/common/build.xml	Tue Apr 14 17:44:14 2009 +0100
@@ -114,6 +114,28 @@
         <move file="${temp.log.zip}" todir="${build.log.dir}" failonerror="false"/>		
     </target>
 	
+	<!-- generate dir list using passed location and name 
+	if a baseline list is available then generate deltas too -->
+	
+	<target name="sf-list-dir">
+		<property name="sf.currentlist.name" value="${sf.list.name}"/>
+		<property name="sf.dir.location" value="${build.drive}/epoc32"/> 
+    
+		<exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist.name}.log">
+			<arg value="${sf.common.config.dir}/tools/listdir.pl"/>
+			<arg value="${sf.dir.location}"/>
+		</exec>
+		
+		<if><available file="${build.log.dir}/listdir_${build.id}_baseline.log"/>
+		<then>
+			<exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist.name}_delta.log">
+				<arg value="${sf.common.config.dir}/tools/difflist.pl"/>
+				<arg value="${build.log.dir}/listdir_${build.id}_baseline.log"/>
+				<arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist.name}.log"/>
+			</exec>
+		</then>
+		</if>
+	</target>
 	
     <target name="sf-build-noprep" depends="sf-compile">
         <echo>[SF-BUILD-NOPREP]</echo>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/difflist.pl	Tue Apr 14 17:44:14 2009 +0100
@@ -0,0 +1,35 @@
+#! perl -w
+use strict;
+
+my $element;
+my @union = ();
+my @intersection = ();
+my @difference = ();
+my %count = ();
+
+my $file1 = shift or die "Usage: $0 file1 file2\n";
+my $file2 = shift or die "Usage: $0 file1 file2\n";
+
+open FILE1, "<$file1" or die "ERROR: Can't read $file1";
+open FILE2, "<$file2" or die "ERROR: Can't read $file2";
+
+my @file1_content = <FILE1>;
+my @file2_content = <FILE2>;
+
+close FILE1;
+close FILE2;
+
+print "* Comparing $file1 and $file2\n";
+foreach $element (@file1_content, @file2_content) { $count{$element}++ }
+foreach $element (keys %count) {
+    push @union, $element;
+    push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element;
+}
+
+if (@difference > 0) {
+    foreach (@difference){
+        print $_;
+    }
+} else {
+    print "* Files are identical\n";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/listdir.pl	Tue Apr 14 17:44:14 2009 +0100
@@ -0,0 +1,38 @@
+#!perl -w
+use strict;
+
+my $dir      = shift or die "Usage: $0 <dir> \n";   #  provided dir to traverse
+my $filelist = [];
+
+# fwd declaration to prevent warning
+sub recursedir($$);
+
+# run recurse and print
+recursedir ($dir, $filelist);
+print $_, "\n" for(@$filelist);
+
+sub recursedir($$) {
+
+  my $dir  = shift @_;
+  my $list = shift @_;
+
+  if(opendir(DIR, "$dir")) {
+    #  list dir
+    for my $file(grep { !/^\./ } readdir DIR) {
+      if(-d "$dir\\$file") {
+        #  traverse subdirs
+        recursedir("$dir\\$file", $list);
+      }
+      elsif(-f "$dir\\$file") {
+        #  if file then swap (any present) fwd to bkslash and add to list        
+        $dir   =~s/\//\\/;
+        $file  =~s/\//\\/;
+        push @$list, "$dir\\$file";
+      }
+    }
+    closedir DIR;
+  }
+  else {
+    warn "Cannot open the directory '$dir' $!\n";
+  }
+}
--- a/sf-platform/build.xml	Thu Apr 09 15:12:09 2009 +0100
+++ b/sf-platform/build.xml	Tue Apr 14 17:44:14 2009 +0100
@@ -79,7 +79,7 @@
 	   <!-- split builds currently generate layer sysdef from original -->
 	   <if><istrue value="${sf.spec.splitbuild}"/>
        <then>
-           <hlm:compileGenxmlFilterMacro xmlns:hlm="http://www.nokia.com/helium" input="${canonical.sysdef.file}" filter="raptor_${sysdef.configuration}" output="${build.output.dir}/build/canonical_system_definition_${sysdef.configuration}_temp.xml"/ >
+           <hlm:compileGenxmlFilterMacro xmlns:hlm="http://www.nokia.com/helium" input="${canonical.sysdef.file}" filter="raptor_${sysdef.configuration}" output="${build.output.dir}/build/canonical_system_definition_${sysdef.configuration}_temp.xml"/>
 	   </then>
 	   <else>
 	       <!-- but all we want is a sysdef with the config name appended, so just copy it -->
@@ -179,17 +179,26 @@
         <hlm:sbsMakeOptions engine="gmake" id="sbs.toolsbuild.options" />
         <hlm:sbsMakeOptions engine="gmake" id="sbs.fullbuild.options" />
 
-		<!-- OS clean tools2 build first>
+		<!-- generate baseline dir list to allow delta creation -->
+		<antcall target="sf-list-dir" inheritAll="false">
+			<param name="sf.list.name" value="baseline"/>
+		</antcall>
+
+		<!-- OS clean main build -->
         <antcall target="compile-main" inheritAll="false" inheritRefs="true">
                 <param name="build.system" value="${sf.spec.build.system}" />
                 <param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
                 <param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
                 <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
-                <reference refid="sbs.tools2.clean.var" torefid="sbs.var" />
-                <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
+                <reference refid="sbs.main.clean.sbs.var" torefid="sbs.var" />
+                <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
                 <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
-        </antcall-->
-
+        </antcall>
+		
+		<antcall target="sf-list-dir" inheritAll="false">
+			<param name="sf.list.name" value="post-clean"/>
+		</antcall>
+		
         <!-- OS tools2 build first-->
         <antcall target="compile-main" inheritAll="false" inheritRefs="true">
                 <param name="build.system" value="${sf.spec.build.system}" />
@@ -201,16 +210,9 @@
                 <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
         </antcall>
 
-		<!-- OS clean tools build after tools2>
-        <antcall target="compile-main" inheritAll="false" inheritRefs="true">
-                <param name="build.system" value="${sf.spec.build.system}" />
-                <param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
-                <param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
-                <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
-                <reference refid="sbs.tools.clean.var" torefid="sbs.var" />
-                <reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
-                <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
-        </antcall-->
+		<antcall target="sf-list-dir" inheritAll="false">
+			<param name="sf.list.name" value="post-build-tools2"/>
+		</antcall>
 
         <!-- OS tools build after tools2 -->
         <antcall target="compile-main" inheritAll="false" inheritRefs="true">
@@ -223,17 +225,10 @@
                 <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
         </antcall>
 
-		<!-- OS clean main build -->
-        <antcall target="compile-main" inheritAll="false" inheritRefs="true">
-                <param name="build.system" value="${sf.spec.build.system}" />
-                <param name="compile.sysdef.dtd.stub" value="${sf.spec.os.sysdef.dtd}" />
-                <param name="sysdef.configurations.list" value="${sf.spec.os.sysdef.clean.configurations.list}" />
-                <param name="sf.spec.sysdef.version" value ="${sf.spec.os.sysdef.version}"/>
-                <reference refid="sbs.main.clean.sbs.var" torefid="sbs.var" />
-                <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
-                <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
-        </antcall>
-
+		<antcall target="sf-list-dir" inheritAll="false">
+			<param name="sf.list.name" value="post-build-tools"/>
+		</antcall>
+		
         <!-- OS main build -->
         <antcall target="compile-main" inheritAll="false" inheritRefs="true">
                 <param name="build.system" value="${sf.spec.build.system}" />
@@ -244,6 +239,10 @@
                 <reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
                 <reference refid="sf.spec.os.system.definition.files" torefid="system.definition.files" />
         </antcall>
+		
+		<antcall target="sf-list-dir" inheritAll="false">
+			<param name="sf.list.name" value="post-build-main"/>
+		</antcall>
   </target>
 
   <!--
@@ -283,27 +282,11 @@
     		<hlm:sbsMakeOptions engine="gmake" id="sbs.toolsbuild.options" />
     		<hlm:sbsMakeOptions engine="gmake" id="sbs.fullbuild.options" />
 
-            <!-- s60 clean tools build>
-    		<antcall target="compile-main" inheritAll="false" inheritRefs="true">
-          			<param name="build.system" value="${sf.spec.build.system}" />
-          			<param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
-                    <param name="sf.spec.sysdef.version" value ="${sf.spec.s60.sysdef.version}"/>
-          			<reference refid="sbs.tools.clean.var" torefid="sbs.var" />
-          			<reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
-          			<reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
-    		</antcall-->
-
-            <!-- s60  tools build -->
-    		<antcall target="compile-main" inheritAll="false" inheritRefs="true">
-          			<param name="build.system" value="${sf.spec.build.system}" />
-          			<param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
-                <param name="sf.spec.sysdef.version" value ="${sf.spec.s60.sysdef.version}"/>
-          			<reference refid="sbs.tools.var" torefid="sbs.var" />
-          			<reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
-          			<reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
-    		</antcall>
-
-	        <!-- s60 clean main build -->
+		<antcall target="sf-list-dir" inheritAll="false">
+			<param name="sf.list.name" value="pre-s60-clean"/>
+		</antcall>	        
+		
+			<!-- s60 clean main build -->
     		<antcall target="compile-main" inheritAll="false" inheritRefs="true">
           			<param name="build.system" value="${sf.spec.build.system}" />
           			<param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
@@ -313,6 +296,24 @@
           			<reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
     		</antcall>
 
+			<antcall target="sf-list-dir" inheritAll="false">
+				<param name="sf.list.name" value="post-s60-clean"/>
+			</antcall>
+
+            <!-- s60  tools build -->
+    		<antcall target="compile-main" inheritAll="false" inheritRefs="true">
+          			<param name="build.system" value="${sf.spec.build.system}" />
+          			<param name="sysdef.configurations.list" value="${sf.spec.s60.sysdef.clean.configurations.list}" />
+					<param name="sf.spec.sysdef.version" value ="${sf.spec.s60.sysdef.version}"/>
+          			<reference refid="sbs.tools.var" torefid="sbs.var" />
+          			<reference refid="sbs.toolsbuild.options" torefid="sbs.make.options" />
+          			<reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
+    		</antcall>
+
+			<antcall target="sf-list-dir" inheritAll="false">
+				<param name="sf.list.name" value="post-s60-build-tools"/>
+			</antcall>
+
     		<!-- s60 main build -->
     		<antcall target="compile-main" inheritAll="false" inheritRefs="true">
           			<param name="build.system" value="${sf.spec.build.system}" />
@@ -322,7 +323,12 @@
           			<reference refid="sbs.fullbuild.options" torefid="sbs.make.options" />
           			<reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
     		</antcall>
+			
+			<antcall target="sf-list-dir" inheritAll="false">
+				<param name="sf.list.name" value="post-s60-build-main"/>
+			</antcall>
 
+			
     		<!-- s60 postbuild bldmelast using ebs -->
     		<antcall target="compile-main" inheritAll="false">
           			<param name="build.system" value="ebs" />
@@ -330,6 +336,10 @@
           			<reference refid="sf.spec.s60.system.definition.files" torefid="system.definition.files" />
     		</antcall>
 
+			<antcall target="sf-list-dir" inheritAll="false">
+				<param name="sf.list.name" value="post-s60-bldmelast"/>
+			</antcall>
+
 	</target>
 
   <!-- import sf-common-config -->