merge fix for Helium 9
authorandy simpson <andrews@symbian.org>
Tue, 17 Aug 2010 12:55:12 +0100
changeset 1212 84ea622a5ffb
parent 1210 9a976c4078e9 (diff)
parent 1211 fc57c9119823 (current diff)
child 1222 bab49adcb0d3
merge fix for Helium 9
common/build.xml
--- a/common/build.postbuild.xml	Mon Aug 09 12:38:30 2010 +0100
+++ b/common/build.postbuild.xml	Tue Aug 17 12:55:12 2010 +0100
@@ -76,6 +76,13 @@
             </then>
         </if>
 
+        <!-- Launch package tests -->
+        <if><istrue value="${sf.spec.package.test.enable}"/>
+            <then>
+                <runtarget target="sf-test-package"/>
+            </then>
+        </if>
+
         <!-- copy log files linked to the generation of roms for REE -->
         <runtarget target="sf-copy-rom-logs"/>
 
--- a/common/build.xml	Mon Aug 09 12:38:30 2010 +0100
+++ b/common/build.xml	Tue Aug 17 12:55:12 2010 +0100
@@ -472,24 +472,28 @@
     
     <target name="sf-get-source" depends="sf-generate-source-spec">
         <stopwatch name="sf-get-source"/>
-        <!-- Get test manifest, and move resolved csv so that it doesnt conflict with source-spec.ant.xml -->
         <if>
-            <istrue value="${sf.spec.smoketest.enable}"/>
+            <istrue value="${sf.spec.sourcesync.enable}"/>
             <then>
-                <ant antfile="${temp.build.dir}/source-test-spec.ant.xml" />
-                <move file="${build.drive}/output/logs/BOM/sources.csv" tofile="${build.drive}/output/logs/BOM/sources_test.csv"/>
+                <!-- Get test manifest, and move resolved csv so that it doesnt conflict with source-spec.ant.xml -->
+                <if>
+                    <available file="${temp.build.dir}/source-test-spec.ant.xml"/>
+                    <then>
+                        <ant antfile="${temp.build.dir}/source-test-spec.ant.xml" />
+                        <move file="${build.drive}/output/logs/BOM/sources.csv" tofile="${build.drive}/output/logs/BOM/sources_test.csv"/>
+                    </then>
+                </if>
+        
+                <if><available file="${temp.build.dir}/source-rnd-spec.ant.xml"/>
+                    <then>
+                        <ant antfile="${temp.build.dir}/source-rnd-spec.ant.xml" />
+                        <move file="${build.drive}/output/logs/BOM/sources.csv" tofile="${build.drive}/output/logs/BOM/sources_rnd.csv"/>
+                    </then>
+                </if>
+                
+                <ant antfile="${temp.build.dir}/source-spec.ant.xml" />
             </then>
         </if>
-
-
-        <if><available file="${temp.build.dir}/source-rnd-spec.ant.xml"/>
-          <then>
-              <ant antfile="${temp.build.dir}/source-rnd-spec.ant.xml" />
-              <move file="${build.drive}/output/logs/BOM/sources.csv" tofile="${build.drive}/output/logs/BOM/sources_rnd.csv"/>
-          </then>
-        </if>
-        
-        <ant antfile="${temp.build.dir}/source-spec.ant.xml" />
         <stopwatch name="sf-get-source" action="elapsed"/>
     </target>
     
@@ -531,29 +535,23 @@
         <!-- TODO: 2. Change fmpp data to be a full property rather than relative path -->
         <delete file="${temp.build.dir}/source-spec.ant.xml"/>
         
-        <property name="sf.test.csv.file" value="nul:"/>
-        
-        <if>
-            <istrue value="${sf.spec.sourcesync.enable}" />
+        <property name="sf.source.csv.file" value="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
+        <if><available file="${sf.source.csv.file}"/>
             <then>
