author | timothy.murphy@nokia.com |
Thu, 08 Apr 2010 15:01:11 +0100 | |
branch | fix |
changeset 472 | d1500715c073 |
parent 217 | 0f5e3a7fb6af |
child 587 | 85df38eb4012 |
permissions | -rw-r--r-- |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
2 |
<!-- |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
3 |
============================================================================ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
4 |
Name : bom.ant.xml |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
5 |
Part of : Helium |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
6 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
7 |
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
8 |
All rights reserved. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
9 |
This component and the accompanying materials are made available |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
10 |
under the terms of the License "Eclipse Public License v1.0" |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
11 |
which accompanies this distribution, and is available |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
12 |
at the URL "http://www.eclipse.org/legal/epl-v10.html". |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
13 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
14 |
Initial Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
15 |
Nokia Corporation - initial contribution. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
16 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
17 |
Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
18 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
19 |
Description: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
20 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
21 |
============================================================================ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
22 |
--> |
217 | 23 |
<!--* @package preparation --> |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
24 |
<project name="preparation.bom" xmlns:hlm="http://www.nokia.com/helium"> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
25 |
<description> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
26 |
Creates a Bill-Of-Materials record based on the Synergy inputs. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
27 |
</description> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
28 |
|
217 | 29 |
<!-- Your synergy work area directory (Set as the parent of the helium dir by default). |
30 |
@type string |
|
31 |
--> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
32 |
<property name="create.bom.workarea.root" value="."/> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
33 |
|
179 | 34 |
<!-- The target create-bom creates a Bill-Of-Material based on the SCM project |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
35 |
The target can be run in the project's root directory or the directory can be given by |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
36 |
setting the property create.bom.workarea.root. The IDO builds are expected to set it to their |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
37 |
projects work area directory. --> |
179 | 38 |
<target name="create-bom" depends="get-ccm-password,old-bom-log,ccm-prepare-input,prep-prepare-input"> |
39 |
<hlm:startSpecificLogMacro name="${prep.log.dir}/${build.id}_bom.log" regexp="${ccm.user.password}" phase="prep"/> |
|
40 |
<hlm:python> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
41 |
import os |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
42 |
import build.model |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
43 |
import configuration |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
44 |
import nokia.nokiaccm |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
45 |
import ccm.extra |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
46 |
import ant |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
47 |
import sys |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
48 |
import traceback |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
49 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
50 |
session = None |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
51 |
try: |
179 | 52 |
runccm = ant.get_property(r'${run.ccm}') |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
53 |
database = ant.get_property(r'${ccm.database}') |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
54 |
username = ant.get_property(r'${ccm.user.login}') |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
55 |
password = ant.get_property(r'${ccm.user.password}') |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
56 |
engine = ant.get_property(r'${ccm.engine.host}') |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
57 |
dbpath = ant.get_property(r'${ccm.database.path}') |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
58 |
waroot = ant.get_property(r'${create.bom.workarea.root}') |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
59 |
buildid = ant.get_property(r'${build.id}') |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
60 |
buildlogdir = ant.get_property(r'${build.log.dir}') |
179 | 61 |
deliveryfile = ant.get_property(r'${prep.delivery.conf.parsed}') |
62 |
oldbom = ant.get_property(r'${old.bom.log}') |
|
63 |
bom = None |
|
64 |
bomfilename = r"%s/%s_bom.xml" % (buildlogdir, buildid) |
|
65 |
if runccm and deliveryfile: |
|
66 |
cache = None |
|
67 |
if ant.get_property(r'${ccm.cache.xml}') is not None: |
|
68 |
cache = str(ant.get_property(r'${ccm.cache.xml}')) |
|
69 |
provider = ccm.extra.CachedSessionProvider(opener=nokia.nokiaccm.open_session, cache=cache) |
|
70 |
||
71 |
configBuilder = configuration.NestedConfigurationBuilder(open(deliveryfile, 'r')) |
|
72 |
configSet = configBuilder.getConfiguration() |
|
73 |
for config in configSet.getConfigurations(): |
|
74 |
waroot = config['dir'] |
|
75 |
print "Found wa for project %s" % waroot |
|
76 |
||
77 |
if database != None: |
|
78 |
session = provider.get(username, password, database=database) |
|
79 |
else: |
|
80 |
session = provider.get(username, password, engine, dbpath) |
|
81 |
||
82 |
ccmproject = ccm.extra.get_toplevel_project(session, waroot) |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
83 |
|
179 | 84 |
config_data = {'delivery': deliveryfile, 'prep.xml': ant.get_property(r'${prep.config.file.parsed}'), 'build.id': buildid, 'ccm.database': database, 'symbian_rel_week': ant.get_property(r'${symbian.version.week}'), 'symbian_rel_ver': ant.get_property(r'${symbian.version}'), 'symbian_rel_year': ant.get_property(r'${symbian.version.year}'), 's60_version': ant.get_property(r'${s60.version}'), 's60_release': ant.get_property(r'${s60.release}'), 'currentRelease.xml': ant.get_property(r'${build.drive}') + "/currentRelease.xml"} |
85 |
config = configuration.Configuration(config_data) |
|
86 |
||
87 |
# let's only support the new spec model! |
|
88 |
bom = build.model.SynergyBOM(config, ccmproject, username=username, password=password, provider=provider) |
|
89 |
||
90 |
xml_writer = build.model.BOMXMLWriter(bom) |
|
91 |
xml_writer.write(bomfilename) |
|
92 |
if not bom and os.path.exists(bomfilename): |
|
93 |
config_data = {'prep.xml': ant.get_property(r'${prep.config.file.parsed}'), 'build.id': buildid, 'symbian_rel_week': ant.get_property(r'${symbian.version.week}'), 'symbian_rel_ver': ant.get_property(r'${symbian.version}'), 'symbian_rel_year': ant.get_property(r'${symbian.version.year}'), 's60_version': ant.get_property(r'${s60.version}'), 's60_release': ant.get_property(r'${s60.release}'), 'currentRelease.xml': ant.get_property(r'${build.drive}') + "/currentRelease.xml"} |
|
94 |
config = configuration.Configuration(config_data) |
|
95 |
bom = build.model.SimpleBOM(config, bomfilename) |
|
96 |
if os.path.exists(oldbom): |
|
97 |
xml_delta_writer = build.model.BOMDeltaXMLWriter(bom, oldbom) |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
98 |
xml_delta_writer.write(buildlogdir + "/" + buildid + "_bom_delta.xml") |
179 | 99 |
delta_bom_content_validity = xml_delta_writer.validate_delta_bom_contents(buildlogdir + "/" + buildid + "_bom_delta.xml", bomfilename, oldbom) |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
100 |
if((delta_bom_content_validity == False) and (ant.get_property(r'${hlm.enable.asserts}') is not None)): |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
101 |
print 'Bom delta contents are not matching' |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
102 |
raise Exception |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
103 |
elif((delta_bom_content_validity == True) or (delta_bom_content_validity == None)): |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
104 |
print 'Bom delta contents are matching.' |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
105 |
elif(delta_bom_content_validity == False): |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
106 |
print 'Bom delta contents are not matching.' |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
107 |
else: |
179 | 108 |
print 'Old BOM log cannot be found ' + oldbom + ', skipping BOM delta creation.' |
109 |
if runccm: |
|
110 |
bom.close() |
|
111 |
if session: |
|
112 |
session.close() |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
113 |
except Exception, ex: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
114 |
print 'Caught exception in BOM: ' + str(ex) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
115 |
traceback.print_exc() |
179 | 116 |
</hlm:python> |
117 |
<if> |
|
118 |
<available file="${build.log.dir}/${build.id}_bom.xml"/> |
|
119 |
<then> |
|
120 |
<echo>${build.log.dir}</echo> |
|
121 |
<xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml" outputter="simple"> |
|
122 |
<replace path="//bom/build/text()" withText="${build.id}"/> |
|
123 |
</xmltask> |
|
124 |
<fmpp sourceRoot="${helium.dir}/tools/preparation/bom" |
|
125 |
outputRoot="${prep.log.dir}" includes="bom.html.*,bom.txt.*" removeExtensions="ftl"> |
|
126 |
<freemarkerLinks expandProperties="yes"> |
|
127 |
macro: ${helium.dir}/tools/common/templates/macro |
|
128 |
</freemarkerLinks> |
|
129 |
<data expandProperties="yes"> |
|
130 |
doc: xml(${build.log.dir}/${build.id}_bom.xml) |
|
131 |
</data> |
|
132 |
</fmpp> |
|
133 |
||
134 |
<move file="${prep.log.dir}/bom.html" tofile="${build.log.dir}/${build.id}_bom.html"/> |
|
135 |
<move file="${prep.log.dir}/bom.txt" tofile="${prep.log.dir}/${build.id}_bom.txt"/> |
|
136 |
||
137 |
<!-- Transform bom data into the diamonds xml format: |
|
138 |
* BOM folders are flattened into tasks. |
|
139 |
* Schema version is extracted from the appropriate FMPP template. --> |
|
140 |
<fmpp sourcefile="${helium.dir}/tools/common/templates/diamonds/diamonds_header.ftl" |
|
141 |
outputfile="${build.temp.dir}/diamonds_header.xml" quiet="true"/> |
|
142 |
<loadfile srcfile="${build.temp.dir}/diamonds_header.xml" property="diamonds.schema.xml"> |
|
143 |
<filterchain> |
|
144 |
<linecontains> |
|
145 |
<contains value="schema"/> |
|
146 |
</linecontains> |
|
147 |
</filterchain> |
|
148 |
</loadfile> |
|
149 |
<mkdir dir="${diamonds.build.output.dir}" /> |
|
150 |
<xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${diamonds.build.output.dir}/create-bom.xml"> |
|
151 |
<insert path="bom/content" xml="${diamonds.schema.xml}" position="before"/> |
|
152 |
<remove path="bom/content/project/folder/name"/> |
|
153 |
<remove path="bom/build"/> |
|
154 |
<rename path="bom" to="diamonds-build"/> |
|
155 |
</xmltask> |
|
156 |
<delete file="${build.temp.dir}/diamonds_header.xml"/> |
|
157 |
<replace file="${diamonds.build.output.dir}/create-bom.xml" token="<folder>" value="<!-- <folder> -->"/> |
|
158 |
<replace file="${diamonds.build.output.dir}/create-bom.xml" token="</folder>" value="<!-- </folder> -->"/> |
|
159 |
<xmltask source="${diamonds.build.output.dir}/create-bom.xml" dest="${diamonds.build.output.dir}/create-bom.xml" |
|
160 |
outputter="simple"> |
|
161 |
<remove path="//comment()"/> |
|
162 |
</xmltask> |
|
163 |
||
164 |
<hlm:assertFileExists file="${diamonds.build.output.dir}/create-bom.xml"/> |
|
165 |
<hlm:assertFileExists file="${build.log.dir}/${build.id}_bom.html"/> |
|
166 |
<hlm:assertFileExists file="${prep.log.dir}/${build.id}_bom.txt"/> |
|
167 |
||
168 |
<runtarget target="collect-task-owner-email"/> |
|
169 |
</then> |
|
170 |
<else> |
|
171 |
<echo>WARNING: ${build.log.dir}/${build.id}_bom.xml file not found.</echo> |
|
172 |
</else> |
|
173 |
</if> |
|
174 |
||
175 |
<if> |
|
176 |
<available file="${old.bom.log}"/> |
|
177 |
<then> |
|
178 |
<hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.xml"/> |
|
179 |
<fmpp sourceRoot="${helium.dir}/tools/preparation/bom" |
|
180 |
outputRoot="${prep.log.dir}" includes="bom_delta.*" removeExtensions="ftl"> |
|
181 |
<freemarkerLinks expandProperties="yes"> |
|
182 |
macro: ${helium.dir}/tools/common/templates/macro |
|
183 |
</freemarkerLinks> |
|
184 |
<data expandProperties="yes"> |
|
185 |
doc: xml(${build.log.dir}/${build.id}_bom_delta.xml) |
|
186 |
</data> |
|
187 |
</fmpp> |
|
188 |
||
189 |
<move file="${prep.log.dir}/bom_delta.html" tofile="${build.log.dir}/${build.id}_bom_delta.html"/> |
|
190 |
<move file="${prep.log.dir}/bom_delta.txt" tofile="${prep.log.dir}/${build.id}_bom_delta.txt"/> |
|
191 |
||
192 |
<hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.html"/> |
|
193 |
</then> |
|
194 |
</if> |
|
195 |
<hlm:stopSpecificLogMacro name="${prep.log.dir}/${build.id}_bom.log" phase="prep"/> |
|
196 |
</target> |
|
197 |
||
217 | 198 |
<!-- The target create-task-owner-email creates a property task.owners.email which will contain |
179 | 199 |
the list of task owners email IDs seperated by comma, the newly created property can be used thereafter |
200 |
to send emails. |
|
217 | 201 |
This target is automatically called by create-bom target. @scope private--> |
179 | 202 |
<target name="collect-task-owner-email"> |
203 |
<if> |
|
204 |
<available file="${build.log.dir}/${build.id}_bom_delta.xml"/> |
|
205 |
<then> |
|
206 |
<xmltask source="${build.log.dir}/${build.id}_bom_delta.xml" dest="${build.log.dir}/${build.id}_bom_delta.xml"> |
|
207 |
<call path="/bomDelta/content/task"> |
|
208 |
<param name="task.delta" path="text()"/> |
|
209 |
<actions> |
|
210 |
<var name="task.delta" value="@{task.delta}"/> |
|
211 |
<propertyregex property="delta.task.id" input="${task.delta}" regexp="^([^:]+):\s*" select="\1"/> |
|
212 |
<xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml"> |
|
213 |
<call path="/bom/content/project/folder/task/owner/text()[../../id[.='${delta.task.id}']]" > |
|
214 |
<param name="task.owner" path="."/> |
|
215 |
<actions> |
|
216 |
<var name="task.owner" value="@{task.owner}"/> |
|
217 |
<if> |
|
218 |
<and> |
|
219 |
<isset property="task.owners"/> |
|
220 |
</and> |
|
221 |
<then> |
|
222 |
<var name="task.owners" value="${task.owners},${task.owner}"/> |
|
223 |
</then> |
|
224 |
<else> |
|
225 |
<var name="task.owners" value="${task.owner}"/> |
|
226 |
</else> |
|
227 |
</if> |
|
228 |
</actions> |
|
229 |
</call> |
|
230 |
</xmltask> |
|
231 |
</actions> |
|
232 |
</call> |
|
233 |
</xmltask> |
|
234 |
</then> |
|
235 |
<else> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
236 |
<if> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
237 |
<available file="${build.log.dir}/${build.id}_bom.xml"/> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
238 |
<then> |
179 | 239 |
<xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml"> |
240 |
<call path="/bom/content/project/folder/task/owner"> |
|
241 |
<param name="task.owner" path="text()"/> |
|
242 |
<actions> |
|
243 |
<var name="task.owner" value="@{task.owner}"/> |
|
244 |
<if> |
|
245 |
<and> |
|
246 |
<isset property="task.owners"/> |
|
247 |
</and> |
|
248 |
<then> |
|
249 |
<var name="task.owners" value="${task.owners},${task.owner}"/> |
|
250 |
</then> |
|
251 |
<else> |
|
252 |
<var name="task.owners" value="${task.owner}"/> |
|
253 |
</else> |
|
254 |
</if> |
|
255 |
</actions> |
|
256 |
</call> |
|
257 |
</xmltask> |
|
258 |
</then> |
|
259 |
</if> |
|
260 |
</else> |
|
261 |
</if> |
|
262 |
<sortlist property="task.owners" override="true" value="${task.owners}"/> |
|
263 |
<propertyregex property="task.owners" override="true" input="${task.owners}" regexp="([^,]+),.*\1" replace="\1" global='true'/> |
|
264 |
<for list="${task.owners}" delimiter="," param="task.owner" > |
|
265 |
<sequential> |
|
266 |
<var name="task.owner" value="@{task.owner}"/> |
|
267 |
<hlm:ldap url="${email.ldap.server}" rootdn="${email.ldap.rootdn}" filter="uid=${task.owner}" outputproperty="task.owner.email" key="mail"/> |
|
268 |
<if> |
|
269 |
<and> |
|
270 |
<isset property="task.owners.email"/> |
|
271 |
</and> |
|
272 |
<then> |
|
273 |
<var name="task.owners.email" value="${task.owners.email},${task.owner.email}"/> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
274 |
</then> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
275 |
<else> |
179 | 276 |
<var name="task.owners.email" value="${task.owner.email}"/> |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
277 |
</else> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
278 |
</if> |
179 | 279 |
</sequential> |
280 |
</for> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
281 |
</target> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
282 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
283 |
<!-- Finds the path to the last usable XML BOM log for creating a BOM delta. --> |
179 | 284 |
<target name="old-bom-log" unless="old.bom.log"> |
217 | 285 |
<!-- Publish dir location of the old bom log. |
286 |
@type string |
|
287 |
--> |
|
179 | 288 |
<property name="old.bom.log.publish.dir" value="${publish.dir}" /> |
217 | 289 |
<!-- Location of XML BOM log. |
290 |
@type string |
|
291 |
@scope private |
|
292 |
--> |
|
179 | 293 |
<property name="bom.log" value="${old.bom.log.publish.dir}/logs/${build.id}_bom.xml"/> |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
294 |
<script language="jython" setbeans="false"> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
295 |
import re |
179 | 296 |
import ant |
297 |
import os |
|
298 |
from com.nokia.ant.util import Helper |
|
299 |
||
300 |
previousbuildnumber = 1 |
|
301 |
buildnumber = Helper.getProperty(project, "build.number") |
|
302 |
bomlog = project.getProperty("bom.log") |
|
303 |
while(previousbuildnumber > 0 and previousbuildnumber != ''): |
|
304 |
previousbuildnumber = ant.get_previous_build_number(buildnumber) |
|
305 |
try: |
|
306 |
old_bom_log = re.sub(r'\.(%s)([\/_])' % project.getProperty("build.number"), r'.' + previousbuildnumber + r'\2', bomlog) |
|
307 |
if os.path.exists(old_bom_log): |
|
308 |
break |
|
309 |
except ValueError: |
|
310 |
self.log("Old BOM cannot be found") |
|
311 |
buildnumber = previousbuildnumber |
|
312 |
project.setProperty("old.bom.log", old_bom_log) |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
313 |
</script> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
314 |
<echo>Previous BOM log: ${old.bom.log}</echo> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
315 |
<available file="${old.bom.log}" property="old.bom.log.present"/> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
316 |
<echo>Previous BOM log present: ${old.bom.log.present}</echo> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
317 |
</target> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
318 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
319 |
</project> |