~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/scripts/initialize_distroseries.py

  • Committer: Raphael Badin
  • Date: 2011-08-11 14:47:01 UTC
  • mto: This revision was merged to the branch mainline in revision 13714.
  • Revision ID: raphael.badin@canonical.com-20110811144701-3q694t8a7f252h86
Expand IDS checks to the pockets copied, limit IDS checks to the architectures copied.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
class InitializationError(Exception):
49
49
    """Raised when there is an exception during the initialization process."""
50
50
 
 
51
# Pockets to consider when initializing the derived series from its parent(s).
 
52
INIT_POCKETS = [
 
53
    PackagePublishingPocket.RELEASE,
 
54
    PackagePublishingPocket.SECURITY,
 
55
    PackagePublishingPocket.UPDATES,
 
56
    ]
 
57
 
51
58
 
52
59
class InitializeDistroSeries:
53
60
    """Copy in all of the parents distroseries's configuration. This
164
171
    def _checkBuilds(self, parent):
165
172
        """Assert there are no pending builds for the given parent series.
166
173
 
167
 
        Only cares about the RELEASE pocket, which is the only one inherited
168
 
        via initializeFromParent method.
 
174
        Only cares about the RELEASE, SECURITY and UPDATES pockets, which are
 
175
        the only ones inherited via initializeFromParent method.
169
176
        """
170
 
        # only the RELEASE pocket is inherited, so we only check
171
 
        # pending build records for it.
 
177
        arch_tags = self.arches if self.arches is not () else None
172
178
        pending_builds = parent.getBuildRecords(
173
 
            BuildStatus.NEEDSBUILD, pocket=PackagePublishingPocket.RELEASE)
 
179
            BuildStatus.NEEDSBUILD, pocket=INIT_POCKETS,
 
180
            arch_tag=arch_tags)
174
181
 
175
182
        if pending_builds.any():
176
183
            raise InitializationError("Parent series has pending builds.")
178
185
    def _checkQueue(self, parent):
179
186
        """Assert upload queue is empty on the given parent series.
180
187
 
181
 
        Only cares about the RELEASE pocket, which is the only one inherited
182
 
        via initializeFromParent method.
 
188
        Only cares about the RELEASE, SECURITY and UPDATES pockets, which are
 
189
        the only ones inherited via initializeFromParent method.
183
190
        """
184
 
        # only the RELEASE pocket is inherited, so we only check
185
 
        # queue items for it.
186
191
        statuses = [
187
192
            PackageUploadStatus.NEW,
188
193
            PackageUploadStatus.ACCEPTED,
189
194
            PackageUploadStatus.UNAPPROVED,
190
195
            ]
191
 
        items = parent.getPackageUploads(
192
 
            status=statuses, pocket=PackagePublishingPocket.RELEASE)
 
196
        items = parent.getPackageUploads(status=statuses, pocket=INIT_POCKETS)
193
197
        if not items.is_empty():
194
198
            raise InitializationError(
195
199
                "Parent series queues are not empty.")
432
436
                    # There is only one available pocket in an unreleased
433
437
                    # series.
434
438
                    target_pocket = PackagePublishingPocket.RELEASE
435
 
                    pockets_to_copy = (
436
 
                        PackagePublishingPocket.RELEASE,
437
 
                        PackagePublishingPocket.UPDATES,
438
 
                        PackagePublishingPocket.SECURITY)
439
439
                    sources = archive.getPublishedSources(
440
 
                        distroseries=parent, pocket=pockets_to_copy,
 
440
                        distroseries=parent, pocket=INIT_POCKETS,
441
441
                        name=spns)
442
442
                    # XXX: rvb 2011-06-23 bug=801112: do_copy is atomic (all
443
443
                    # or none of the sources will be copied). This might