Catchup merge
authorMaciej Seroka <maciejs@symbian.org>
Fri, 11 Jun 2010 09:21:48 +0100
changeset 1086 7e72cd1ef70a
parent 1085 461755d25d57 (current diff)
parent 1084 abefe2962232 (diff)
child 1087 73af6e555060
Catchup merge
--- a/common/build.postbuild.xml	Fri Jun 11 09:20:11 2010 +0100
+++ b/common/build.postbuild.xml	Fri Jun 11 09:21:48 2010 +0100
@@ -100,7 +100,41 @@
     </target>
 
     <target name="sf-tag-hg-code">
-        <property name="sf.tagafterbuild.tag" value="${sf.spec.job.name}_${sf.spec.job.codeline}.${sf.spec.job.number}"/>
+        <!-- To do the tagging, we need to know what tag to use, and who the author is (from hg's perspective) -->
+        <fail message="This target needs to have all the details specified, or to be run interactively so it can query the user">
+            <condition>
+                <and>
+                    <isset property="sf.hudson.executor.number"/>
+                    <not>
+                        <or>
+                            <isset property="sf.tagafterbuild.tag"/>
+                            <isset property="sf.hg.ui.username"/>
+                        </or>
+                    </not>
+                </and>
+            </condition>
+        </fail>
+
+        <!-- Ask the user, interactively, what tag to use -->
+        <input addproperty="sf.tagafterbuild.tag" message="Enter the tag to apply to the code (eg &quot;PDK_1.0.1&quot;):"/>
+        <fail message="No tag supplied">
+            <condition>
+                <length string="${sf.tagafterbuild.tag}" trim="true" length="0"/>
+            </condition>
+        </fail>
+
+        <!-- Now get the username sorted out -->
+        <exec executable="hg" outputproperty="sf.hg.showconfig.ui.username">
+            <arg value="showconfig"/>
+            <arg value="ui.username"/>
+        </exec>
+        <input addproperty="sf.hg.ui.username" message="Enter hg author credentials (eg &quot;Fred Bloggs &lt;fredb@example.org&gt;&quot;) default is" defaultvalue="${sf.hg.showconfig.ui.username}"/>
+        <fail message="No author supplied">
+            <condition>
+                <length string="${sf.hg.ui.username}" trim="true" length="0"/>
+            </condition>
+        </fail>
+
         <fmpp sourceFile="${sf.common.config.dir}/templates/tag-hg-code.ant.xml.ftl"
               outputFile="${temp.build.dir}/tag-hg-code.ant.xml">
             <data expandProperties="yes">
@@ -111,6 +145,59 @@
         <ant antfile="${temp.build.dir}/tag-hg-code.ant.xml"/>
     </target>
 
+    <target name="sf-push-hg-tags">
+        <!-- To do the pushing, we need to have a set of credentials for the developer.symbian.org site -->
+        <fail message="This target needs to have loging credentials specified specified, or to be run interactively so it can query the user">
+            <condition>
+                <and>
+                    <isset property="sf.hudson.executor.number"/>
+                    <not>
+                        <or>
+                            <isset property="sf.symbian.account.username"/>
+                            <isset property="sf.symbian.account.password"/>
+                        </or>
+                    </not>
+                </and>
+            </condition>
+        </fail>
+
+        <input addproperty="sf.symbian.account.username" message="Enter symbian.org username (eg &quot;fredb&quot;)"/>
+        <fail message="No author supplied">
+            <condition>
+                <length string="${sf.hg.ui.username}" trim="true" length="0"/>
+            </condition>
+        </fail>
+
+        <input addproperty="sf.symbian.account.password" message="Enter symbian.org password (eg &quot;unguessable&quot;)">
+            <!-- Ant 1.8 supports secure here, which would be an improvement... -->
+            <handler type="default"/>
+        </input>
+        <fail message="No password supplied">
+            <condition>
+                <length string="${sf.hg.ui.password}" trim="true" length="0"/>
+            </condition>
+        </fail>
+
+        <if>
+            <not>
+                <available file="${build.drive}/tagging" type="dir"/>
+            </not>
+            <then>
+                <!-- No dir with tagged repos in - create them! -->
+                <runtarget target="sf-tag-hg-code"/>
+            </then>
+        </if>
+
+        <fmpp sourceFile="${sf.common.config.dir}/templates/push-hg-tags.ant.xml.ftl"
+              outputFile="${temp.build.dir}/push-hg-tags.ant.xml">
+            <data expandProperties="yes">
+                ant: antProperties()
+                data: csv(${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
+            </data>
+        </fmpp>
+        <ant antfile="${temp.build.dir}/push-hg-tags.ant.xml"/>
+    </target>
+
     <target name="sf-run-evalid" >
         <delete dir="${build.drive}/output/md5"/>
         <mkdir  dir="${build.drive}/output/md5"/>
@@ -630,12 +717,12 @@
           </exec>
           <echo message="Send ${build.log.dir}/diamonds_uh.xml to Diamonds"/>
           <exec executable="python">
-		    <arg value="${sf.common.config.dir}/tools/brag/send_xml_to_diamonds.py"/>
-		    <arg value="-u"/>
-		    <arg value="http://${diamonds.host}${diamonds.build.id}"/>
-		    <arg value="-f"/>
-		    <arg value="${build.log.dir}/diamonds_uh.xml"/>
-		  </exec>
+            <arg value="${sf.common.config.dir}/tools/brag/send_xml_to_diamonds.py"/>
+            <arg value="-u"/>
+            <arg value="http://${diamonds.host}${diamonds.build.id}"/>
+            <arg value="-f"/>
+            <arg value="${build.log.dir}/diamonds_uh.xml"/>
+          </exec>
         </then>
       </if>
     </target>
@@ -781,15 +868,29 @@
                     <exclude name="output/logs/releaseables/**"/>
                 </zip>
                 <!-- workaround for the time when when 'sf-run-analysis-raptor' has not been run -->
-                <mkdir dir="${build.drive}/output/logs/releaseables"/> 
-                <zip destfile="${build.output.dir}/zips/release/build_BOM.zip">
-                    <zipfileset dir="${build.drive}/output/logs/BOM" prefix="build_info/logs/BOM"/>
-                    <zipfileset dir="${build.drive}/output/logs/releaseables" prefix="build_info/logs/releaseables"/>
-                    <zipfileset dir="${build.drive}/output/logs" prefix="build_info/logs/BOM">
-                        <include name="envinfo.txt"/>
-                    </zipfileset>
-                    <zipfileset dir="${build.drive}/output/logs/package_definitions" prefix="build_info/package_definitions"/>
-                </zip>
+                <mkdir dir="${build.drive}/output/logs/releaseables"/>
+				<if>
+	                <available file="${build.drive}/output/logs/package_definitions" type="dir"/>
+	                <then>
+		                <zip destfile="${build.output.dir}/zips/release/build_BOM.zip">
+	            	        <zipfileset dir="${build.drive}/output/logs/BOM" prefix="build_info/logs/BOM"/>
+	        	            <zipfileset dir="${build.drive}/output/logs/releaseables" prefix="build_info/logs/releaseables"/>
+	    	                <zipfileset dir="${build.drive}/output/logs" prefix="build_info/logs/BOM">
+		                        <include name="envinfo.txt"/>
+	                    	</zipfileset>
+	                    	<zipfileset dir="${build.drive}/output/logs/package_definitions" prefix="build_info/package_definitions"/>
+	                	</zip>
+	                </then>
+	                <else>
+	                	<zip destfile="${build.output.dir}/zips/release/build_BOM.zip">
+	            	        <zipfileset dir="${build.drive}/output/logs/BOM" prefix="build_info/logs/BOM"/>
+	        	            <zipfileset dir="${build.drive}/output/logs/releaseables" prefix="build_info/logs/releaseables"/>
+	    	                <zipfileset dir="${build.drive}/output/logs" prefix="build_info/logs/BOM">
+		                        <include name="envinfo.txt"/>
+	                    	</zipfileset>
+	                	</zip>
+	                </else>
+	            </if>
                 <antcall target="sf-zip-content">
                     <param name="zip.config.file" value="${temp.build.dir}/zip.cfg.xml.ftl"/>
                     <param name="zip.target.name" value="info-just-metadata" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/templates/push-hg-tags.ant.xml.ftl	Fri Jun 11 09:21:48 2010 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<project name="SF-TAG-HG-CODE" default="all" xmlns:hlm="http://www.nokia.com/helium">
+
+	<#assign dollar = "$"/>
+	
+	<#assign target_depends = "" />
+	<#assign count = 0 />
+	
+	<#list data as pkg_detail>
+		<target name="sf-push-hg-tag-${count}">
+			<!-- Work out the URL of the web *MCL* -->
+			<propertyregex property="mcl.${count}" input="${pkg_detail.source}" regexp="(developer.symbian.org)/(oss|sfl)/FCL/(sf|sftools)" casesensitive="false" replace="\1/\2/MCL/\3" defaultValue="${pkg_detail.source}"/>
+			<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}" logError="true">
+				<arg value="push"/>
+				<arg value="--force"/>
+				<arg value="--config"/>
+				<arg value="auth.fbf1.prefix=https://developer.symbian.org/"/>
+				<arg value="--config"/>
+				<arg value="auth.fbf1.username=${dollar}{sf.symbian.account.username}"/>
+				<arg value="--config"/>
+				<arg value="auth.fbf1.password=${dollar}{sf.symbian.account.password}"/>
+				<arg value="--config"/>
+				<arg value="auth.fbf2.prefix=http://developer.symbian.org/"/>
+				<arg value="--config"/>
+				<arg value="auth.fbf2.username=${dollar}{sf.symbian.account.username}"/>
+				<arg value="--config"/>
+				<arg value="auth.fbf2.password=${dollar}{sf.symbian.account.password}"/>
+				<arg value="--rev"/>
+				<arg value="TAGS"/>
+				<arg value="${dollar}{mcl.${count}}"/>
+			</exec>
+		</target>
+		
+		<#if (count > 0) >
+			<#assign target_depends ="${target_depends}" + ", "/>
+		</#if>
+		<#assign target_depends = "${target_depends}" + "sf-push-hg-tag-${count}" />
+		
+		<#assign count = count + 1 />
+	</#list>
+	
+	<target name="all" depends="${target_depends}"/>
+
+</project>
--- a/common/templates/tag-hg-code.ant.xml.ftl	Fri Jun 11 09:20:11 2010 +0100
+++ b/common/templates/tag-hg-code.ant.xml.ftl	Fri Jun 11 09:21:48 2010 +0100
@@ -80,19 +80,11 @@
 			<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}" logError="true">
 				<arg value="--quiet"/>
 				<arg value="commit"/>
+				<arg value="--user"/>
+				<arg value="${dollar}{sf.hg.ui.username}"/>
 				<arg value="--message"/>
 				<arg value="Added tag ${ant['sf.tagafterbuild.tag']} for changeset ${dollar}{hash12.${count}}"/>
 			</exec>
-			<!-- Work out the URL of the web *MCL* -->
-			<propertyregex property="mcl.${count}" input="${pkg_detail.source}" regexp="(developer.symbian.org)/(oss|sfl)/FCL/(sf|sftools)" casesensitive="false" replace="\1/\2/MCL/\3" defaultValue="${pkg_detail.source}"/>
-			<echo message="Outgoing changes for ${dollar}{mcl.${count}}:"/>
-			<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}" logError="true">
-				<arg value="out"/>
-				<arg value="--force"/>
-				<arg value="--rev"/>
-				<arg value="TAGS"/>
-				<arg value="${dollar}{mcl.${count}}"/>
-			</exec>
 		</target>
 		
 		<#if (count > 0) >