Merge oem-tl-tools:multiple_series into oem-tl-tools:devel
- Git
- lp:oem-tl-tools
- multiple_series
- Merge into devel
Status: | Needs review |
---|---|
Proposed branch: | oem-tl-tools:multiple_series |
Merge into: | oem-tl-tools:devel |
Diff against target: |
1335 lines (+707/-150) 19 files modified
dev/null (+0/-16) lp/stella_lp.py (+15/-5) profiles/profile01.json (+17/-0) profiles/profile02.json (+19/-0) profiles/profile03.json (+14/-0) profiles/profile04.json (+33/-0) profiles/profile05.json (+58/-0) profiles/profile06.json (+21/-0) profiles/profile07.json (+14/-0) profiles/profile08.json (+15/-0) profiles/profile09.json (+17/-0) profiles/profile10.json (+7/-8) profiles/profile11.json (+25/-15) profiles/profile12.json (+33/-0) profiles/profile13.json (+25/-0) templates/ibs-info.template (+59/-0) templates/stella-code-freeze.template (+48/-0) templates/update-package-request.template (+12/-0) tllp.py (+275/-106) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bofu Chen | Pending | ||
Review via email: mp+263863@code.launchpad.net |
Commit message
Description of the change
- 65b7b04... by Tammy Yang <email address hidden>
-
polish tllp
- ee2ca58... by Tammy Yang <email address hidden>
-
Merge branch 'devel' of git+ssh:
//git.launchpad .net/~oem- tl/oem- tl-tools/ +git/oem- tl-tools into multiple_series - c4c5e01... by Tammy Yang <email address hidden>
-
add docstring and more polishment to tllp
- 93936b9... by Tammy Yang
-
make the description simpler in profile1 and polish the code to match pep8
- 840b5c6... by Tammy Yang <email address hidden>
-
change the ibs-info template
- db4fd99... by Tammy Yang <email address hidden>
-
delete dup profiles, add category and rename some
- 209bcf2... by Tammy Yang <email address hidden>
-
fix typo in tllp.py
- 7aa626c... by Tammy Yang
-
add lp_set_
milestone_ summary - 320d6c3... by Tammy Yang <email address hidden>
-
update ibs-info.template
- 3da2151... by Tammy Yang <email address hidden>
-
add new profile to search bt with exclusive filter
- 091a3d3... by Tammy Yang <email address hidden>
-
update profile04 with right tag format
- 7a033b0... by Bofu Chen
-
* profiles/
profile04. json
- Update profile description. - 84f4c59... by Tammy Yang <email address hidden>
-
add profile12.json and stella-
code-freeze. template - 0929805... by Tammy Yang <email address hidden>
-
Merge branch 'multiple_series' of git+ssh:
//git.launchpad .net/~oem- tl/oem- tl-tools/ +git/oem- tl-tools into multiple_series - 299f0b4... by Tammy Yang <email address hidden>
-
add new profile to file bug for pull-staging-
request on staging
Unmerged commits
- 299f0b4... by Tammy Yang <email address hidden>
-
add new profile to file bug for pull-staging-
request on staging - 0929805... by Tammy Yang <email address hidden>
-
Merge branch 'multiple_series' of git+ssh:
//git.launchpad .net/~oem- tl/oem- tl-tools/ +git/oem- tl-tools into multiple_series - 84f4c59... by Tammy Yang <email address hidden>
-
add profile12.json and stella-
code-freeze. template - 7a033b0... by Bofu Chen
-
* profiles/
profile04. json
- Update profile description. - 091a3d3... by Tammy Yang <email address hidden>
-
update profile04 with right tag format
- 3da2151... by Tammy Yang <email address hidden>
-
add new profile to search bt with exclusive filter
- 320d6c3... by Tammy Yang <email address hidden>
-
update ibs-info.template
- 7aa626c... by Tammy Yang
-
add lp_set_
milestone_ summary - 209bcf2... by Tammy Yang <email address hidden>
-
fix typo in tllp.py
- db4fd99... by Tammy Yang <email address hidden>
-
delete dup profiles, add category and rename some
Preview Diff
1 | diff --git a/lp/stella_lp.py b/lp/stella_lp.py |
2 | index 63c139c..9670104 100644 |
3 | --- a/lp/stella_lp.py |
4 | +++ b/lp/stella_lp.py |
5 | @@ -269,6 +269,8 @@ class GetLaunchpadObject: |
6 | bug_content = {'title': None, 'description': None} |
7 | for key in bug_content.keys(): |
8 | bug_content[key] = kwargs[key] |
9 | + if self.dr: |
10 | + return None |
11 | return self.lp.bugs.createBug( |
12 | title = bug_content['title'], |
13 | description = bug_content['description'], |
14 | @@ -291,9 +293,12 @@ class GetLaunchpadObject: |
15 | if value is None: |
16 | continue |
17 | if key == "tags": |
18 | - oldtags = bug.tags |
19 | - value = value if type(value) is list else [value] |
20 | - bug.tags = oldtags + value |
21 | + try: |
22 | + oldtags = bug.tags |
23 | + value = value if type(value) is list else [value] |
24 | + bug.tags = oldtags + value |
25 | + except AttributeError: |
26 | + pass |
27 | elif key == "title": |
28 | bug.title = value |
29 | elif key == "comment": |
30 | @@ -303,8 +308,8 @@ class GetLaunchpadObject: |
31 | elif key == "series": |
32 | if not self.dr: |
33 | self.lp_add_target(bug, value, project=project) |
34 | - logging.debug("SetBug: {0} processed.".format(bug.web_link)) |
35 | if not self.dr: |
36 | + logging.debug("SetBug: {0} processed.".format(bug.web_link)) |
37 | bug.lp_save() |
38 | |
39 | def lp_set_bugtasks(self, tasks=None, **kwargs): |
40 | @@ -326,7 +331,7 @@ class GetLaunchpadObject: |
41 | except: |
42 | pass |
43 | for __bt in bt_list: |
44 | - logging.debug("lp_set_bugtasks: {0} processed.".format(bugtask.web_link)) |
45 | + logging.debug("lp_set_bugtasks: {0} processed.".format(__bt.web_link)) |
46 | for key in [key for key in kwargs.keys() if kwargs[key] is not None]: |
47 | value = kwargs[key] |
48 | if key == "status": |
49 | @@ -392,6 +397,11 @@ class GetLaunchpadObject: |
50 | except: |
51 | return 'No Milestone' |
52 | |
53 | + def lp_set_milestone_summary(self, milestone_name, summary_text, prj='stella'): |
54 | + m = self.lp_get_milestone(milestone_name, project_name=prj) |
55 | + m.summary = summary_text |
56 | + m.lp_save() |
57 | + |
58 | def lp_get_milestone(self, milestone_name, project_name='stella'): |
59 | try: |
60 | if milestone_name.find(BASELINK) == -1: |
61 | diff --git a/profiles/profile01.json b/profiles/profile01.json |
62 | new file mode 100644 |
63 | index 0000000..13d2149 |
64 | --- /dev/null |
65 | +++ b/profiles/profile01.json |
66 | @@ -0,0 +1,17 @@ |
67 | +{ |
68 | + "Cate": "SINGLE", |
69 | + "Description": "Change milestone of the tasks.", |
70 | + "orig": { |
71 | + "target": { |
72 | + "project": "somerville", |
73 | + "series": "csmb-vivid-skl" |
74 | + }, |
75 | + "filters": { |
76 | + "status": "OPEN", |
77 | + "milestone": "csmb-vivid-skl-m2"} |
78 | + }, |
79 | + "new": { |
80 | + "milestone": "csmb-vivid-skl-m3" |
81 | + }, |
82 | + "run": "set_bts" |
83 | +} |
84 | diff --git a/profiles/profile02.json b/profiles/profile02.json |
85 | new file mode 100644 |
86 | index 0000000..e3bbbca |
87 | --- /dev/null |
88 | +++ b/profiles/profile02.json |
89 | @@ -0,0 +1,19 @@ |
90 | +{ |
91 | + "Cate": "MULTIPLE", |
92 | + "Description": "Target bugs to a new series, align attributes with trunk and assign milestone.", |
93 | + "orig": { |
94 | + "target": { |
95 | + "project": "somerville", |
96 | + "series": "csmb-vivid-skl" |
97 | + }, |
98 | + "filters": { |
99 | + "status": "FIXED", |
100 | + "tags": "tulip-intel-skl" |
101 | + } |
102 | + }, |
103 | + "new": { |
104 | + "series": "csmb-vivid-skl", |
105 | + "milestone": "csmb-vivid-skl-m3" |
106 | + }, |
107 | + "run": "set_series_for_tasks" |
108 | +} |
109 | diff --git a/profiles/profile03.json b/profiles/profile03.json |
110 | new file mode 100644 |
111 | index 0000000..c3db17b |
112 | --- /dev/null |
113 | +++ b/profiles/profile03.json |
114 | @@ -0,0 +1,14 @@ |
115 | +{ |
116 | + "Cate": "MULTIPLE", |
117 | + "Description": "Assign bugs automatically.", |
118 | + "orig": { |
119 | + "target": { |
120 | + "project": "somerville" |
121 | + }, |
122 | + "filters": { |
123 | + "assignee": "bafu", |
124 | + "status": "Confirmed" |
125 | + } |
126 | + }, |
127 | + "run": "tl_assign" |
128 | +} |
129 | diff --git a/profiles/profile04.json b/profiles/profile04.json |
130 | new file mode 100644 |
131 | index 0000000..2258aa4 |
132 | --- /dev/null |
133 | +++ b/profiles/profile04.json |
134 | @@ -0,0 +1,33 @@ |
135 | +{ |
136 | + "Cate": "MULTIPLE", |
137 | + "Description": "Create a release info bug using the description template.", |
138 | + "orig": { |
139 | + "target": { |
140 | + "project": "somerville" |
141 | + } |
142 | + }, |
143 | + "new": { |
144 | + "title": "[Info] IBS INFO somerville", |
145 | + "description": "/home/tammy/SOURCE/PES/oem-tl-tools/templates/ibs-info.template", |
146 | + "des_vars": { |
147 | + "platforms": ["bluefin", "cod"], |
148 | + "group": "aio-vivid-skl", |
149 | + "date": "20150723", |
150 | + "image_index": "1", |
151 | + "manifest": "X08", |
152 | + "iso_md5": "1516f9f707f2cc48ec4fc1e20e2c110f", |
153 | + "milestone": "m5" |
154 | + }, |
155 | + "args_bt": { |
156 | + "status": "Confirmed", |
157 | + "importance": "High", |
158 | + "assignee": "wanchingy", |
159 | + "milestone": "aio-vivid-skl-m5" |
160 | + }, |
161 | + "args_bug": { |
162 | + "tags": ["bluefin", "cod"], |
163 | + "series": "aio-vivid-skl" |
164 | + } |
165 | + }, |
166 | + "run": "create_bug" |
167 | +} |
168 | diff --git a/profiles/profile05.json b/profiles/profile05.json |
169 | new file mode 100644 |
170 | index 0000000..408088a |
171 | --- /dev/null |
172 | +++ b/profiles/profile05.json |
173 | @@ -0,0 +1,58 @@ |
174 | +{ |
175 | + "Cate": "SINGLE", |
176 | + "Description": "Target the filtered bugs to a list of input series.", |
177 | + "orig": { |
178 | + "target": { |
179 | + "project": "somerville", |
180 | + "series": "vivid" |
181 | + }, |
182 | + "filters": { |
183 | + "status": "ALL" |
184 | + } |
185 | + }, |
186 | + "new": [ |
187 | + { |
188 | + "series": "csmb-vivid-skl", |
189 | + "tags": [ |
190 | + "maple-intel-skl", |
191 | + "woods-intel-skl", |
192 | + "pandora-intel-skl", |
193 | + "tulip-intel-skl", |
194 | + "vangogh-intel-skl", |
195 | + "iris-intel-skl", |
196 | + "monet-intel-skl" |
197 | + ] |
198 | + }, |
199 | + { |
200 | + "series": "aio-vivid-skl", |
201 | + "tags": [ |
202 | + "bluefin", |
203 | + "cod", |
204 | + "jasmine-intel-skl", |
205 | + "colorado-sunflower-intel-skl" |
206 | + ] |
207 | + }, |
208 | + { |
209 | + "series": "biz-vivid-skl", |
210 | + "tags": [ |
211 | + "parkcity-12-14-15-p", |
212 | + "miramar-15-17", |
213 | + "beavercreek-12-14", |
214 | + "loveland-14-15-skl", |
215 | + "berlinetta-p", |
216 | + "dino2" |
217 | + ] |
218 | + }, |
219 | + { |
220 | + "series": "fish-skl", |
221 | + "tags": [ |
222 | + "swordfish", |
223 | + "triggerfish", |
224 | + "whitefish", |
225 | + "farallon", |
226 | + "tahoe-lotus-intel-skl" |
227 | + ] |
228 | + } |
229 | + ], |
230 | + "run": "add_multiple_serieses" |
231 | +} |
232 | diff --git a/profiles/profile06.json b/profiles/profile06.json |
233 | new file mode 100644 |
234 | index 0000000..745eef5 |
235 | --- /dev/null |
236 | +++ b/profiles/profile06.json |
237 | @@ -0,0 +1,21 @@ |
238 | +{ |
239 | + "Cate": "MULTIPLE", |
240 | + "Description": "Input a list of bug IDs, target the bug to new series and keep the status/assignee/importance the same as trunk", |
241 | + "orig": { |
242 | + "target": { |
243 | + "bugs": [ |
244 | + "1443233", "1443237", "1443243", "1443247", |
245 | + "1444245", "1444253", "1446978", "1447434", |
246 | + "1456487", "1443232", "1444254", "1446542", |
247 | + "1448902", "1457715", "1458482", "1464151", |
248 | + "1464152", "1443241", "1443245", "1446531" |
249 | + ] |
250 | + }, |
251 | + "filters": {} |
252 | + }, |
253 | + "new": { |
254 | + "series": "lily-intel-bsw", |
255 | + "project": "somerville" |
256 | + }, |
257 | + "run": "add_series_to_tasks" |
258 | +} |
259 | diff --git a/profiles/profile07.json b/profiles/profile07.json |
260 | new file mode 100644 |
261 | index 0000000..5dc4fc7 |
262 | --- /dev/null |
263 | +++ b/profiles/profile07.json |
264 | @@ -0,0 +1,14 @@ |
265 | +{ |
266 | + "Cate": "SINGLE", |
267 | + "Description": "Transfer tasks from one assignee to another.", |
268 | + "orig": { |
269 | + "project": "somerville", |
270 | + "target": {"people": "wanchingy"}, |
271 | + "filters": {"status": "OPEN", |
272 | + "series": "somerville"} |
273 | + }, |
274 | + "new": { |
275 | + "assignee": "wanchingy" |
276 | + }, |
277 | + "run": "set_bts" |
278 | +} |
279 | diff --git a/profiles/profile08.json b/profiles/profile08.json |
280 | new file mode 100644 |
281 | index 0000000..ef21717 |
282 | --- /dev/null |
283 | +++ b/profiles/profile08.json |
284 | @@ -0,0 +1,15 @@ |
285 | +{ |
286 | + "Cate": "QUERY", |
287 | + "Description": "List bugtasks match multiple tags (can add milestone/status/importance in filters to filter tasks further.", |
288 | + "orig": { |
289 | + "target": { |
290 | + "project": "somerville", |
291 | + "series": "csmb-vivid-skl" |
292 | + }, |
293 | + "filters": { |
294 | + "status": "ALL", |
295 | + "tags": ["tulip-intel-skl", "maple-intel-skl"] |
296 | + } |
297 | + }, |
298 | + "run": "list_bts" |
299 | +} |
300 | diff --git a/profiles/profile09.json b/profiles/profile09.json |
301 | new file mode 100644 |
302 | index 0000000..051da2d |
303 | --- /dev/null |
304 | +++ b/profiles/profile09.json |
305 | @@ -0,0 +1,17 @@ |
306 | +{ |
307 | + "Cate": "SINGLE", |
308 | + "Description": "Add tags for all filtered bugs.", |
309 | + "orig": { |
310 | + "target": { |
311 | + "project": "somerville", |
312 | + "series": "vivid" |
313 | + }, |
314 | + "filters": { |
315 | + "status": "ALL" |
316 | + } |
317 | + }, |
318 | + "new": { |
319 | + "tags": "must-include" |
320 | + }, |
321 | + "run": "set_bugs" |
322 | +} |
323 | diff --git a/profiles/profile1.json b/profiles/profile1.json |
324 | deleted file mode 100644 |
325 | index 1264f85..0000000 |
326 | --- a/profiles/profile1.json |
327 | +++ /dev/null |
328 | @@ -1,16 +0,0 @@ |
329 | -{ |
330 | - "Description": "Move tasks to the specified milestone in the same series.", |
331 | - "orig": { |
332 | - "target": { |
333 | - "project": "somerville", |
334 | - "series": "csmb-vivid-skl" |
335 | - }, |
336 | - "filters": { |
337 | - "status": "OPEN", |
338 | - "milestone": "csmb-vivid-skl-m2"} |
339 | - }, |
340 | - "new": { |
341 | - "milestone": "csmb-vivid-skl-m3" |
342 | - }, |
343 | - "run": "set_bts" |
344 | -} |
345 | diff --git a/profiles/profile10.json b/profiles/profile10.json |
346 | index 15714f6..a305057 100644 |
347 | --- a/profiles/profile10.json |
348 | +++ b/profiles/profile10.json |
349 | @@ -1,21 +1,20 @@ |
350 | { |
351 | - "Description": "Find tasks without target series and add the serie. Status, importance, assignee will be alligned with the trunk tasks.", |
352 | + "Cate": "MULTIPLE", |
353 | + "Description": "Find tasks in the series and make status/assignee/importance sync with trunk.", |
354 | "orig": { |
355 | "target": { |
356 | - "project": "somerville" |
357 | + "project": "somerville", |
358 | + "series": "aio-vivid-skl" |
359 | }, |
360 | "filters": { |
361 | - "status": "ALL", |
362 | + "status": "New", |
363 | + "importance": "Undecided", |
364 | "tags": "colorado-sunflower-intel-skl" |
365 | - }, |
366 | - "ex_target": { |
367 | - "project": "somerville", |
368 | - "series": "aio-vivid-skl" |
369 | } |
370 | }, |
371 | "new": { |
372 | "series": "aio-vivid-skl", |
373 | - "milestone": "aio-vivid-skl-backlog" |
374 | + "milestone": "aio-vivid-skl-m6" |
375 | }, |
376 | "run": "set_series_for_tasks" |
377 | } |
378 | diff --git a/profiles/profile11.json b/profiles/profile11.json |
379 | index 19614ef..3c6299c 100644 |
380 | --- a/profiles/profile11.json |
381 | +++ b/profiles/profile11.json |
382 | @@ -1,19 +1,29 @@ |
383 | { |
384 | - "Description": "Find tasks in the series and make status/assignee/importance sync with trunk.", |
385 | + "Cate": "SINGLE", |
386 | + "Description": "Set bugtasks with exclusive filters", |
387 | "orig": { |
388 | - "target": { |
389 | - "project": "somerville", |
390 | - "series": "aio-vivid-skl" |
391 | + "target": { |
392 | + "project": "somerville", |
393 | + "series": "biz-vivid-skl" |
394 | + }, |
395 | + "filters": { |
396 | + "status": "OPEN", |
397 | + "importance": "Critical", |
398 | + "tags": ["miramar-15-17"] |
399 | + }, |
400 | + "ex_target": { |
401 | + "project": "somerville", |
402 | + "series": "biz-vivid-skl" |
403 | + }, |
404 | + "ex_filters": { |
405 | + "status": "OPEN", |
406 | + "tags": ["miramar-15-17"], |
407 | + "milestone": "biz-vivid-skl-m4" |
408 | + } |
409 | }, |
410 | - "filters": { |
411 | - "status": "New", |
412 | - "importance": "Undecided", |
413 | - "tags": "colorado-sunflower-intel-skl" |
414 | - } |
415 | - }, |
416 | - "new": { |
417 | - "series": "aio-vivid-skl", |
418 | - "milestone": "aio-vivid-skl-m6" |
419 | - }, |
420 | - "run": "set_series_for_tasks" |
421 | + |
422 | + "new": { |
423 | + "milestone": "biz-vivid-skl-m4" |
424 | + }, |
425 | + "run": "set_bts" |
426 | } |
427 | diff --git a/profiles/profile12.json b/profiles/profile12.json |
428 | new file mode 100644 |
429 | index 0000000..74299ff |
430 | --- /dev/null |
431 | +++ b/profiles/profile12.json |
432 | @@ -0,0 +1,33 @@ |
433 | +{ |
434 | + "Cate": "MULTIPLE", |
435 | + "Description": "Create Stella code freeze bug.", |
436 | + "orig": { |
437 | + "target": { |
438 | + "project": "stella" |
439 | + } |
440 | + }, |
441 | + "new": { |
442 | + "title": "Stella ludao code freeze", |
443 | + "description": "/home/tammy/SOURCE/PES/oem-tl-tools/templates/stella-code-freeze.template", |
444 | + "des_vars": { |
445 | + "project": "ludao", |
446 | + "volatile_revno": "956", |
447 | + "bug_sync_devel": "11111", |
448 | + "bug_snapshot_stella": "22222", |
449 | + "bug_snapshot_dkms": "33333", |
450 | + "bug_snapshot_devel": "44444", |
451 | + "bugsy_revno": "257", |
452 | + "snapshot_date": "150811" |
453 | + }, |
454 | + "args_bt": { |
455 | + "status": "Confirmed", |
456 | + "importance": "High", |
457 | + "assignee": "wanchingy", |
458 | + "milestone": "cnb-ludao-150814" |
459 | + }, |
460 | + "args_bug": { |
461 | + "series": "cnb-kittyhawk-3c15" |
462 | + } |
463 | + }, |
464 | + "run": "create_bug" |
465 | +} |
466 | diff --git a/profiles/profile13.json b/profiles/profile13.json |
467 | new file mode 100644 |
468 | index 0000000..d12821d |
469 | --- /dev/null |
470 | +++ b/profiles/profile13.json |
471 | @@ -0,0 +1,25 @@ |
472 | +{ |
473 | + "Cate": "MULTIPLE", |
474 | + "Description": "Create package pull-to-staging request in cloudberry", |
475 | + "orig": { |
476 | + "target": { |
477 | + "project": "cloudberry" |
478 | + } |
479 | + }, |
480 | + "new": { |
481 | + "title": "request of copy_package [somerville-csmb-vivid-skl-trusty-devel]", |
482 | + "description": "/home/tammy/SOURCE/PES/oem-tl-tools/templates/update-package-request.template", |
483 | + "des_vars": { |
484 | + "package": "dell-wireless-dkms", |
485 | + "version": "2.0", |
486 | + "group": "csmb-vivid-skl" |
487 | + }, |
488 | + "args_bt": { |
489 | + "importance": "High" |
490 | + }, |
491 | + "args_bug": { |
492 | + "tags": ["archive-request", "via-request-script"] |
493 | + } |
494 | + }, |
495 | + "run": "create_bug" |
496 | +} |
497 | diff --git a/profiles/profile2.json b/profiles/profile2.json |
498 | deleted file mode 100644 |
499 | index f0a92f4..0000000 |
500 | --- a/profiles/profile2.json |
501 | +++ /dev/null |
502 | @@ -1,18 +0,0 @@ |
503 | -{ |
504 | - "Description": "Target bugs to a new series and assign milestone.", |
505 | - "orig": { |
506 | - "target": { |
507 | - "project": "somerville", |
508 | - "series": "csmb-vivid-skl" |
509 | - }, |
510 | - "filters": { |
511 | - "status": "FIXED", |
512 | - "tags": "tulip-intel-skl" |
513 | - } |
514 | - }, |
515 | - "new": { |
516 | - "series": "csmb-vivid-skl", |
517 | - "milestone": "csmb-vivid-skl-m3" |
518 | - }, |
519 | - "run": "set_series_for_tasks" |
520 | -} |
521 | diff --git a/profiles/profile3.json b/profiles/profile3.json |
522 | deleted file mode 100644 |
523 | index 0010918..0000000 |
524 | --- a/profiles/profile3.json |
525 | +++ /dev/null |
526 | @@ -1,18 +0,0 @@ |
527 | -{ |
528 | - "Description": "For given series and milestone with filter conditions, move tasks to the specified milestone in the same series.", |
529 | - "orig": { |
530 | - "target": { |
531 | - "project": "stella", |
532 | - "series": "cnb-kittyhawk-3c15" |
533 | - }, |
534 | - "filters": { |
535 | - "milestone": "cnb-ludao-150619", |
536 | - "status": "OPEN" |
537 | - } |
538 | - }, |
539 | - "new": { |
540 | - "series": "cnb-kittyhawk-3c15", |
541 | - "milestone": "cnb-ludao-150703" |
542 | - }, |
543 | - "run": "set_bts" |
544 | -} |
545 | diff --git a/profiles/profile4.json b/profiles/profile4.json |
546 | deleted file mode 100644 |
547 | index 3f30fc1..0000000 |
548 | --- a/profiles/profile4.json |
549 | +++ /dev/null |
550 | @@ -1,18 +0,0 @@ |
551 | -{ |
552 | - "Description": "For given tasks filtered by filters, assign it automatically by detecting tags or titles.", |
553 | - "orig": { |
554 | - "target": { |
555 | - "project": "somerville", |
556 | - "series": "aio-vivid-skl" |
557 | - }, |
558 | - "filters": { |
559 | - "status": "New" |
560 | - } |
561 | - }, |
562 | - "new": { |
563 | - "series": "aio-vivid-skl", |
564 | - "milestone": "aio-vivid-skl-backlog", |
565 | - "status": "Confirmed" |
566 | - }, |
567 | - "run": "assign_series_all" |
568 | -} |
569 | diff --git a/profiles/profile5.json b/profiles/profile5.json |
570 | deleted file mode 100644 |
571 | index e1817ed..0000000 |
572 | --- a/profiles/profile5.json |
573 | +++ /dev/null |
574 | @@ -1,57 +0,0 @@ |
575 | -{ |
576 | - "Description": "Target the filtered bugs to a list of input series.", |
577 | - "orig": { |
578 | - "target": { |
579 | - "project": "somerville", |
580 | - "series": "vivid" |
581 | - }, |
582 | - "filters": { |
583 | - "status": "ALL" |
584 | - } |
585 | - }, |
586 | - "new": [ |
587 | - { |
588 | - "series": "csmb-vivid-skl", |
589 | - "tags": [ |
590 | - "maple-intel-skl", |
591 | - "woods-intel-skl", |
592 | - "pandora-intel-skl", |
593 | - "tulip-intel-skl", |
594 | - "vangogh-intel-skl", |
595 | - "iris-intel-skl", |
596 | - "monet-intel-skl" |
597 | - ] |
598 | - }, |
599 | - { |
600 | - "series": "aio-vivid-skl", |
601 | - "tags": [ |
602 | - "bluefin", |
603 | - "cod", |
604 | - "jasmine-intel-skl", |
605 | - "colorado-sunflower-intel-skl" |
606 | - ] |
607 | - }, |
608 | - { |
609 | - "series": "biz-vivid-skl", |
610 | - "tags": [ |
611 | - "parkcity-12-14-15-p", |
612 | - "miramar-15-17", |
613 | - "beavercreek-12-14", |
614 | - "loveland-14-15-skl", |
615 | - "berlinetta-p", |
616 | - "dino2" |
617 | - ] |
618 | - }, |
619 | - { |
620 | - "series": "fish-skl", |
621 | - "tags": [ |
622 | - "swordfish", |
623 | - "triggerfish", |
624 | - "whitefish", |
625 | - "farallon", |
626 | - "tahoe-lotus-intel-skl" |
627 | - ] |
628 | - } |
629 | - ], |
630 | - "run": "add_multiple_serieses" |
631 | -} |
632 | diff --git a/profiles/profile6.json b/profiles/profile6.json |
633 | deleted file mode 100644 |
634 | index 816465c..0000000 |
635 | --- a/profiles/profile6.json |
636 | +++ /dev/null |
637 | @@ -1,20 +0,0 @@ |
638 | -{ |
639 | - "Description": "Input a list of bug IDs, target the bug to new series and keep the status/assignee/importance the same as trunk", |
640 | - "orig": { |
641 | - "target": { |
642 | - "bugs": [ |
643 | - "1443233", "1443237", "1443243", "1443247", |
644 | - "1444245", "1444253", "1446978", "1447434", |
645 | - "1456487", "1443232", "1444254", "1446542", |
646 | - "1448902", "1457715", "1458482", "1464151", |
647 | - "1464152", "1443241", "1443245", "1446531" |
648 | - ] |
649 | - }, |
650 | - "filters": {} |
651 | - }, |
652 | - "new": { |
653 | - "series": "lily-intel-bsw", |
654 | - "project": "somerville" |
655 | - }, |
656 | - "run": "add_series_by_ids" |
657 | -} |
658 | diff --git a/profiles/profile7.json b/profiles/profile7.json |
659 | deleted file mode 100644 |
660 | index 74d7f95..0000000 |
661 | --- a/profiles/profile7.json |
662 | +++ /dev/null |
663 | @@ -1,13 +0,0 @@ |
664 | -{ |
665 | - "Description": "Transfer tasks from one assignee to another.", |
666 | - "orig": { |
667 | - "project": "somerville", |
668 | - "target": {"people": "wanchingy"}, |
669 | - "filters": {"status": "OPEN", |
670 | - "series": "somerville"} |
671 | - }, |
672 | - "new": { |
673 | - "assignee": "wanchingy" |
674 | - }, |
675 | - "run": "set_bts" |
676 | -} |
677 | diff --git a/profiles/profile8.json b/profiles/profile8.json |
678 | deleted file mode 100644 |
679 | index a1637fa..0000000 |
680 | --- a/profiles/profile8.json |
681 | +++ /dev/null |
682 | @@ -1,14 +0,0 @@ |
683 | -{ |
684 | - "Description": "List bugtasks in a series which match multiple tags (can add milestone/status/importance in filters to filter tasks further.", |
685 | - "orig": { |
686 | - "target": { |
687 | - "project": "somerville", |
688 | - "series": "csmb-vivid-skl" |
689 | - }, |
690 | - "filters": { |
691 | - "status": "ALL", |
692 | - "tags": ["tulip-intel-skl", "maple-intel-skl"] |
693 | - } |
694 | - }, |
695 | - "run": "list_bts" |
696 | -} |
697 | diff --git a/profiles/profile9.json b/profiles/profile9.json |
698 | deleted file mode 100644 |
699 | index 3831b67..0000000 |
700 | --- a/profiles/profile9.json |
701 | +++ /dev/null |
702 | @@ -1,16 +0,0 @@ |
703 | -{ |
704 | - "Description": "Add tags for all filtered bugs.", |
705 | - "orig": { |
706 | - "target": { |
707 | - "project": "somerville", |
708 | - "series": "vivid" |
709 | - }, |
710 | - "filters": { |
711 | - "status": "ALL" |
712 | - } |
713 | - }, |
714 | - "new": { |
715 | - "tags": "must-include" |
716 | - }, |
717 | - "run": "set_bugs" |
718 | -} |
719 | diff --git a/templates/ibs-info.template b/templates/ibs-info.template |
720 | new file mode 100644 |
721 | index 0000000..b6defd1 |
722 | --- /dev/null |
723 | +++ b/templates/ibs-info.template |
724 | @@ -0,0 +1,59 @@ |
725 | +MANIFEST |
726 | + |
727 | +1. Supported platforms: |
728 | +{% for item in platforms %} |
729 | +{{ item }} |
730 | +{% endfor %} |
731 | + |
732 | +2. Manifest: |
733 | +https://oem-share.canonical.com/partners/somerville/share/Platforms/{{ group }}/{{ group }}_{{ manifest }}.html |
734 | + |
735 | +3. Superset FISH package: |
736 | +https://oem-share.canonical.com/partners/somerville/share/Platforms/{{ group }}/{{ group }}_{{ manifest }}.fish.tar.gz |
737 | + |
738 | +4. Missing Drivers: |
739 | +No |
740 | + |
741 | +5. Change/Fix in this milestone: |
742 | +https://launchpad.net/somerville/+milestone/{{ group }}-{{ milestone }} |
743 | + |
744 | +------------------------------------------------------------------------ |
745 | +IMAGE |
746 | + |
747 | +1. Project: |
748 | +https://oem-ibs.canonical.com/builds/dell-bto-trusty-{{ group }}/ |
749 | + |
750 | +2. ISO: |
751 | +https://oem-share.canonical.com/oem/cesg-builds/dell-bto-trusty-{{ group }}/{{ date }}/{{image_index}}/images/iso-hybrid/dell-bto-trusty-{{ group }}-{{ manifest }}-iso-{{ date }}-{{image_index}}.iso |
752 | + |
753 | +3. ISO Zsync: |
754 | +https://oem-share.canonical.com/oem/cesg-builds/dell-bto-trusty-{{ group }}/{{ date }}/{{image_index}}/images/iso-hybrid/dell-bto-trusty-{{ group }}-{{ manifest }}-iso-{{ date }}-{{image_index}}.iso.zsync |
755 | + |
756 | +4. ISO MD5 checksum: |
757 | +{{ iso_md5 }} |
758 | + |
759 | +------------------------------------------------------------------------ |
760 | +SANITY CHECK |
761 | + |
762 | +1. Sanity check report: |
763 | +https://goo.gl/QNR1Jw |
764 | + |
765 | +2. Auto testing reports (checkbox): |
766 | +See attachments in comments below |
767 | + |
768 | +3. Failed test: |
769 | +[${CID} (${SKU})] |
770 | +* fwts |
771 | + |
772 | +* plainbox |
773 | + |
774 | +* Note: |
775 | + |
776 | +4. Remaining Critical bugs: |
777 | +{% for item in platforms %} |
778 | +[{{ item }}] |
779 | + |
780 | +https://bugs.launchpad.net/somerville/+bugs?field.searchtext=&orderby=-importance&field.status%3Alist=NEW&field.status%3Alist=CONFIRMED&field.status%3Alist=TRIAGED&field.status%3Alist=INPROGRESS&field.status%3Alist=INCOMPLETE_WITH_RESPONSE&field.status%3Alist=INCOMPLETE_WITHOUT_RESPONSE&field.importance%3Alist=CRITICAL&assignee_option=any&field.assignee=&field.bug_reporter=&field.bug_commenter=&field.subscriber=&field.structural_subscriber=&field.tag={{ item }}+&field.tags_combinator=ANY&field.has_cve.used=&field.omit_dupes.used=&field.omit_dupes=on&field.affects_me.used=&field.has_patch.used=&field.has_branches.used=&field.has_branches=on&field.has_no_branches.used=&field.has_no_branches=on&field.has_blueprints.used=&field.has_blueprints=on&field.has_no_blueprints.used=&field.has_no_blueprints=on&search=Search |
781 | + |
782 | +{% endfor %} |
783 | + |
784 | diff --git a/templates/stella-code-freeze.template b/templates/stella-code-freeze.template |
785 | new file mode 100644 |
786 | index 0000000..adedfe3 |
787 | --- /dev/null |
788 | +++ b/templates/stella-code-freeze.template |
789 | @@ -0,0 +1,48 @@ |
790 | +** TL tasks ** |
791 | + |
792 | +1. Branch out volatile-task-core as volatile-task-core-{{ project }}: |
793 | + |
794 | +lp:~oem-solutions-group/stella-trusty/volatile-task-core-{{ project }} (revno: {{ volatile_revno }}) |
795 | + |
796 | +2. Sync packages between stella-trusty and stella-trusty-devel (lp:{{ bug_sync_devel }}) |
797 | +$chives-pull-suite-request --target stella-trusty-devel --pull stella-trusty |
798 | + |
799 | +3. Snapshot of the following suite: |
800 | + |
801 | +- stella-trusty (lp:{{ bug_snapshot_stella }}) |
802 | +$chives-gensnapshot --suite stella-trusty |
803 | + |
804 | +- oem-trusty-staging-trusty-devel (lp:{{ bug_snapshot_dkms }}) |
805 | +$chives-gensnapshot --suite oem-trusty-staging-trusty-devel |
806 | + |
807 | +- stella-trusty-devel (lp:{{ bug_snapshot_devel }}) |
808 | +$chives-gensnapshot --suite stella-trusty-devel |
809 | + |
810 | +4. Branch out stella-base-trusty-amd64 and modify chroot_sources/internal-development-mirror.chroot to include snapshots |
811 | + |
812 | +lp:~oem-solutions-engineers/bugsy-config/stella-{{ project }}-trusty-amd64 (revno: {{ bugsy_revno }}) |
813 | + |
814 | +- content of chroot_sources/internal-development-mirror.chroot (don't touch ubuntu-updates and oem-base-image repositories) |
815 | + |
816 | +#Stella suite |
817 | +deb http://cesg-mirror.buildd/cesg-mirror/ stella-trusty-devel/snapshots/{{ snapshot_date }} public private |
818 | +deb-src http://cesg-mirror.buildd/cesg-mirror/ stella-trusty-devel/snapshots/{{ snapshot_date }} public private |
819 | + |
820 | +#oem driver suite |
821 | +deb http://cesg-mirror.buildd/cesg-mirror/ oem-trusty-staging-trusty-devel/snapshots/{{ snapshot_date }} public private |
822 | +deb-src http://cesg-mirror.buildd/cesg-mirror/ oem-trusty-staging-trusty-devel/snapshots/{{ snapshot_date }} public private |
823 | + |
824 | +#project suite |
825 | +deb http://cesg-mirror.buildd/cesg-mirror/ stella-{{ project }}-trusty-devel public private |
826 | +deb-src http://cesg-mirror.buildd/cesg-mirror/ stella-{{ project }}-trusty-devel public private |
827 | + |
828 | +** Instruction for engineers after code freeze ** |
829 | + |
830 | +- volatile-task-core branch |
831 | +lp:~oem-solutions-group/stella-trusty/volatile-task-core-{{ project }} |
832 | + |
833 | +- package PPA |
834 | +https://launchpad.net/~oem-archive/+archive/ubuntu/stella-{{ project }} |
835 | + |
836 | +- bugsy-config branch |
837 | +lp:~oem-solutions-engineers/bugsy-config/stella-{{ project }}-trusty-amd64 |
838 | diff --git a/templates/update-package-request.template b/templates/update-package-request.template |
839 | new file mode 100644 |
840 | index 0000000..50bcf63 |
841 | --- /dev/null |
842 | +++ b/templates/update-package-request.template |
843 | @@ -0,0 +1,12 @@ |
844 | +Operation: copy_package |
845 | +Source: somerville-{{ group }}-trusty-devel |
846 | +Destination: somerville-{{ group }}-trusty-staging |
847 | +Package: {{ package }} (=={{ version }}) |
848 | +Production: trusty-dell-{{ group }} |
849 | +===== Description ===== |
850 | + |
851 | +Please verify production suite with below sources.list: |
852 | +""" |
853 | +deb http://cesg.archive.canonical.com/updates trusty-dell-{{ group }} public |
854 | +deb-src http://cesg.archive.canonical.com/updates trusty-dell-{{ group }} public |
855 | +""" |
856 | diff --git a/tllp.py b/tllp.py |
857 | index 0969270..401fff8 100644 |
858 | --- a/tllp.py |
859 | +++ b/tllp.py |
860 | @@ -8,6 +8,11 @@ from lp import stella_lp |
861 | |
862 | |
863 | def parse_json(fname=os.getcwd()+'/bug_profile.json'): |
864 | + """Parse json file |
865 | + |
866 | + @param fname: Path of the input json file |
867 | + |
868 | + """ |
869 | with open(fname) as data_file: |
870 | data = json.load(data_file) |
871 | return data |
872 | @@ -44,8 +49,8 @@ class TLTools(object): |
873 | def __init__(self, pf, dryrun): |
874 | """TLTools class initialization function. |
875 | |
876 | - @param orig: The orig section in profile. |
877 | - @param new: The new section in profile. |
878 | + @param pd: The profile dictionary |
879 | + @param dryrun: True without saving modifications on launchpad |
880 | |
881 | """ |
882 | self.orig = pf['orig'] |
883 | @@ -55,7 +60,10 @@ class TLTools(object): |
884 | logging.info('There is no "new" defined in the profile.') |
885 | self.new = None |
886 | logging.debug(self.orig['target']) |
887 | - logging.debug(self.orig['filters']) |
888 | + try: |
889 | + logging.debug(self.orig['filters']) |
890 | + except: |
891 | + pass |
892 | self.slp = stella_lp.GetLaunchpadObject(consumer="stella-botapi", |
893 | dryrun=dryrun) |
894 | try: |
895 | @@ -67,9 +75,66 @@ class TLTools(object): |
896 | self.project = raw_input( |
897 | 'Input the project name (somerville/stella). ') |
898 | |
899 | + def read_template(self, fname, temp_vars): |
900 | + """Read jinja template |
901 | + |
902 | + @param fname: Inpur file name |
903 | + @temp_vars: Variable dictionary to be used for the template |
904 | + |
905 | + @return: Rendered template |
906 | + |
907 | + """ |
908 | + from jinja2 import FileSystemLoader, Environment |
909 | + templateLoader = FileSystemLoader(searchpath="/") |
910 | + templateEnv = Environment(loader=templateLoader) |
911 | + try: |
912 | + template = templateEnv.get_template(fname) |
913 | + return template.render(temp_vars) |
914 | + except Exception, e: |
915 | + print >> sys.stderr, "Exception: %s" % str(e) |
916 | + sys.exit(1) |
917 | + |
918 | + def create_bug(self): |
919 | + """Create bug from the defined title/description in self.new""" |
920 | + |
921 | + args = {} |
922 | + try: |
923 | + title = self.new['title'] |
924 | + description = self.new['description'] |
925 | + except KeyError: |
926 | + logging.error('Please define description and title in "new"') |
927 | + return |
928 | + |
929 | + if self.new['description'][-9:] == '.template': |
930 | + try: |
931 | + description = self.read_template(self.new['description'], |
932 | + self.new['des_vars']) |
933 | + except KeyError: |
934 | + logging.error('Please define des_vars in "new"') |
935 | + return |
936 | + |
937 | + new_bug = self.slp.lp_create_bug(project=self.project, title=title, |
938 | + description=description) |
939 | + if new_bug is not None: |
940 | + logging.info("Creating %s" % new_bug.id) |
941 | + try: |
942 | + self.new['args_bug']['project'] = self.project |
943 | + self.slp.lp_set_bug(new_bug, **self.new['args_bug']) |
944 | + except KeyError: |
945 | + pass |
946 | + try: |
947 | + self.new['args_bt']['project'] = self.project |
948 | + _tasks = [bt for bt in new_bug.bug_tasks] |
949 | + self.slp.lp_set_bugtasks(tasks=_tasks, **self.new['args_bt']) |
950 | + except KeyError: |
951 | + pass |
952 | + |
953 | def get_tasks_by_orig(self): |
954 | """Get a list of bug tasks based on the orig profile section. |
955 | |
956 | + mandatary: target, filters |
957 | + optional: ex_target, ex_filters |
958 | + |
959 | @return: List of bug tasks. |
960 | |
961 | """ |
962 | @@ -86,50 +151,56 @@ class TLTools(object): |
963 | except KeyError: |
964 | excluded_tasks = self.slp.define_tasks(self.orig['ex_target'], |
965 | self.orig['filters']) |
966 | - excluded_ids = [t.bug.id for t in excluded_tasks] |
967 | - return [t for t in tasks if t.bug.id not in excluded_ids] |
968 | + excluded_ids = [bt.bug.id for bt in excluded_tasks] |
969 | + return [bt for bt in tasks if bt.bug.id not in excluded_ids] |
970 | return tasks |
971 | |
972 | - def set_series(self, t, new_target): |
973 | + def set_series(self, bt, new_target, milestone=None): |
974 | """Add new series and update its bug attributes. |
975 | |
976 | - This function does 2 things at the same time: |
977 | - |
978 | - 1. Update trunk bug attributes (status, importance, etc). |
979 | - 2. Add a new series, and set its bug attributes the same as |
980 | - the trunk bug attributes. |
981 | + The function adds a new series, and set its bug attributes the same as |
982 | + the trunk bug attributes. |
983 | |
984 | - @param t: The target bug task. |
985 | + @param bt: The target bug task. |
986 | @param new_target: The new series which will be added. |
987 | - @param project: The project name of the target bug task. |
988 | - @param args_bug: Bug attributes with updated values. |
989 | |
990 | """ |
991 | - bug = t.bug |
992 | - if os.path.basename(t.bug_target_name) == new_target: |
993 | - trunk_t = self.slp.find_trunk_task_for_bt(t, self.project)[0] |
994 | + bug = bt.bug |
995 | + if os.path.basename(bt.bug_target_name) == new_target: |
996 | + trunk_t = self.slp.find_trunk_task_for_bt(bt, self.project)[0] |
997 | args_bt = {"status": trunk_t.status, "assignee": trunk_t.assignee, |
998 | "importance": trunk_t.importance} |
999 | else: |
1000 | self.slp.lp_set_bug(bug, series=new_target, project=self.project) |
1001 | - args_bt = {"status": t.status, "assignee": t.assignee, |
1002 | - "importance": t.importance} |
1003 | + args_bt = {"status": bt.status, "assignee": bt.assignee, |
1004 | + "importance": bt.importance} |
1005 | args_bt["project"] = self.project |
1006 | - try: |
1007 | - args_bt["milestone"] = self.new["milestone"] |
1008 | - except KeyError: |
1009 | - pass |
1010 | + if milestone is not None: |
1011 | + args_bt["milestone"] = milestone |
1012 | + else: |
1013 | + try: |
1014 | + args_bt["milestone"] = self.new["milestone"] |
1015 | + except: |
1016 | + pass |
1017 | |
1018 | _target = {"bugs": bug.id} |
1019 | _filters = {"series": new_target} |
1020 | - _t = self.slp.define_tasks(_target, _filters) |
1021 | - self.slp.lp_set_bugtasks(tasks=_t, **args_bt) |
1022 | + _bt = self.slp.define_tasks(_target, _filters) |
1023 | + self.slp.lp_set_bugtasks(tasks=_bt, **args_bt) |
1024 | + return _bt[0] #FIXME might cause exception during dryrun |
1025 | + |
1026 | + def add_series_to_tasks(self): |
1027 | + """Add series for filtered bug_tasks and align attributes to trunk """ |
1028 | |
1029 | - def add_series_by_ids(self): |
1030 | tasks = self.get_tasks_by_orig() |
1031 | - if self.print_tasks(tasks): |
1032 | - for t in tasks: |
1033 | - self.set_series(t, self.new['series']) |
1034 | + |
1035 | + self.print_tasks(tasks) |
1036 | + q = 'Add %s to total %i tasks?' % (self.new['series'], len(tasks)) |
1037 | + if not self.confirm_set_bool(q): |
1038 | + return |
1039 | + |
1040 | + for bt in tasks: |
1041 | + self.set_series(bt, self.new['series']) |
1042 | |
1043 | def add_multiple_serieses(self): |
1044 | """Add series for multiple bugs at the same time. |
1045 | @@ -139,32 +210,69 @@ class TLTools(object): |
1046 | |
1047 | """ |
1048 | tasks = self.get_tasks_by_orig() |
1049 | - if self.print_tasks(tasks): |
1050 | - for cond in self.new: |
1051 | - for t in tasks: |
1052 | - self.set_series(t, cond['series']) |
1053 | - |
1054 | - def print_task(self, t): |
1055 | - logging.debug('=============== ') |
1056 | - logging.debug(' %s' % t.web_link) |
1057 | - logging.debug('Bug Title: %s' % t.bug.title) |
1058 | - _a = self.slp.lp_get_assignee_name_of_task(t) |
1059 | - _m = self.slp.lp_get_milestone_name_of_task(t) |
1060 | - logging.debug('%s/%s/%s/%s (Importance/Status/Assignee/Milestone)' |
1061 | - % (t.importance, t.status, _a, _m)) |
1062 | - |
1063 | - def print_tasks(self, tasks, print_only=False): |
1064 | - if type(tasks) is list and len(tasks) > 0: |
1065 | - for t in tasks: |
1066 | - self.print_task(t) |
1067 | - if print_only: |
1068 | - return False |
1069 | - _ans = raw_input('Set total %i bugtasks?' % len(tasks)) |
1070 | - ans = True if _ans in ['y', 'Y'] else False |
1071 | - return ans |
1072 | - return False |
1073 | |
1074 | - def auto_assign(self, t, assign_dic, **bt_args): |
1075 | + self.print_tasks(tasks) |
1076 | + q = 'Add multiple target series for total %i tasks?' % len(tasks) |
1077 | + if not self.confirm_set_bool(q): |
1078 | + return |
1079 | + |
1080 | + for cond in self.new: |
1081 | + for bt in tasks: |
1082 | + self.set_series(bt, cond['series']) |
1083 | + |
1084 | + def filter_tags(self, tags): |
1085 | + """Exclude non-platform tags |
1086 | + |
1087 | + @param tags: input tag list |
1088 | + |
1089 | + @return: filtered tag list |
1090 | + |
1091 | + """ |
1092 | + new_list = [] |
1093 | + for tag in tags: |
1094 | + if tag.find('hwe-') != -1: |
1095 | + continue |
1096 | + if tag.find('ihv-') != -1: |
1097 | + continue |
1098 | + if tag.find('oem-') != -1: |
1099 | + continue |
1100 | + if tag.find('somerville-') != -1: |
1101 | + continue |
1102 | + if tag in ['precise', 'trusty', 'vivid', 'hw-unstable', 'bits']: |
1103 | + continue |
1104 | + new_list.append(tag) |
1105 | + return new_list |
1106 | + |
1107 | + def print_task(self, bt): |
1108 | + """Print debugging messages for a given task |
1109 | + |
1110 | + @param bt: Bug task to be printed |
1111 | + |
1112 | + """ |
1113 | + |
1114 | + logging.info('=============== ') |
1115 | + logging.info('%s' % bt.web_link) |
1116 | + logging.info('Bug Title: %s' % bt.bug.title) |
1117 | + _a = self.slp.lp_get_assignee_name_of_task(bt) |
1118 | + _m = self.slp.lp_get_milestone_name_of_task(bt) |
1119 | + logging.info('%s/%s/%s/%s (Importance/Status/Assignee/Milestone)' |
1120 | + % (bt.importance, bt.status, _a, _m)) |
1121 | + logging.info(self.filter_tags(bt.bug.tags)) |
1122 | + |
1123 | + def print_tasks(self, tasks): |
1124 | + """Call print_task to print debugging messages for a list of bts |
1125 | + |
1126 | + @param tasks: A list of input tasks |
1127 | + |
1128 | + """ |
1129 | + |
1130 | + if type(tasks) is not list: |
1131 | + tasks = [tasks] |
1132 | + if len(tasks) > 0: |
1133 | + for bt in tasks: |
1134 | + self.print_task(bt) |
1135 | + |
1136 | + def auto_assign(self, t, assign_dic): |
1137 | """Change bug assignee automatically and intelligently. |
1138 | |
1139 | The assignee auto-finding rules are: |
1140 | @@ -182,12 +290,14 @@ class TLTools(object): |
1141 | if __title.find('IBS INFO') != -1 or __title.find('[Info]') != -1: |
1142 | return |
1143 | assignee = None |
1144 | - for key in [k for k in assign_dic.keys() if 'hwe-' + k in bug.tags]: |
1145 | + for key in [k for k in assign_dic.keys() if 'hwe-' + k in __tags]: |
1146 | assignee = assign_dic[key] |
1147 | break |
1148 | + |
1149 | if assignee is None: |
1150 | _cate = self.slp.define_issue_type_by_title(__title) |
1151 | if _cate == 'hwe': |
1152 | + print("_cate == hwe") |
1153 | ans = raw_input('Add HWE series? (Y/N): ') |
1154 | if ans in ['y', 'Y']: |
1155 | logging.debug('Adding HWE series') |
1156 | @@ -195,69 +305,128 @@ class TLTools(object): |
1157 | "project": self.project} |
1158 | self.slp.lp_set_bug(bug, **args_bug) |
1159 | self.slp.lp_set_bugtasks(tasks=t, status="Triaged") |
1160 | + elif _cate is None: |
1161 | + assignee = raw_input('Input the launchpad ID to assign: ') |
1162 | else: |
1163 | - if _cate is None: |
1164 | - assignee = raw_input('Input the launchpad ID to assign: ') |
1165 | - else: |
1166 | - assignee = assign_dic[_cate] |
1167 | - ans = raw_input('Input Y to assign to %s or input\ |
1168 | - the launchpad ID: ' % assignee) |
1169 | - if ans not in ['y', 'Y']: |
1170 | - assignee = ans |
1171 | - if assignee is not None and self.print_task(t): |
1172 | - bt_args['assignee'] = assignee |
1173 | - self.slp.lp_set_bugtasks(tasks=[t], **bt_args) |
1174 | - |
1175 | - def assign_bugs(self, pfname='./assign_profile.json'): |
1176 | - tasks = self.get_tasks_by_orig() |
1177 | - bt_args = copy.deepcopy(self.new) |
1178 | - bt_args['project'] = self.project |
1179 | - bt_args['set_trunk'] = 1 |
1180 | - assign_dic = parse_json(fname=pfname) |
1181 | - for t in tasks: |
1182 | - self.auto_assign(t, assign_dic, **bt_args) |
1183 | + assignee = self.confirm_assignee(assignee) |
1184 | + else: |
1185 | + assignee = self.confirm_assignee(assignee) |
1186 | + q = ''.join(['Confirm this issue will be assign to ', assignee, '?']) |
1187 | + if assignee is not None and self.confirm_set_bool(q): |
1188 | + self.slp.lp_set_bugtasks(tasks=[t], assignee=assignee, |
1189 | + set_trunk=1, project=self.project) |
1190 | + |
1191 | + def confirm_set_bool(self, question): |
1192 | + """Interactively confirm with user |
1193 | + |
1194 | + @param question: question to ask |
1195 | |
1196 | - def check_manifest_group(self, tags): |
1197 | + @return: True if user answers y or Y, else False |
1198 | + |
1199 | + """ |
1200 | + ans = raw_input(question) |
1201 | + if ans in ['y', 'Y']: |
1202 | + return True |
1203 | + return False |
1204 | + |
1205 | + def confirm_assignee(self, ori_assignee): |
1206 | + """Interactively confirm the assignee with user |
1207 | + |
1208 | + @param question: original assignee found |
1209 | + |
1210 | + @return: assignee after checking with user |
1211 | + |
1212 | + """ |
1213 | + ans = raw_input('Y to assign the issue to %s or input another launchpad ID: ' |
1214 | + % ori_assignee) |
1215 | + if ans in ['y', 'Y']: |
1216 | + return ori_assignee |
1217 | + return ans |
1218 | + |
1219 | + def tl_assign(self, pfname='./assign_profile.json'): |
1220 | + """Search tasks assigned to TL and assign them automatically |
1221 | + |
1222 | + This function not only change the assignee but can add target series to |
1223 | + the bug, set the milestone to -backlog, and make sure the attibutes are |
1224 | + aligned with the trunk. |
1225 | + |
1226 | + @param pfname: Input assign_profile path |
1227 | + |
1228 | + """ |
1229 | tasks = self.get_tasks_by_orig() |
1230 | + assign_dic = parse_json(fname=pfname) |
1231 | for bt in tasks: |
1232 | - bt_tags = bt.bug.tags |
1233 | - _l = [_t for _t in tags if _t in bt_tags] |
1234 | - if len(_l) < 1: |
1235 | - logging.debug(bt.web_link) |
1236 | - |
1237 | - def check_tag_group(self, tags): |
1238 | - _orig_copy = copy.deepcopy(self.orig) |
1239 | - for t in tags: |
1240 | - _orig_copy['filter']['tags'] = t |
1241 | - tasks = self.slp.define_tasks(_orig_copy['target'], |
1242 | - _orig_copy['filters']) |
1243 | - for bt in tasks: |
1244 | - logging.debug(bt.web_link) |
1245 | + _bt = bt |
1246 | + self.print_tasks(bt) |
1247 | + ans = raw_input('Input the target series (t for trunk only, n to skip the assignment of this task) ') |
1248 | + if ans == 'n': |
1249 | + continue |
1250 | + if ans != 't': |
1251 | + milestone = ans + '-backlog' |
1252 | + _bt = self.set_series(bt, ans, milestone) |
1253 | + self.auto_assign(_bt, assign_dic) |
1254 | |
1255 | def list_bts(self): |
1256 | - tasks = self.get_tasks_by_orig() |
1257 | - self.print_tasks(tasks, print_only=True) |
1258 | + """List filtered tasks, no modification will be performed""" |
1259 | |
1260 | - def set_bts(self): |
1261 | tasks = self.get_tasks_by_orig() |
1262 | - self.new['project'] = self.project |
1263 | - logging.info("Set target bt to project %s" % self.new['project']) |
1264 | - if self.print_tasks(tasks): |
1265 | - for t in tasks: |
1266 | - self.slp.lp_set_bugtasks(tasks=t, **self.new) |
1267 | + self.print_tasks(tasks) |
1268 | |
1269 | - def set_bugs(self): |
1270 | - tasks = self.get_tasks_by_orig() |
1271 | - if self.print_tasks(tasks): |
1272 | - for t in tasks: |
1273 | - self.slp.lp_set_bug(t.bug, **self.new) |
1274 | + def set_bts(self, tasks=None): |
1275 | + """Set bugtasks using self.orig and self.new |
1276 | + |
1277 | + This function set the bts to new attributes defined in self.new. |
1278 | + |
1279 | + @param tasks: None to get bugs by the conditions set in self.orig |
1280 | + |
1281 | + """ |
1282 | + tasks = self.get_tasks_by_orig() if tasks is None else tasks |
1283 | + |
1284 | + try: |
1285 | + self.new['project'] = self.project |
1286 | + logging.info("Set target bt to project %s" % self.new['project']) |
1287 | + except: |
1288 | + pass |
1289 | + |
1290 | + self.print_tasks(tasks) |
1291 | + q = 'Deploy changes to total %i bug tasks?' % len(tasks) |
1292 | + if not self.confirm_set_bool(q): |
1293 | + return |
1294 | + for bt in tasks: |
1295 | + self.slp.lp_set_bugtasks(tasks=bt, **self.new) |
1296 | + |
1297 | + def set_bugs(self, tasks=None): |
1298 | + """Set bug using self.orig and self.new |
1299 | + |
1300 | + This function set bug to new attributes defined in self.new. |
1301 | + |
1302 | + @param tasks: None to get bugs by the conditions set in self.orig |
1303 | + |
1304 | + """ |
1305 | + tasks = self.get_tasks_by_orig() if tasks is None else tasks |
1306 | + |
1307 | + self.print_tasks(tasks) |
1308 | + q = 'Deploy changes to total %i bugs?' % len(tasks) |
1309 | + if not self.confirm_set_bool(q): |
1310 | + return |
1311 | + for bt in tasks: |
1312 | + self.slp.lp_set_bug(bt.bug, **self.new) |
1313 | |
1314 | def set_series_for_tasks(self): |
1315 | + """Set series for multiple tasks""" |
1316 | + |
1317 | tasks = self.get_tasks_by_orig() |
1318 | - args_bug = {"series": self.new['series'], "project": self.project} |
1319 | - if self.print_tasks(tasks): |
1320 | - for t in tasks: |
1321 | - self.set_series(t, self.new['series']) |
1322 | + |
1323 | + self.print_tasks(tasks) |
1324 | + q = 'Modify target series for total %i bugs?' % len(tasks) |
1325 | + if not self.confirm_set_bool(q): |
1326 | + return |
1327 | + for bt in tasks: |
1328 | + try: |
1329 | + self.set_series(bt, self.new['series']) |
1330 | + except KeyError: |
1331 | + logging.error('Make sure series is properly defined in "new"') |
1332 | + |
1333 | |
1334 | def main(): |
1335 | parser = argparse.ArgumentParser(description='TL Launchpad Tools') |