-                <property name="sf.source.csv.file" value="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
-                <property name="sf.source_rnd.csv.file" value="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile.rnd}"/>
+                <fmpp sourceFile="${sf.common.config.dir}/templates/source-spec.ant.xml.ftl"
+                      outputFile="${temp.build.dir}/source-spec.ant.xml">
+                    <data expandProperties="yes">
+                        ant: antProperties()
+                        data: [
+                            csv(${sf.source.csv.file}, {separator:','})
+                        ]
+                    </data>
+                </fmpp>
             </then>
         </if>
-        <property name="sf.source.csv.file"     value="nul:"/>
-        <property name="sf.source_rnd.csv.file" value="nul:"/>
 
-        <fmpp sourceFile="${sf.common.config.dir}/templates/source-spec.ant.xml.ftl"
-              outputFile="${temp.build.dir}/source-spec.ant.xml">
-              <data expandProperties="yes">
-                    ant: antProperties()
-                    data: [
-                        csv(${sf.source.csv.file}, {separator:','})
-                    ]
-              </data>
-        </fmpp>
-		
-        <if><available file="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile.rnd}"/>
+        <property name="sf.source_rnd.csv.file" value="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile.rnd}"/>
+        <if><available file="${sf.source_rnd.csv.file}"/>
           <then>
             <fmpp sourceFile="${sf.common.config.dir}/templates/source-spec.ant.xml.ftl"
                   outputFile="${temp.build.dir}/source-rnd-spec.ant.xml">
@@ -566,8 +564,10 @@
             </fmpp>
           </then>
         </if>
+
+        <property name="sf.test.csv.file" value="nul:"/>
         <if>
-            <istrue value="${sf.spec.smoketest.enable}"/>
+            <available file="${sf.test.csv.file}"/>
             <then>
             <fmpp sourceFile="${sf.common.config.dir}/templates/source-spec.ant.xml.ftl"
                   outputFile="${temp.build.dir}/source-test-spec.ant.xml">
@@ -710,21 +710,21 @@
     </target>
 
     <target name="sf-preprocess-package-config">
-	<!-- preprocess by stripping the header of the rnd source and concat with sources.csv -->
-    <loadfile srcfile="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile.rnd}" property="rnd.source.no.header" failonerror="false">
-    <filterchain>
-      <headfilter skip="1"/>
-    </filterchain>
-    </loadfile>
-    <echo message="${rnd.source.no.header}" file="${temp.build.dir}/sources_rnd_no_header.csv"/>
-    
-    <!-- order is important as the rnd source now has no header -->
-    <concat destfile="${temp.build.dir}/sources.csv" force="yes">
-       <file file="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
-       <file file="${temp.build.dir}/sources_rnd_no_header.csv"/>
-    </concat>
+        <!-- preprocess by stripping the header of the rnd source and concat with sources.csv -->
+        <loadfile srcfile="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile.rnd}" property="rnd.source.no.header" failonerror="false">
+            <filterchain>
+                <headfilter skip="1"/>
+            </filterchain>
+        </loadfile>
+        <echo message="${rnd.source.no.header}" file="${temp.build.dir}/sources_rnd_no_header.csv"/>
 
-    <echo message="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
+        <!-- order is important as the rnd source now has no header -->
+        <concat destfile="${temp.build.dir}/sources.csv" force="yes">
+           <file file="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
+           <file file="${temp.build.dir}/sources_rnd_no_header.csv"/>
+        </concat>
+
+        <echo message="${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
         <exec executable="perl" dir="${build.drive}/" failonerror="false" output="${build.log.dir}/zipconfig.log">
             <arg value="${sf.common.config.dir}/tools/populateziptemplate.pl"/>
             <arg value="${temp.build.dir}/sources.csv"/>
@@ -818,7 +818,7 @@
     <!-- Unpack the rnd zips ready to be used in the build -->
     <target name="sf-unpack-rnd">
         <echo message="INFO Unpacking any available RnD binaries"/>
-		<mkdir dir="${build.drive}/output/zips/"/>
+        <mkdir dir="${build.drive}/output/zips/"/>
         <for param="rndZip">
             <fileset dir="${build.drive}/output/zips/">
                 <include name="binaries_*.zip"/> <!-- Internal rnd bins -->
