~launchpad-pqm/launchpad/devel

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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
Publisher Configuration Provider
================================

The config module has a function to provide a modified publisher configuration
that provides the right paths for its publication according to the given
archive.

We will use a helper function for dumping publisher configurations.

    >>> config_attributes = [
    ...     'distroroot',
    ...     'archiveroot',
    ...     'poolroot',
    ...     'distsroot',
    ...     'overrideroot',
    ...     'cacheroot',
    ...     'miscroot',
    ...     'germinateroot',
    ...     'temproot',
    ... ]

    >>> def dump_config(config):
    ...     for attr_name in config_attributes:
    ...         print '%s: %s' % (attr_name, getattr(config, attr_name))


Primary
-------

    >>> from lp.registry.interfaces.distribution import IDistributionSet
    >>> ubuntutest = getUtility(IDistributionSet)['ubuntutest']

    >>> from lp.archivepublisher.config import getPubConfig
    >>> primary_config = getPubConfig(ubuntutest.main_archive)

    >>> dump_config(primary_config)
    distroroot:      /var/tmp/archive
    archiveroot:     /var/tmp/archive/ubuntutest
    poolroot:        /var/tmp/archive/ubuntutest/pool
    distsroot:       /var/tmp/archive/ubuntutest/dists
    overrideroot:    /var/tmp/archive/ubuntutest-overrides
    cacheroot:       /var/tmp/archive/ubuntutest-cache
    miscroot:        /var/tmp/archive/ubuntutest-misc
    germinateroot:   /var/tmp/archive/ubuntutest-germinate
    temproot:        /var/tmp/archive/ubuntutest-temp


PPAs
----

Adjust Celso's PPA to point to a configured distribution and built its
publisher configuration.

    >>> # cprov 20061127: We should *never* be able to change a PPA
    >>> # distribution, however 'ubuntu' is not prepared for publication, thus
    >>> # we have to override the PPA to 'ubuntutest' in order to perform the
    >>> # tests.

    >>> from lp.registry.interfaces.person import IPersonSet
    >>> cprov = getUtility(IPersonSet).getByName('cprov')
    >>> cprov_archive = cprov.archive
    >>> cprov_archive.distribution = ubuntutest

    >>> ppa_config = getPubConfig(cprov_archive)

The base Archive publication location is set in the current Launchpad
configuration file:

    >>> from canonical.config import config
    >>> ppa_config.distroroot == config.personalpackagearchive.root
    True

A PPA repository topology will follow:

<PPA_BASE_DIR>/<PERSONNAME>/<DISTRIBUTION>

And some paths are not used for PPA workflow, so they are set to
None, so they won't get created:

    >>> dump_config(ppa_config)
    distroroot:      /var/tmp/ppa.test/
    archiveroot:     /var/tmp/ppa.test/cprov/ppa/ubuntutest
    poolroot:        /var/tmp/ppa.test/cprov/ppa/ubuntutest/pool
    distsroot:       /var/tmp/ppa.test/cprov/ppa/ubuntutest/dists
    overrideroot:    None
    cacheroot:       None
    miscroot:        None
    germinateroot:   None
    temproot:        /var/tmp/archive/ubuntutest-temp

There is a separate location for private PPAs that is used if the
archive is marked as private:

    >>> (config.personalpackagearchive.private_root !=
    ...  config.personalpackagearchive.root)
    True

    >>> cprov_private_ppa = factory.makeArchive(
    ...     owner=cprov, name='myprivateppa',
    ...     distribution=cprov_archive.distribution)
    >>> cprov_private_ppa.private = True
    >>> cprov_private_ppa.buildd_secret = "secret"
    >>> p3a_config = getPubConfig(cprov_private_ppa)

    >>> (p3a_config.distroroot ==
    ...  config.personalpackagearchive.private_root)
    True

    >>> dump_config(p3a_config)
    distroroot:      /var/tmp/ppa
    archiveroot:     /var/tmp/ppa/cprov/myprivateppa/ubuntutest
    poolroot:        /var/tmp/ppa/cprov/myprivateppa/ubuntutest/pool
    distsroot:       /var/tmp/ppa/cprov/myprivateppa/ubuntutest/dists
    overrideroot:    None
    cacheroot:       None
    miscroot:        None
    germinateroot:   None
    temproot:        /var/tmp/archive/ubuntutest-temp


Partner
-------

The publisher config for PARTNER contains only 'partner' in its
components.  This prevents non-partner being published in the partner
archive.

    >>> from lp.soyuz.interfaces.archive import IArchiveSet
    >>> partner_archive = getUtility(IArchiveSet).getByDistroAndName(
    ...     ubuntutest, 'partner')

    >>> partner_config = getPubConfig(partner_archive)

    >>> dump_config(partner_config)
    distroroot:      /var/tmp/archive
    archiveroot:     /var/tmp/archive/ubuntutest-partner
    poolroot:        /var/tmp/archive/ubuntutest-partner/pool
    distsroot:       /var/tmp/archive/ubuntutest-partner/dists
    overrideroot:    None
    cacheroot:       None
    miscroot:        None
    germinateroot:   None
    temproot:        /var/tmp/archive/ubuntutest-temp


DEBUG
-----

The publisher configuration for DEBUG archives points to directories
besides PRIMARY repository ones, but the distribution part is
modified to be clearly different than the PRIMARY one.

    >>> from lp.soyuz.enums import ArchivePurpose
    >>> debug_archive = getUtility(IArchiveSet).new(
    ...     purpose=ArchivePurpose.DEBUG, owner=ubuntutest.owner,
    ...     distribution=ubuntutest)

    >>> debug_config = getPubConfig(debug_archive)

    >>> dump_config(debug_config)
    distroroot:      /var/tmp/archive
    archiveroot:     /var/tmp/archive/ubuntutest-debug
    poolroot:        /var/tmp/archive/ubuntutest-debug/pool
    distsroot:       /var/tmp/archive/ubuntutest-debug/dists
    overrideroot:    None
    cacheroot:       None
    miscroot:        None
    germinateroot:   None
    temproot:        /var/tmp/archive/ubuntutest-temp


COPY
----

In the case of copy archives (used for rebuild testing) the archiveroot
is of the form distroroot/distroname-archivename/distroname

    >>> copy_archive = getUtility(IArchiveSet).new(
    ...     purpose=ArchivePurpose.COPY, owner=ubuntutest.owner,
    ...     distribution=ubuntutest, name="rebuildtest99")

    >>> copy_config = getPubConfig(copy_archive)

    >>> dump_config(copy_config)
    distroroot:    /var/tmp/archive
    archiveroot:   /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest
    poolroot:      /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest/pool
    distsroot:     /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest/dists
    overrideroot:
        /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-overrides
    cacheroot:     /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-cache
    miscroot:      /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-misc
    germinateroot:
        /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-germinate
    temproot:      /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-temp