1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
TranslationTemplatesBuild Build Summary
=======================================
The builders UI can show TranslationTemplateBuild records, although they
look a little different from Soyuz-style jobs.
Setup
-----
Create a builder working on a TranslationTemplatesBuild for a branch.
>>> from zope.component import getUtility
>>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
>>> from canonical.launchpad.interfaces.librarian import (
... ILibraryFileAliasSet)
>>> from lp.app.enums import ServiceUsage
>>> from lp.buildmaster.interfaces.buildqueue import IBuildQueueSet
>>> from lp.testing.factory import (
... remove_security_proxy_and_shout_at_engineer)
>>> from lp.testing.fakemethod import FakeMethod
>>> from lp.translations.interfaces.translations import (
... TranslationsBranchImportMode)
>>> class FakeSlave:
... resume = FakeMethod(result=('stdout', 'stderr', 0))
... build = FakeMethod()
... cacheFile = FakeMethod()
>>> login(ANONYMOUS)
>>> owner_email = factory.getUniqueString() + '@example.com'
>>> owner = factory.makePerson(email=owner_email, password='test')
>>> productseries = factory.makeProductSeries(owner=owner)
>>> product = productseries.product
>>> naked_product = remove_security_proxy_and_shout_at_engineer(product)
>>> naked_product.translations_usage = ServiceUsage.LAUNCHPAD
>>> branch = factory.makeProductBranch(product=product, owner=owner)
>>> branch_url = branch.unique_name
>>> naked_productseries = remove_security_proxy_and_shout_at_engineer(
... productseries)
>>> naked_productseries.branch = factory.makeBranch()
>>> naked_productseries.translations_autoimport_mode = (
... TranslationsBranchImportMode.IMPORT_TEMPLATES)
>>> specific_job = factory.makeTranslationTemplatesBuildJob(branch=branch)
>>> buildqueue = getUtility(IBuildQueueSet).getByJob(specific_job.job)
>>> fake_chroot = getUtility(ILibraryFileAliasSet)[1]
>>> ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
>>> unused = ubuntu.currentseries.nominatedarchindep.addOrUpdateChroot(
... fake_chroot)
>>> builder = factory.makeBuilder(vm_host=factory.getUniqueString())
>>> builder.setSlaveForTesting(FakeSlave())
>>> buildqueue.markAsBuilding(builder)
>>> builder_page = canonical_url(builder)
>>> logout()
Helper: find the current build's summary on a browser's current page.
>>> def find_build_summary(browser):
... return find_tag_by_id(browser.contents, 'current-build-summary')
Show summary
------------
The job's summary shows that what type of job this is. It also links
to the branch.
>>> user_browser.open(builder_page)
>>> print extract_text(find_build_summary(user_browser))
Working on TranslationTemplatesBuildJob for branch ...
>>> user_browser.getLink(branch_url).click()
Show build record
-----------------
There's a detailed page for the build record.
>>> login(ANONYMOUS)
>>> from lp.translations.interfaces.translationtemplatesbuild import (
... ITranslationTemplatesBuildSource,
... )
>>> build = getUtility(ITranslationTemplatesBuildSource).findByBranch(
... branch).one()
>>> build_url = canonical_url(build)
>>> logout()
>>> user_browser.open(build_url)
>>> print extract_text(find_main_content(user_browser.contents))
P...
Build status
Needs building
Not started yet.
Build details
Branch: lp://dev/...
Not imported anywhere.
The "Not imported anywhere" is because nobody actually imports templates
from this branch. In practice, this will usually show exactly one
product series.
>>> from lp.testing.sampledata import ADMIN_EMAIL
>>> login(ADMIN_EMAIL)
>>> from lp.translations.interfaces.translations import (
... TranslationsBranchImportMode,
... )
>>> product = factory.makeProduct(name='qblark', displayname='qblark')
>>> trunk = product.getSeries('trunk')
>>> trunk.branch = branch
>>> trunk.translations_autoimport_mode = (
... TranslationsBranchImportMode.IMPORT_TEMPLATES)
>>> logout()
>>> user_browser.open(build_url)
>>> print extract_text(find_main_content(user_browser.contents))
P...
Build status
Needs building
Not started yet.
Build details
Branch: lp://dev/...
For import into: qblark trunk series
The listing links to the productseries that consumes the templates.
>>> user_browser.getLink("qblark trunk series").click()
Build history
-------------
A completed translation templates build job shows up in the builder's
build history.
>>> login(ANONYMOUS)
>>> from datetime import datetime, timedelta
>>> from zope.security.proxy import removeSecurityProxy
>>> from lp.buildmaster.enums import BuildStatus
>>> from pytz import utc
>>> naked_job = removeSecurityProxy(build.build_farm_job)
>>> naked_job.builder = builder
>>> naked_job.date_started = datetime(2010, 9, 14, 8, 0, tzinfo=utc)
>>> naked_job.date_finished = naked_job.date_started + timedelta(
... seconds=300)
>>> naked_job.status = BuildStatus.FULLYBUILT
>>> logout()
>>> user_browser.open(builder_page)
>>> user_browser.getLink('View full history').click()
>>> print extract_text(find_main_content(user_browser.contents))
Build history for ...
1 ... 1 of 1 result
...
Translation template build for lp://dev/qblark
Build started ... and finished ... taking 5 minutes
1 ... 1 of 1 result
...
|