author | kelvzhu |
Tue, 27 Jul 2010 13:00:43 +0800 | |
changeset 621 | 96fee2635b19 |
parent 588 | c7c26511138f |
child 628 | 7c4a911dc066 |
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. --> |
|
588 | 140 |
<mkdir dir="${temp.build.dir}" /> |
179 | 141 |
<fmpp sourcefile="${helium.dir}/tools/common/templates/diamonds/diamonds_header.ftl" |
588 | 142 |
outputfile="${temp.build.dir}/diamonds_header.xml" quiet="true"/> |
143 |
<loadfile srcfile="${temp.build.dir}/diamonds_header.xml" property="diamonds.schema.xml"> |
|
179 | 144 |
<filterchain> |
145 |
<linecontains> |
|
146 |
<contains value="schema"/> |
|
147 |
</linecontains> |
|
148 |
</filterchain> |
|
149 |
</loadfile> |
|
150 |
<mkdir dir="${diamonds.build.output.dir}" /> |
|
151 |
<xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${diamonds.build.output.dir}/create-bom.xml"> |
|
152 |
<insert path="bom/content" xml="${diamonds.schema.xml}" position="before"/> |
|
153 |
<remove path="bom/content/project/folder/name"/> |
|
154 |
<remove path="bom/build"/> |
|
155 |
<rename path="bom" to="diamonds-build"/> |
|
156 |
</xmltask> |
|
588 | 157 |
<delete file="${temp.build.dir}/diamonds_header.xml"/> |
179 | 158 |
<replace file="${diamonds.build.output.dir}/create-bom.xml" token="<folder>" value="<!-- <folder> -->"/> |
159 |
<replace file="${diamonds.build.output.dir}/create-bom.xml" token="</folder>" value="<!-- </folder> -->"/> |
|
160 |
<xmltask source="${diamonds.build.output.dir}/create-bom.xml" dest="${diamonds.build.output.dir}/create-bom.xml" |
|
161 |
outputter="simple"> |
|
162 |
<remove path="//comment()"/> |
|
163 |
</xmltask> |
|
164 |
||
165 |
<hlm:assertFileExists file="${diamonds.build.output.dir}/create-bom.xml"/> |
|
166 |
<hlm:assertFileExists file="${build.log.dir}/${build.id}_bom.html"/> |
|
167 |
<hlm:assertFileExists file="${prep.log.dir}/${build.id}_bom.txt"/> |
|
168 |
||
169 |
<runtarget target="collect-task-owner-email"/> |
|
170 |
</then> |
|
171 |
<else> |
|
172 |
<echo>WARNING: ${build.log.dir}/${build.id}_bom.xml file not found.</echo> |
|
173 |
</else> |
|
174 |
</if> |
|
175 |
||
176 |
<if> |
|
177 |
<available file="${old.bom.log}"/> |
|
178 |
<then> |
|
179 |
<hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.xml"/> |
|
180 |
<fmpp sourceRoot="${helium.dir}/tools/preparation/bom" |
|
181 |
outputRoot="${prep.log.dir}" includes="bom_delta.*" removeExtensions="ftl"> |
|
182 |
<freemarkerLinks expandProperties="yes"> |
|
183 |
macro: ${helium.dir}/tools/common/templates/macro |
|
184 |
</freemarkerLinks> |
|
185 |
<data expandProperties="yes"> |
|
186 |
doc: xml(${build.log.dir}/${build.id}_bom_delta.xml) |
|
187 |
</data> |
|
188 |
</fmpp> |
|
189 |
||
190 |
<move file="${prep.log.dir}/bom_delta.html" tofile="${build.log.dir}/${build.id}_bom_delta.html"/> |
|
191 |
<move file="${prep.log.dir}/bom_delta.txt" tofile="${prep.log.dir}/${build.id}_bom_delta.txt"/> |
|
192 |
||
193 |
<hlm:assertFileExists file="${build.log.dir}/${build.id}_bom_delta.html"/> |
|
194 |
</then> |
|
195 |
</if> |
|
196 |
<hlm:stopSpecificLogMacro name="${prep.log.dir}/${build.id}_bom.log" phase="prep"/> |
|
197 |
</target> |
|
198 |
||
217 | 199 |
<!-- The target create-task-owner-email creates a property task.owners.email which will contain |
179 | 200 |
the list of task owners email IDs seperated by comma, the newly created property can be used thereafter |
201 |
to send emails. |
|
217 | 202 |
This target is automatically called by create-bom target. @scope private--> |
179 | 203 |
<target name="collect-task-owner-email"> |
204 |
<if> |
|
205 |
<available file="${build.log.dir}/${build.id}_bom_delta.xml"/> |
|
206 |
<then> |
|
207 |
<xmltask source="${build.log.dir}/${build.id}_bom_delta.xml" dest="${build.log.dir}/${build.id}_bom_delta.xml"> |
|
208 |
<call path="/bomDelta/content/task"> |
|
209 |
<param name="task.delta" path="text()"/> |
|
210 |
<actions> |
|
211 |
<var name="task.delta" value="@{task.delta}"/> |
|
212 |
<propertyregex property="delta.task.id" input="${task.delta}" regexp="^([^:]+):\s*" select="\1"/> |
|
213 |
<xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml"> |
|
214 |
<call path="/bom/content/project/folder/task/owner/text()[../../id[.='${delta.task.id}']]" > |
|
215 |
<param name="task.owner" path="."/> |
|
216 |
<actions> |
|
217 |
<var name="task.owner" value="@{task.owner}"/> |
|
218 |
<if> |
|
588 | 219 |
<isset property="task.owners"/> |
179 | 220 |
<then> |
221 |
<var name="task.owners" value="${task.owners},${task.owner}"/> |
|
222 |
</then> |
|
223 |
<else> |
|
224 |
<var name="task.owners" value="${task.owner}"/> |
|
225 |
</else> |
|
226 |
</if> |
|
227 |
</actions> |
|
228 |
</call> |
|
229 |
</xmltask> |
|
230 |
</actions> |
|
231 |
</call> |
|
232 |
</xmltask> |
|
233 |
</then> |
|
234 |
<else> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
235 |
<if> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
236 |
<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
|
237 |
<then> |
179 | 238 |
<xmltask source="${build.log.dir}/${build.id}_bom.xml" dest="${build.log.dir}/${build.id}_bom.xml"> |
239 |
<call path="/bom/content/project/folder/task/owner"> |
|
240 |
<param name="task.owner" path="text()"/> |
|
241 |
<actions> |
|
242 |
<var name="task.owner" value="@{task.owner}"/> |
|
243 |
<if> |
|
588 | 244 |
<isset property="task.owners"/> |
179 | 245 |
<then> |
246 |
<var name="task.owners" value="${task.owners},${task.owner}"/> |
|
247 |
</then> |
|
248 |
<else> |
|
249 |
<var name="task.owners" value="${task.owner}"/> |
|
250 |
</else> |
|
251 |
</if> |
|
252 |
</actions> |
|
253 |
</call> |
|
254 |
</xmltask> |
|
255 |
</then> |
|
256 |
</if> |
|
257 |
</else> |
|
258 |
</if> |
|
587 | 259 |
<script language="jython" setbeans="false"> |
260 |
import re |
|
261 |
taskOwnersDup = project.getProperty("task.owners") |
|
262 |
if taskOwnersDup: |
|
263 |
taskOwnersDup = re.sub(r'\s', '', taskOwnersDup) |
|
264 |
taskOwners = taskOwnersDup.split(',') |
|
265 |
if taskOwners: |
|
266 |
taskOwners = list(set(taskOwners)) |
|
267 |
project.setProperty("task.owners.unique", ",".join(taskOwners)) |
|
268 |
</script> |
|
269 |
<for list="${task.owners.unique}" delimiter="," param="task.owner" > |
|
179 | 270 |
<sequential> |
271 |
<var name="task.owner" value="@{task.owner}"/> |
|
272 |
<if> |
|
588 | 273 |
<isset property="email.ldap.server"/> |
179 | 274 |
<then> |
588 | 275 |
<hlm:ldap url="${email.ldap.server}" rootdn="${email.ldap.rootdn}" filter="uid=${task.owner}" outputproperty="task.owner.email" key="mail"/> |
276 |
<if> |
|
277 |
<isset property="task.owners.email"/> |
|
278 |
<then> |
|
279 |
<var name="task.owners.email" value="${task.owners.email},${task.owner.email}"/> |
|
280 |
</then> |
|
281 |
<else> |
|
282 |
<var name="task.owners.email" value="${task.owner.email}"/> |
|
283 |
</else> |
|
284 |
</if> |
|
285 |
</then> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
286 |
</if> |
179 | 287 |
</sequential> |
288 |
</for> |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
289 |
</target> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
290 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
291 |
<!-- Finds the path to the last usable XML BOM log for creating a BOM delta. --> |
179 | 292 |
<target name="old-bom-log" unless="old.bom.log"> |
217 | 293 |
<!-- Publish dir location of the old bom log. |
294 |
@type string |
|
295 |
--> |
|
179 | 296 |
<property name="old.bom.log.publish.dir" value="${publish.dir}" /> |
217 | 297 |
<!-- Location of XML BOM log. |
298 |
@type string |
|
299 |
@scope private |
|
300 |
--> |
|
179 | 301 |
<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
|
302 |
<script language="jython" setbeans="false"> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
303 |
import re |
179 | 304 |
import ant |
305 |
import os |
|
306 |
from com.nokia.ant.util import Helper |
|
307 |
||
308 |
previousbuildnumber = 1 |
|
309 |
buildnumber = Helper.getProperty(project, "build.number") |
|
310 |
bomlog = project.getProperty("bom.log") |
|
311 |
while(previousbuildnumber > 0 and previousbuildnumber != ''): |
|
312 |
previousbuildnumber = ant.get_previous_build_number(buildnumber) |
|
313 |
try: |
|
314 |
old_bom_log = re.sub(r'\.(%s)([\/_])' % project.getProperty("build.number"), r'.' + previousbuildnumber + r'\2', bomlog) |
|
315 |
if os.path.exists(old_bom_log): |
|
316 |
break |
|
317 |
except ValueError: |
|
318 |
self.log("Old BOM cannot be found") |
|
319 |
buildnumber = previousbuildnumber |
|
320 |
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
|
321 |
</script> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
322 |
<echo>Previous BOM log: ${old.bom.log}</echo> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
323 |
<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
|
324 |
<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
|
325 |
</target> |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
326 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
327 |
</project> |