Added a post build check that the release zips don't collide.
authorSimon Howkins <simonh@symbian.org>
Thu, 14 Oct 2010 16:29:33 +0100
changeset 1271 77ff148fa4d2
parent 1270 13e40df94492
child 1272 26a71d6a561e
Added a post build check that the release zips don't collide. Collisions are BRAG affecting.
common/build.postbuild.xml
common/tools/brag/rules.ArchiveCollisions.tsv
common/tools/detectArchiveCollisions.pl
--- a/common/build.postbuild.xml	Tue Oct 12 17:23:11 2010 +0100
+++ b/common/build.postbuild.xml	Thu Oct 14 16:29:33 2010 +0100
@@ -61,6 +61,9 @@
             <param name="zip.target.name" value="md5-just-metadata" />
         </antcall>
  
+        <!-- All zips now zipped, so check for collisions  (apart from logs, which cannot be processed) -->
+        <runtarget target="sf-detect-archive-collisions"/>
+
         <!-- Launch smoketest -->
         <if><istrue value="${sf.spec.test.sendpkg.enable}"/>
             <then>
@@ -828,6 +831,20 @@
 
     </target>
 
+    <target name="sf-detect-archive-collisions">
+        <exec executable="perl" output="${build.log.dir}/detectArchiveCollisions.log">
+            <arg value="${sf.common.config.dir}/tools/detectArchiveCollisions.pl"/>
+            <arg value="${build.drive}/output/zips/release/*.zip"/>
+            <arg value="${build.drive}/output/zips/release/*.7z"/>
+        </exec>
+        <antcall target="sf-log-to-brag">
+            <param name="sf.brag.id" value="ArchiveCollisions"/>
+            <param name="sf.brag.log" value="${build.log.dir}/detectArchiveCollisions.log"/>
+            <param name="sf.brag.phase" value="Postbuild"/>
+            <param name="sf.brag.step" value="Detect Archive Collisions"/>
+        </antcall>
+    </target>
+
     <target name="sf-links-to-diamonds">
       <fmpp sourceFile="${sf.common.config.dir}/diamonds/linksForDiamonds.xml.ftl" outputFile="${build.log.dir}/linksForDiamonds.xml">
         <data expandProperties="yes">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/brag/rules.ArchiveCollisions.tsv	Thu Oct 14 16:29:33 2010 +0100
@@ -0,0 +1,2 @@
+^ERROR: samsung_rndonly.txt	ignore
+^ERROR:	major
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/detectArchiveCollisions.pl	Thu Oct 14 16:29:33 2010 +0100
@@ -0,0 +1,56 @@
+#!perl -w
+# Copyright (c) 2010 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:
+# Identify collisions between file archives
+#
+# Usage:
+# detectArchiveCollisions.pl this.zip that.zip several_*.zip and\also_*.7z
+
+use strict;
+
+# Expand shell wildcards
+@ARGV = map { glob $_ } @ARGV;
+
+my $data;
+
+foreach my $archive (@ARGV)
+{
+	print "Reading $archive...\n";
+	my $file = undef;
+	foreach my $line (`7z l -slt $archive`)
+	{
+		if ($line =~ m{^Path = (.*)})
+		{
+			$file = $1;
+			next;
+		}
+
+		if ($line =~ m{^Folder = -})
+		{
+			# Record this (non-directory) item
+			push @{$data->{$file}}, $archive;
+			next;
+		}
+	}
+}
+
+foreach my $file (sort keys %$data)
+{
+	next unless scalar @{$data->{$file}} > 1;
+	print "ERROR: $file\n";
+	foreach (@{$data->{$file}})
+	{
+		print "\t$_\n";
+	}
+}
+