~launchpad-pqm/launchpad/devel

13785.4.3 by William Grant
And one more.
1
Publishing ACCEPTED Sources
2
===========================
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
3
4
As recently requested in bug #77853, successfully source-only uploads,
5
i.e, those uploads that only include a source package and were
6
processed without errors, will be automatically published as PENDING.
7
8
This aggregation of processes are intended to increase the building
9
throughput, because the will allow the sources to be published on disk
10
and built within the same publishing cycle. (previously Soyuz requires
11
two publishing cycles, one for publish the source on disk and another
12
to build it).
13
14
Let's start a new series of ed (0.2-20) and publish it:
15
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
16
    >>> ed_src = getUploadForSource(
17
    ...     'split-upload-test/ed_0.2-20_source.changes')
18
    >>> ed_src.process()
19
    >>> result = ed_src.do_accept()
20
    >>> ed_src.queue_root.status.name
21
    'NEW'
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
22
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
23
    >>> ed_src.queue_root.setAccepted()
5663.3.6 by Celso Providelo
applying review comments, r=sinzui.
24
    >>> pub_records = ed_src.queue_root.realiseUpload()
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
25
26
Check if the publication is available through the Soyuz package stack:
27
7675.110.3 by Curtis Hovey
Ran the migration script to move registry code to lp.registry.
28
    >>> from lp.registry.interfaces.distribution import (
6892.4.1 by Celso Providelo
Fixing bug #108104 (Better message for conflicting uploaded files). Also fixing lint issues in archiveuploader doctests.
29
    ...     IDistributionSet)
30
31
    >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
32
    >>> hoary = ubuntu.getSeries('hoary')
33
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
34
    >>> ed_sp = hoary.getSourcePackage('ed')
35
    >>> ed_dsspr = ed_sp['0.2-20']
36
    >>> ed_dsspr.publishing_history.count()
37
    1
38
    >>> ed_pub = ed_dsspr.publishing_history[0]
39
40
    >>> ed_pub.sourcepackagerelease.title
41
    u'ed - 0.2-20'
42
43
    >>> ed_pub.distroseries.name
44
    u'hoary'
45
46
    >>> ed_pub.status.name
47
    'PENDING'
48
49
    >>> ed_pub.archive == hoary.main_archive
50
    True
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
51
52
Also check if the Soyuz archive file lookup can reach one of the
53
just-published file:
54
12019.12.1 by William Grant
Eliminate Distribution.getFileByName. There's a perfectly good alternative on Archive.
55
    >>> ubuntu.main_archive.getFileByName('ed_0.2.orig.tar.gz')
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
56
    <LibraryFileAlias...>
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
57
58
We have to commit in order to have new Librarian files available to
59
server by Librarian Server:
60
14606.3.1 by William Grant
Merge canonical.database into lp.services.database.
61
    >>> from lp.services.database.sqlbase import commit
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
62
    >>> commit()
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
63
64
Now let's submit a new source version of ed (0.2-21) which will be
65
automatically accepted and published resulting in a PackageUpload
66
record in 'DONE' state:
67
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
68
    >>> ed21_src = getUploadForSource(
69
    ...     'ed-0.2-21/ed_0.2-21_source.changes')
70
    >>> ed21_src.process()
71
    >>> result = ed21_src.do_accept()
72
    >>> ed21_src.queue_root.status.name
73
    'DONE'
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
74
75
This is unfortunate, but we have to manually remove the file dumped
76
from librarian into our tree, otherwise it will remain on disk causing
77
problems to the next test run.
78
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
79
    >>> import os
8426.7.2 by Julian Edwards
migrate archiveuploader to the lp tree.
80
    >>> from lp.archiveuploader.tests import datadir
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
81
    >>> os.remove(datadir('ed-0.2-21/ed_0.2.orig.tar.gz'))
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
82
83
After the mentioned procedure-shortcut, since ed_0.2-21 was
84
auto-accepted (i.e, published as PENDING), it should be immediately
85
available via the package stack:
86
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
87
    >>> ed21_dsspr = ed_sp['0.2-21']
88
    >>> ed21_dsspr.publishing_history.count()
89
    1
90
    >>> ed21_pub = ed21_dsspr.publishing_history[0]
91
92
    >>> ed21_pub.sourcepackagerelease.title
93
    u'ed - 0.2-21'
94
95
    >>> ed21_pub.distroseries.name
96
    u'hoary'
97
98
    >>> ed21_pub.status.name
99
    'PENDING'
100
101
    >>> ed21_pub.archive == hoary.main_archive
102
    True
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
103
104
Same happens for the archive file lookup:
105
12019.12.1 by William Grant
Eliminate Distribution.getFileByName. There's a perfectly good alternative on Archive.
106
    >>> ubuntu.main_archive.getFileByName('ed_0.2-21.dsc')
3691.312.49 by Celso Providelo
applying review comments [r=flacoste].
107
    <LibraryFileAlias...>
3691.312.43 by Celso Providelo
moving more tests off of launchpad/doc/nascentupload.txt
108