Repackage a generated manifest with binary zip output
authorShabe Razvi <shaber@symbian.org>
Tue, 11 May 2010 15:56:27 +0100
changeset 1008 ed6bac1beacb
parent 1007 0630eeca6d07
child 1009 d1cef5ea6d99
Repackage a generated manifest with binary zip output
common/tools/7z_list_to_manifest.pl
sf-tools/build.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/7z_list_to_manifest.pl	Tue May 11 15:56:27 2010 +0100
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+# 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:
+# Turn a 7z listing into a manifest file that can be re-used by 7z 
+# - Assumes that header/footer is fixed, and that file listing starts at column 53
+# Also allows use on a zipfile directly by passing -z as an option
+
+use strict;
+
+my $line;
+my $between_header_footer = 0;
+my $header_footer_pattern = "------------------- ----- ------------ ------------  ------------------------";
+
+my $file   = shift or die "Usage: $0 <7z list output file> [-z to run directly on a zipfile]\n";   #  provided 7z list to process
+my $mode   = shift;
+
+# if -z has been specified, then generate intermediate 7z list file for processing
+if ($mode eq lc("-z")) {
+	system("7z l $file > $file.tmp.lst");
+	$file = $file.".tmp.lst";
+}
+
+open my $sevenZfile, "<", $file or die;
+
+while ($line =<$sevenZfile>)
+{
+	if ($line =~ /$header_footer_pattern/) 
+	{
+        	$between_header_footer= !$between_header_footer;
+
+	}
+	if (($line =~ /^(.{53})(.*)/) && ($line !=/$header_footer_pattern/))
+	{
+		print $2 ."\n" if $between_header_footer;
+		next;
+	}
+}
+
+close $sevenZfile;
+
+# remove temp 7z file if one has been generated
+if ($mode eq lc("-z")) {
+	system("del $file");
+}
+
+exit 0;
\ No newline at end of file
--- a/sf-tools/build.xml	Mon May 10 15:28:49 2010 +0100
+++ b/sf-tools/build.xml	Tue May 11 15:56:27 2010 +0100
@@ -101,25 +101,32 @@
         <arg value="epoc32\"/>
     </exec>
 
-	<!--  create a manifest. Currently just list of all files in the archive -->
-    <exec executable="7z" dir="${build.drive}" output="${build.log.dir}/manifest_${build.id}_binaries_${sf.spec.job.name}.log">
-        <arg value="l"/>
+    <!--  create a manifest in the root of the build drive -->
+    <exec executable="perl" dir="${build.drive}" output="${build.log.dir}/manifest_binaries_${sf.spec.job.name}.txt">
+        <arg value="${sf.common.config.dir}/tools/7z_list_to_manifest.pl"/>
         <arg value="${build.drive}/output/zips/release/binaries_${sf.spec.job.name}.zip"/>
-	</exec>
+        <arg value="-z"/>
+    </exec>
+
+    <!--  add manifest to zip and update release meta data -->
+    <exec executable="7z" dir="${build.drive}">
+        <arg value="a"/>
+        <arg value="-t${sf.spec.package.zip.format}"/>
+        <arg value="${build.drive}/output/zips/release/binaries_${sf.spec.job.name}.zip"/>
+        <arg value="${build.log.dir}/manifest_binaries_${sf.spec.job.name}.txt"/>
+    </exec>
 
     <antcall target="sf-zip-content">
         <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
         <param name="zip.target.name" value="bin-${sf.spec.job.name}-metadata" />
     </antcall>
-
  </target>
  
   <target name="create-canonical-sysdef-file">
      <copy file="${sf.spec.systemdefinition.location}" tofile="${canonical.sysdef.file}" failonerror="true" verbose="true"/>
   </target>
 
- <!-- do nothing for these in a tools build -->
- <target name="sf-run-analysis"/>
+ <!-- do nothing for this in a tools build -->
  <target name="sf-copy-rom-logs"/>
     
 </project>