Adding truclean step to the package build
authorDario Sestito <darios@symbian.org>
Wed, 08 Jul 2009 17:49:33 +0100
changeset 225 5705f5c8f10d
parent 224 a237fdfca8c5
child 226 c451bd0c0782
Adding truclean step to the package build
common/build.xml
common/common_props.ant.xml
common/templates/truclean.ant.xml.ftl
common/tools/raptor/truclean.pl
sf-package/package_props.ant.xml
--- a/common/build.xml	Tue Jun 30 17:20:00 2009 +0100
+++ b/common/build.xml	Wed Jul 08 17:49:33 2009 +0100
@@ -433,7 +433,7 @@
         </if>
     </target>
 
-    <target name="sf-build-noprep" depends="sf-compile,sf-postbuild">
+    <target name="sf-build-noprep" depends="sf-truclean,sf-compile,sf-postbuild">
         <echo>[SF-BUILD-NOPREP]</echo>
     </target>
     
@@ -451,7 +451,27 @@
         </if>
     </target>
     
-    <target name="sf-compile">    
+  <target name="sf-truclean">
+    <if>
+      <istrue value="${sf.spec.build.clean.enable}"/>
+      <then>
+        <echo message="Executing truclean step."/>
+        <fmpp sourceFile="${sf.common.config.dir}/templates/truclean.ant.xml.ftl"
+            outputFile="${sf.common.config.dir}/generated/truclean.ant.xml">
+          <data expandProperties="yes">
+              ant: antProperties()
+              data: csv(${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
+          </data>
+        </fmpp>
+        <ant antfile="${sf.common.config.dir}/generated/truclean.ant.xml"/>
+      </then>
+      <else>
+        <echo message="Skipping truclean step."/>
+      </else>
+    </if>
+  </target>
+    
+    <target name="sf-compile">
         <!-- TODO: add here assigments to raptor-related ant references -->
     
         <!-- hlm:argSet id="sbs.tools.var">
--- a/common/common_props.ant.xml	Tue Jun 30 17:20:00 2009 +0100
+++ b/common/common_props.ant.xml	Wed Jul 08 17:49:33 2009 +0100
@@ -26,7 +26,7 @@
     <property name="sf.spec.build.system" value="sbs"/> <!-- sbs|ebs|ec -->
     <!-- property name="sf.spec.build.sbsv2.config" value=""/ -->
     <!-- property name="sf.spec.build.sbsv2.options" value="-k"/ -->
-    <property name="sf.spec.build.clean.enable" value="true"/>
+    <property name="sf.spec.build.clean.enable" value="false"/>
     <property name="sf.spec.sysdef.configurations.list" value="s60_build,s60_bldmelast"/>
     
     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/templates/truclean.ant.xml.ftl	Wed Jul 08 17:49:33 2009 +0100
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<project name="SF-TRUCLEAN" default="all" xmlns:hlm="http://www.nokia.com/helium">
+
+<#assign target_depends=""/>
+<#assign count=0/>
+<#assign dollar="$"/>
+
+<#list data as pkg_detail>
+<target name="sf-truclean-${count}">
+  <sequential>
+    <propertyregex override="yes" property="package"  input="${pkg_detail.dst}" regexp=".*sf[\\\/]([^\\^\/]+)[\\\/]([^\\^\/]+)" replace="\1/\2"/>
+    <echo message="Calling truclean script for package ${dollar}{package}"/>
+      <exec executable="perl" dir="${ant['build.drive']}/" failonerror="false" output="${ant['build.log.dir']}/truclean.log">
+        <arg value="${ant['sf.common.config.dir']}/tools/raptor/truclean.pl"/>
+        <arg value="--packageexpr=${dollar}{package}"/>
+        <arg value="--deliverablesdir=${ant['build.drive']}/build_info/logs/deliverables"/>
+      </exec>
+  </sequential>
+</target>
+  
+  <#if (count==0)>
+    <#assign target_depends="${target_depends}"+"sf-truclean-${count}"/>
+  </#if>
+  <#if (count>0)>
+    <#assign target_depends="${target_depends}"+","+"sf-truclean-${count}"/>
+  </#if>
+  <#assign count=count+1/>
+</#list>
+
+<target name="all" depends="${target_depends}"/>
+
+</project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/raptor/truclean.pl	Wed Jul 08 17:49:33 2009 +0100
@@ -0,0 +1,110 @@
+# Copyright (c) 2009 Symbian Foundation Ltd
+# 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:
+# Symbian Foundation Ltd - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Extracts output text in <buildlog> context which doesn't belong to <recipe>'s
+
+use strict;
+use Getopt::Long;
+
+my $DELIVERABLES_DIR = "/deliverables";
+
+my $deliverablesdir = "";
+my $packageexpr = '';
+my $help = 0;
+GetOptions((
+	'packageexpr:s' => \$packageexpr,
+	'deliverablesdir:s' => \$DELIVERABLES_DIR,
+	'help!' => \$help
+));
+
+$packageexpr =~ m,([^/^\\]+)[/\\]([^/^\\]+),;
+my $layer_expr = $1;
+my $package_expr = $2;
+$help = 1 if (!$layer_expr or !$package_expr);
+
+if ($help)
+{
+	print "Extracts text which doesn't belong to recipes from a raptor log file\n";
+	print "Usage: perl truclean.pl --packageexpr=LAYER_EXPR/PACKAGE_EXPR [OPTIONS]\n";
+	print "where:\n";
+	print "\tLAYER_EXPR can be * or the name of a layer\n";
+	print "\tPACKAGE_EXPR can be * or the name of a package\n";
+	print "and OPTIONS are:\n";
+	print "\t--deliverablesdir=DIR Use DIR as the root of the deliverables dir (default: $DELIVERABLES_DIR\n";
+	exit(0);
+}
+
+$DELIVERABLES_DIR = $deliverablesdir if ($deliverablesdir);
+
+my @layers = ();
+if ($layer_expr eq '*')
+{
+	opendir(DIR, $DELIVERABLES_DIR);
+	@layers = readdir(DIR);
+	closedir(DIR);
+	@layers = grep(!/^\.\.?$/, @layers);
+}
+else
+{
+	push(@layers, $layer_expr);
+}
+#for (@layers) {print "$_\n"};
+
+for my $layer (@layers)
+{
+	my @packages = ();
+	if ($package_expr eq '*')
+	{
+		opendir(DIR, "$DELIVERABLES_DIR/$layer");
+		@packages = readdir(DIR);
+		closedir(DIR);
+		@packages = grep(!/^\.\.?$/, @packages);
+	}
+	else
+	{
+		push(@packages, $package_expr);
+	}
+	#for (@pacakges) {print "$_\n"};
+	
+	for my $package (@packages)
+	{
+		print "Processing package $layer/$package...\n";
+
+		open(FILE, "$DELIVERABLES_DIR/$layer/$package/info.tsv");
+		while (<FILE>)
+		{
+			my $line = $_;
+			
+			if ($line =~ m,([^\t]*)\t([^\t]*)\t([^\t]*),)
+			{
+				my $file = $1;
+				my $type = $2;
+				my $config = $3;
+				
+				if (-f $file)
+				{
+					print "removing file: '$file'\n";
+					unlink($file);
+				}
+				else
+				{
+					print "WARNING: file '$file' doesn't exist.\n";
+				}
+			}
+			else
+			{
+				print "WARNING: line '$line' doesn't match the expected tab-separated pattern\n";
+			}
+		}
+		close(FILE);
+	}
+}
\ No newline at end of file
--- a/sf-package/package_props.ant.xml	Tue Jun 30 17:20:00 2009 +0100
+++ b/sf-package/package_props.ant.xml	Wed Jul 08 17:49:33 2009 +0100
@@ -5,7 +5,11 @@
   <property name="sf.spec.baseline.enable" value="true"/>
   <property name="sf.spec.baseline.select" value="location"/>
   <property name="sf.spec.baseline.location" value="\\bishare\Releases\PDK_candidate_2.0.c_flat"/>
-  <property name="sf.spec.baseline.getenv_options" value="-i emu -i rnd -i tools"/>
+  <property name="sf.spec.baseline.getenv_options" value="-i emu -i rnd -i tools -i info"/>
+  
+  <property name="sf.spec.toolsbaseline.enable" value="false"/>
+  
+  <property name="sf.spec.build.clean.enable" value="true"/>
   
   <property name="sf.spec.systemdefinition.assemble" value="false"/>
   <property name="sf.spec.sysdef.configurations.list" value="SF"/>