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