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
|
= Build files =
Create a test build.
>>> from lp.registry.interfaces.person import IPersonSet
>>> from lp.soyuz.tests.test_publishing import (
... SoyuzTestPublisher)
>>> login('foo.bar@canonical.com')
>>> cprov = getUtility(IPersonSet).getByName('cprov')
>>> test_publisher = SoyuzTestPublisher()
>>> test_publisher.prepareBreezyAutotest()
>>> test_publisher.addFakeChroots()
>>> test_source = test_publisher.getPubSource(
... archive=cprov.archive, sourcename='test-pkg',
... version='1.0')
>>> binary_pubs = test_publisher.getPubBinaries(
... binaryname='test', pub_source=test_source)
>>> deb = binary_pubs[0].binarypackagerelease.files[0].libraryfile
>>> [build] = test_source.getBuilds()
IBuild provide a getFileByName() method, which retuns one of the
following file type in its context.
* Binary changesfile: '.changes';
* Build logs: '.txt.gz';
* Build upload logs: '_log.txt';
* Built files: '*deb';
>>> print build.title
i386 build of test-pkg 1.0 in ubuntutest breezy-autotest RELEASE
Unsupported filename lookups also result in a `NotFoundError`.
>>> build.getFileByName('biscuit.cookie')
Traceback (most recent call last):
...
NotFoundError: 'biscuit.cookie'
And unreachable files in `NotFoundError`.
>>> build.getFileByName('boing.changes')
Traceback (most recent call last):
...
NotFoundError: 'boing.changes'
Retrieving a binary changesfile. "test_1.0_i386.changes" is created when
SoyuzTestPublisher creates the "test" binary publication.
>>> print build.upload_changesfile.filename
test_1.0_i386.changes
>>> build.upload_changesfile == build.getFileByName(
... build.upload_changesfile.filename)
True
Adding and retrieving a buildlog.
>>> buildlog_name = (
... 'buildlog_ubuntu-breezy-autotest-i386.'
... 'test-pkg_1.0_FULLYBUILT.txt.gz')
>>> buildlog = test_publisher.addMockFile(buildlog_name)
>>> build.log = buildlog
>>> buildlog == build.getFileByName(buildlog_name)
True
Adding and retrieving a upload_log.
>>> upload_log_name = 'upload_%d_log.txt' % build.id
>>> upload_log = test_publisher.addMockFile(upload_log_name)
>>> build.upload_log = upload_log
>>> upload_log == build.getFileByName(upload_log_name)
True
Retrieve a built file:
>>> deb == build.getFileByName('test_1.0_all.deb')
True
We can also retrieve the corresponding BinaryPackageFile:
>>> bpf = build.getBinaryPackageFileByName('test_1.0_all.deb')
>>> bpf
<BinaryPackageFile ...>
>>> bpf.libraryfile == deb
True
|