--- a/common/common_props.ant.xml	Mon Aug 09 12:38:30 2010 +0100
+++ b/common/common_props.ant.xml	Tue Aug 17 12:55:12 2010 +0100
@@ -132,6 +132,9 @@
 	
 	<!-- Smoketest properties -->
 	<property name="sf.spec.smoketest.enable" value="true"/> <!-- This disables publishing Smoke Test Report -->
+
+    <!-- Package tests properties -->
+    <property name="sf.spec.package.test.enable" value="false"/> <!-- This disables package tests -->
 </project>
 
 
--- a/common/templates/source-spec.ant.xml.ftl	Mon Aug 09 12:38:30 2010 +0100
+++ b/common/templates/source-spec.ant.xml.ftl	Tue Aug 17 12:55:12 2010 +0100
@@ -17,19 +17,19 @@
 <#list data as csv_file>
   <#list csv_file as pkg_detail>
     <target name="sf-prebuild-${count}">
-    	
-    	<!-- if defined the revision override take that as revision and change the url to point to FCL -->
-    	<if>
-    		<not><equals arg1="${ant['sf.spec.sources.revision']}" arg2="" trim="true"/></not>
-    		<then>
-    			<property name="sources.${count}.revision" value="${ant['sf.spec.sources.revision']}"/>
-    			<propertyregex property="sources.${count}.URL" input="${pkg_detail.source}" regexp="/MCL/" casesensitive="false" replace="/FCL/" defaultValue="${pkg_detail.source}"/>
-    		</then>
-    		<else>
-    			<property name="sources.${count}.revision" value="${pkg_detail.pattern}"/>
-    			<property name="sources.${count}.URL" value="${pkg_detail.source}"/>
-    		</else>
-    	</if>
+        
+        <!-- if defined the revision override take that as revision and change the url to point to FCL -->
+        <if>
+            <not><equals arg1="${ant['sf.spec.sources.revision']}" arg2="" trim="true"/></not>
+            <then>
+                <property name="sources.${count}.revision" value="${ant['sf.spec.sources.revision']}"/>
+                <propertyregex property="sources.${count}.URL" input="${pkg_detail.source}" regexp="/MCL/" casesensitive="false" replace="/FCL/" defaultValue="${pkg_detail.source}"/>
+            </then>
+            <else>
+                <property name="sources.${count}.revision" value="${pkg_detail.pattern}"/>
+                <property name="sources.${count}.URL" value="${pkg_detail.source}"/>
+            </else>
+        </if>
         
         <!-- Create sf\layer dir on build dir -->
         <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
@@ -45,7 +45,7 @@
         </if>
         
         <!-- Convert source tag/branch to to changeset hash, in case it's a local tag on the server -->
-        <retry tries="10" uniquename="${count}">
+        <retry tries="10" uniquename="${count}" failonerror="false">
             <sequential>
                 <exec executable="hg" failonerror="true" output="${ant['temp.build.dir']}/sf.sourcesync.${count}.checksum" error="nul:">
                     <arg value="id"/>
@@ -58,6 +58,7 @@
                 <propertyregex property="sf.sourcesync.${count}.checksum" override="true" input="${dollar}{sf.sourcesync.${count}.checksum}" regexp="(\S{12})" select="\1"/>
             </sequential>
         </retry>
+        <fail unless="sf.sourcesync.${count}.checksum" message="Failed to get changeset ID for revision '${dollar}{sources.${count}.revision}' for repo ${dollar}{sources.${count}.URL}"/>
 
         <if>
             <and>
@@ -104,7 +105,7 @@
                             </if>
                         </forget>
                         <!-- In the meantime, by-pass it for this build -->
-                        <retry tries="30" uniquename="${count}">
+                        <retry tries="30" uniquename="${count}" failonerror="false">
                             <sequential>
                                 <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                                 <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
@@ -113,11 +114,13 @@
                                     <arg value="${dollar}{sources.${count}.URL}"/>
                                     <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
                                 </exec>
