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