+                                <property name="sf.spec.sourcesync.cache.clone.succeeded.${count}" value="1"/>
                             </sequential>
                             <cleanup>
                                 <delete dir="${ant['build.drive']}${pkg_detail.dst}"/>
                             </cleanup>
                         </retry>
+                        <fail unless="sf.spec.sourcesync.cache.clone.succeeded.${count}" message="ERROR: Failed to clone ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                     </else>
                 </if>
                 <!-- Update to required revision -->
@@ -129,7 +132,7 @@
             </then>
             <else>
                 <!-- Package not in cache, or cache not in use -->
-                <retry tries="10" uniquename="${count}">
+                <retry tries="10" uniquename="${count}" failonerror="false">
                     <sequential>
                         <echo message="Clone from ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                         <exec executable="hg" dir="${ant['build.drive']}/" failonerror="true">
@@ -138,11 +141,13 @@
                             <arg value="${dollar}{sources.${count}.URL}"/>
                             <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
                         </exec>
+                        <property name="sf.spec.sourcesync.cache.clone.succeeded.${count}" value="1"/>
                     </sequential>
                     <cleanup>
                         <delete dir="${ant['build.drive']}${pkg_detail.dst}"/>
                     </cleanup>
                 </retry>
+                <fail unless="sf.spec.sourcesync.cache.clone.succeeded.${count}" message="ERROR: Failed to clone ${dollar}{sources.${count}.URL} to ${ant['build.drive']}${pkg_detail.dst}"/>
                 <!-- Update to required version -->
                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="true">
                     <arg value="update"/>
@@ -152,25 +157,24 @@
                 <if>
                     <isset property="sf.spec.sourcesync.cachelocation.${count}"/>
                     <then>
+                        <!-- Init cache -->
+                        <mkdir dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+                        <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true" />
+                        <echo message="Initialise cache at ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+                        <!-- Initialise an empty repo -->
+                        <exec executable="hg" dir="${ant['build.drive']}/" failonerror="false">
+                            <arg value="init"/>
+                            <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
+                        </exec>
+                        <!-- Configure the paths and the speed-up flag on the cache repo -->
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="false" message="[paths]${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="default = ${dollar}{sources.${count}.URL}${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="[server]${dollar}{line.separator}"/>
+                        <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="uncompressed=True${dollar}{line.separator}"/>
+                        <echo message="(Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background)"/>
                         <forget>
                             <nice newpriority="1"/>
-                            <!-- Init cache -->
-                            <mkdir dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
-                            <delete dir="${dollar}{sf.spec.sourcesync.cachelocation.${count}}" failonerror="true" />
-                            <echo message="Initialise cache at ${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
-                            <!-- Clone source to get the right default repo -->
-                            <exec executable="hg" dir="${ant['build.drive']}/" failonerror="false">
-                                <arg value="clone"/>
-                                <arg value="-r"/>
-                                <arg value="null"/>
-                                <arg value="${dollar}{sources.${count}.URL}"/>
-                                <arg value="${dollar}{sf.spec.sourcesync.cachelocation.${count}}"/>
-                            </exec>
-                            <!-- Set the speed-up flag on the cache repo -->
-                            <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="${dollar}{line.separator}"/>
-                            <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="[server]${dollar}{line.separator}"/>
-                            <echo file="${dollar}{sf.spec.sourcesync.cachelocation.${count}}/.hg/hgrc" append="true" message="uncompressed=True${dollar}{line.separator}"/>
-                            <echo message="Push from ${ant['build.drive']}${pkg_detail.dst} to ${dollar}{sf.spec.sourcesync.cachelocation.${count}} in background"/>
                             <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false">
                                 <arg value="push"/>
                                 <arg value="-f"/>
--- a/common/tools/ats/hlm_prep_package.pl	Mon Aug 09 12:38:30 2010 +0100
+++ b/common/tools/ats/hlm_prep_package.pl	Tue Aug 17 12:55:12 2010 +0100
@@ -14,85 +14,142 @@
 #   This is a script for fixing pkg and ini files.
 
 use strict;
+use Getopt::Long;
 use File::Copy;
 use Tie::File;
 use File::Find;
 
+my $package_path;
+my @pkg_paths; # Array needed as csv file may contain more than one.
+my $pkg_path_num = 1; # By default at least one needs to be provided.
+my $csv_file;
+my $bld_drive;
+my $line;
+my $help;
+my $repo;
+my $destination;
 my @files;
 my @ini_files;
 my @lines;
 my $file;
 my $n;
+my $current_iteration;
 my $file_fixed;
 sub Wanted;
 sub Parse_ini;
 
-my $package_path;
-if ($ARGV[0]) {
-  $package_path = $ARGV[0];
- }
-else { die "Missing parameter \"package path\". For example: D:\\sf\\app\\musicplayer"; }
+sub usage($);
+sub help();
+sub usage_error();
 
-find(\&Wanted, $package_path);
+my %optmap = (  'package-path' => \$package_path,
+			    'csv-file' => \$csv_file,
+				'bld-drive' => \$bld_drive,
+				'help' => \$help);
 
-#Copy a pkg file and replace \armv5\urel with $(platform)\$(target)
-foreach $file (@files) { #Replace "//v800020/Publish" with "http://cdn.symbian,org"
-	copy($file,$file . ".orig") or die ("Cannot copy file \"$file\". $!\n");
-	tie (@lines, 'Tie::File', $file, recsep => "\n") or die ("Cannot tie file \"$file\". $!\n");
-	$n = 0;
-	$file_fixed = 0;
-	print @lines[49] . "\n";
-	foreach (@lines) {
-		if (lc(@lines[$n]) =~ m/epoc32\\release\\armv5\\urel\\/) {
-			@lines[$n] = lc(@lines[$n]);
-			@lines[$n] =~ s/\\armv5\\urel\\/\\\$(platform)\\\$(target)\\/;
-			$file_fixed = 1;
-		}
-		if (lc(@lines[$n]) =~ m/epoc32\/release\/armv5\/urel\//) {
-			@lines[$n] = lc(@lines[$n]);
-			@lines[$n] =~ s/\/armv5\/urel\//\/\$(platform)\/\$(target)\//;
-			$file_fixed = 1;
-		}
-		if (lc(@lines[$n]) =~ m/epoc32\\release\\armv5\\udeb\\/) {
-			@lines[$n] = lc(@lines[$n]);
-			@lines[$n] =~ s/\\armv5\\udeb\\/\\\$(platform)\\\$(target)\\/;
-			$file_fixed = 1;
-		}
-#		if (lc(@lines[$n]) =~ m/e:\\/) { # Replace e: with c:
-#			@lines[$n] = lc(@lines[$n]);
-#			@lines[$n] =~ s/e:\\/c:\\/;
-#			$file_fixed = 1;
-#		}
-		$n++;
-	}
-	if ($file_fixed) { print $file . " fixed.\n"; }
-	untie @lines;
+GetOptions(\%optmap,
+          'package-path=s',
+          'csv-file=s',
+		  'bld-drive=s',
+		  'help!') 
+          or usage_error();
+
+if ($help) {
+	help();
 }
 
-find(\&Parse_ini, $package_path);
+usage_error(), unless ((defined($package_path)) || ((defined($csv_file)) && (defined($bld_drive))));
 
-foreach $file (@ini_files) {
-	if ((lc($file) =~ m/\/init\//) || (lc($file) =~ m/\/group\//)) { # Only operate on files from /init/ directories
+if (defined($csv_file)) {
+	$pkg_path_num = 0;
+	open FILE, "<$csv_file" or die("Failed to read $csv_file: $!\n");
+	while ($line = <FILE>)
+	{
+		chomp $line;
+		($repo,$destination) = split /,/,$line;
+		if ((lc($destination) ne "dst") && (lc($destination) ne "")) { 
+#			$package_path = $bld_drive . $destination;
+			push @pkg_paths, $bld_drive . $destination;
+			$pkg_path_num++;
+#			last; 
+		}
+		
+	}
+	close FILE;
+}
+
+$current_iteration = 0;
+while ($current_iteration < $pkg_path_num) {
+	if (defined($csv_file)) {
+		$package_path = @pkg_paths[$current_iteration];
+	}
+	print "Processing: $package_path \n";
+
+	find(\&Wanted, $package_path);
+
+	#Copy a pkg file and replace \armv5\urel with $(platform)\$(target)
+	foreach $file (@files) { #Replace "//v800020/Publish" with "http://cdn.symbian,org"
 		copy($file,$file . ".orig") or die ("Cannot copy file \"$file\". $!\n");
 		tie (@lines, 'Tie::File', $file, recsep => "\n") or die ("Cannot tie file \"$file\". $!\n");
 		$n = 0;
 		$file_fixed = 0;
 		foreach (@lines) {
-			if (lc(@lines[$n]) =~ m/^separateprocesses/) {
-				@lines[$n] = '#' . @lines[$n];
+			if (lc(@lines[$n]) =~ m/epoc32\\release\\armv5\\urel\\/) {
+				@lines[$n] = lc(@lines[$n]);
+				@lines[$n] =~ s/\\armv5\\urel\\/\\\$(platform)\\\$(target)\\/;
+				$file_fixed = 1;
+			}
+			if (lc(@lines[$n]) =~ m/epoc32\/release\/armv5\/urel\//) {
+				@lines[$n] = lc(@lines[$n]);
+				@lines[$n] =~ s/\/armv5\/urel\//\/\$(platform)\/\$(target)\//;
 				$file_fixed = 1;
 			}
-			if (lc(@lines[$n]) =~ m/^uitestingsupport/) {
-				@lines[$n] = '#' . @lines[$n];
+			if (lc(@lines[$n]) =~ m/epoc32\\release\\armv5\\udeb\\/) {
+				@lines[$n] = lc(@lines[$n]);
+				@lines[$n] =~ s/\\armv5\\udeb\\/\\\$(platform)\\\$(target)\\/;
 				$file_fixed = 1;
 			}
+#			if (lc(@lines[$n]) =~ m/e:\\/) { # Replace e: with c:
+#				@lines[$n] = lc(@lines[$n]);
+#				@lines[$n] =~ s/e:\\/c:\\/;
+#				$file_fixed = 1;
+#			}
 			$n++;
 		}
 		if ($file_fixed) { print $file . " fixed.\n"; }
 		untie @lines;
 	}
+
+	find(\&Parse_ini, $package_path);
+
+	foreach $file (@ini_files) {
+		if ((lc($file) =~ m/\/init\//) || (lc($file) =~ m/\/group\//)) { # Only operate on files from /init/ directories
+			copy($file,$file . ".orig") or die ("Cannot copy file \"$file\". $!\n");
+			tie (@lines, 'Tie::File', $file, recsep => "\n") or die ("Cannot tie file \"$file\". $!\n");
+			$n = 0;
+			$file_fixed = 0;
+			foreach (@lines) {
+				if (lc(@lines[$n]) =~ m/^separateprocesses/) {
+					@lines[$n] = '#' . @lines[$n];
+					$file_fixed = 1;
+				}
+				if (lc(@lines[$n]) =~ m/^uitestingsupport/) {
+					@lines[$n] = '#' . @lines[$n];
+					$file_fixed = 1;
+				}
+				$n++;
+			}
+			if ($file_fixed) { print $file . " fixed.\n"; }
+			untie @lines;
+		}
+	}
+
+	$current_iteration++;
 }
 
+print "OK\n";
+exit 0;
+
 sub Wanted {
     # only operate on .pkg files
 	/.pkg$/ or return;
@@ -103,4 +160,31 @@
     # only operate on .ini files
 	/\.ini$/ or return;
     push (@ini_files, $File::Find::name);
-}
\ No newline at end of file
+}
+
+sub usage($)
+{
+    my $error = shift;
+    my $fh = $error == 0 ? *STDOUT : *STDERR;
+    print $fh "hlm_prep_package.pl\n" .
+            "Specify package path or csv file\n" .
+            "synopsis:\n" .
+            "  hlm_prep_package.pl --help\n" .
+            "  hlm_prep_package.pl [--package-path=DIR] [--csv-file=FILE] [--bld-drive=DRIVE] \n" .
+            "options:\n" .
+            "  --help                        Display this help and exit.\n" .
+            "  --package-path=DIR            DIR is the package location, e.g. H:\\sf\\app\\musicplayer.\n" .
+            "  --csv-file=FILE               FILE is the full path to the csv file.\n" .
+            "  --bld-drive=DRIVE             DRIVE is the subst'd drive on which the build is stored.\n";
+    exit $error;            
+}
+
+sub help()
+{
+    usage(0);
+}
+
+sub usage_error()
+{
+    usage(1);
+}
--- a/sf-package/build.xml	Mon Aug 09 12:38:30 2010 +0100
+++ b/sf-package/build.xml	Tue Aug 17 12:55:12 2010 +0100
@@ -72,14 +72,43 @@
       </antcall>    
       </sequential>
     </for>
-    
+    <!-- build test code -->	
+    <if><istrue value="${sf.spec.package.test.enable}"/>
+        <then>
+            <for list="${sf.spec.sbs.config}" delimiter="," param="item.sbs.splitconfig">
+              <sequential>
+      
+              <hlm:sbsinput id="sf.build">
+                <sbsOptions>
+                    <arg line="-c @{item.sbs.splitconfig}.test"/>
+                    <arg line="-k" />
+                    <arg line="-j ${sf.spec.sbs.numberofjobs}"/>
+                    <arg line="-t ${sf.spec.sbs.retry.limit}"/>
+                    <arg line="${sf.spec.sbs.options}"/>
+                    <arg name="--filters" value="&quot;${sf.spec.sbs.filter.list}&quot;"/>
+                    <arg name="--logfile" value="${build.log.dir}/${build.id}_@{item.sbs.splitconfig}_compile.log" />
+                    <arg name="--makefile" value="${compile.log.dir}/${build.id}_@{item.sbs.splitconfig}_Makefile" />
+                </sbsOptions>
+              </hlm:sbsinput>
+      
+              <echo message="INFO [Iterative compile] Building target: @{item.sbs.splitconfig}"/>
+              <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.sysdef.configurations.list}" />
+                  <param name="sbs.inputs.list" value="sf.build"/>
+                  <reference refid="sf.spec.system.definition.files" torefid="system.definition.files" />
+              </antcall>    
+              </sequential>
+           </for>
+         </then>
+    </if>
     
     <!-- CHECK -->
     <exec executable="cmd" dir="${build.drive}/" output="${build.drive}/output\logs\build_check_compile.log">
       <arg value="/c sbs.bat -s ${build.drive}/output\build\canonical_system_definition_SF.xml -k -c tools2_rel -c winscw -c armv5 -j 32 --check -m ${build.drive}/output\logs\build_check_Makefile"/>
       <!-- argument of -j option can be parameterized with: ${number.of.threads} -->
     </exec>
-    
+   
   </target>
         
         
@@ -127,6 +156,49 @@
     </exec>
     
   </target>
+        
+        
+  <target name="sf-test-package">
+
+    <echo message="INFO Preparing package"/>
+    <exec executable="perl" dir="${sf.common.config.dir}/tools/ats/" failonerror="false" output="${build.log.dir}/ATS_${build.id}_prep_package.log">
+        <arg value="hlm_prep_package.pl"/>
+        <arg value="--csv-file=${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
+        <arg value="--bld-drive=${build.drive}"/>
+    </exec>
+  
+    <echo message="INFO Building package test drop(s)"/>
+<!--    <runtarget target="ats-test"/> --> <!-- Supported from Helium 9.0.5 onwards -->
+    <echo message="INFO Skipped - Helium 9.0.5+ required"/>
+	
+    <for param="file">
+        <path>
+            <fileset dir="${build.drive}/output/ats" includes="*.zip"/>
+        </path>
+        <sequential>
+            <propertyregex override="yes" property="program"  input="@{file}" regexp="([^\\/\/]*)$" select="\1"/>  						
+            <echo message="INFO Updating package test drop with test info"/>
+            <echo message="************ Test drop name:  ${program} " />
+            <exec executable="perl" dir="${sf.common.config.dir}/tools/ats/" failonerror="false" append="true" output="${build.log.dir}/ATS_${build.id}_packagetest.log">
+                <arg value="ats_specialise_test_drop.pl"/>
+                <arg value="--test-drop-name=${env.COMPUTERNAME}-packagetest-${build.id}_${program}"/> 
+                <arg value="--host-name=${env.COMPUTERNAME}.ad-sfpd.intra"/>
+                <arg value="--src=${build.drive}/output/ats/${program}"/>
+                <arg value="--dest=${sf.spec.test.package.location}\${env.COMPUTERNAME}-packagetest-${build.id}_${program}" />
+                <arg value="--publish=${publish.dir}\ats_reports\${program}"/>
+                <arg value="--ats-version=ats4"/> <!-- Hard-coded ats-version as Test Drop Generator for WINSCW supports only ATS4 -->
+            </exec>
+            <!-- Now ready to send to ATS -->  
+            <echo message="Sending test drop :  ${program} ............" />
+            <antcall target="sf-send-testpkg" inheritAll="false">
+                <param name="sf.spec.test.package.name" value="${env.COMPUTERNAME}-packagetest-${build.id}_${program}"/>
+            </antcall>
+        </sequential>
+    </for>
+
+  </target>
+
+  <target name="ats-emulator-zip"/> <!-- This is to override exisiting Helium target called from ats-test -->
   
 </project>
 
--- a/sf-package/package_props.ant.xml	Mon Aug 09 12:38:30 2010 +0100
+++ b/sf-package/package_props.ant.xml	Tue Aug 17 12:55:12 2010 +0100
@@ -34,5 +34,17 @@
   <!-- Enable qmake processing for any units with proFile attributes -->
   <property name="qmake.enabled" value="true"/>
 
+  <!-- Properties used to generate ATS test drop -->
+  <property name="enabled.ats" value="true"/>
+  <property name="ats4.enabled" value="true"/>
+  <property name="ats.emulator.enable" value="true"/>
+  <property name="ats.product.name" value="MY_AGENT_NAME"/> <!-- Agent name will be replaced later while specialising test drop -->
+  <property name="ats.email.list" value="user@symbian.org"/>
+  <property name="ats.flash.images" value=""/> <!-- This should be changed in order to generate a test drop for armv5 devices -->
+  <property name="ats.target.platform" value="winscw udeb"/>
+  <property name="skip.ats.sending" value="true"/> <!-- Test drop will be sent using a separate target -->
+  <property name="ats.testrun.name" value="Package tests"/>
+  <property name="ats.test.timeout" value="3600"/>
+  
 </project>
 
--- a/sf-platform/build.xml	Mon Aug 09 12:38:30 2010 +0100
+++ b/sf-platform/build.xml	Tue Aug 17 12:55:12 2010 +0100
@@ -66,7 +66,7 @@
 
     <!-- turn comma separated list into sbs friendly -c list, and _ separated list for friendly log names -->
     <propertyregex property="i.sf.spec.sbs.config.expanded"         override="true" input="${sf.spec.sbs.config}" regexp="(,)" replace=" -c " defaultValue="${sf.spec.sbs.config}" global="true"  casesensitive="false"/>
-    <propertyregex property="i.sf.spec.sbs.tools.config.expanded"   override="true" input="${sf.spec.sbs.tools.config}" regexp="(,)" replace=" -c " defaultValue="${sf.spec.sbs.config}" global="true"  casesensitive="false"/>
+    <propertyregex property="i.sf.spec.sbs.tools.config.expanded"   override="true" input="${sf.spec.sbs.tools.config}" regexp="(,)" replace=" -c " defaultValue="${sf.spec.sbs.tools.config}" global="true"  casesensitive="false"/>
 
     <echo message="INFO Target : ${i.sf.spec.sbs.config.expanded} ${i.sf.spec.sbs.tools.config.expanded}"/>