~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-07 20:51:41 UTC
  • mfrom: (14108.1.3 bug-869221)
  • Revision ID: launchpad@pqm.canonical.com-20111007205141-xkf3b1u7sbic70td
[r=julian-edwards][bug=869221][incr] Raise a proper error when a
        derived series won't be able to have an architecture to build
        architecture independent binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
                 ".").format(
158
158
                    child=self.distroseries))
159
159
        self._checkParents()
 
160
        self._checkArchindep()
160
161
        for parent in self.derivation_parents:
161
162
            self._checkBuilds(parent)
162
163
            self._checkQueue(parent)
163
164
        self._checkSeries()
164
165
 
 
166
    def _checkArchindep(self):
 
167
        # Check that the child distroseries has an architecture to
 
168
        # build architecture independent binaries.
 
169
        potential_nominated_arches = self._potential_nominated_arches(
 
170
             self.derivation_parents)
 
171
        if len(potential_nominated_arches) == 0:
 
172
            raise InitializationError(
 
173
                "The distroseries has no architectures selected to "
 
174
                 "build architecture independent binaries.")
 
175
 
165
176
    def _checkPublisherConfig(self):
166
177
        """A series cannot be initialized if it has no publisher config
167
178
        set up.
365
376
            """ % (sqlvalues(self.distroseries, self.distroseries.owner)
366
377
            + (das_filter, )))
367
378
        self._store.flush()
368
 
        # Take nominatedarchindep from the first parent.
369
 
        self.distroseries.nominatedarchindep = self.distroseries[
370
 
            self.derivation_parents[0].nominatedarchindep.architecturetag]
 
379
        # Select the arch-indep builder from the intersection between
 
380
        # the selected architectures and the list of the parent's
 
381
        # arch-indep builders.
 
382
        arch_tag = self._potential_nominated_arches(
 
383
            self.derivation_parents).pop()
 
384
        self.distroseries.nominatedarchindep = self.distroseries[arch_tag]
 
385
 
 
386
    def _potential_nominated_arches(self, parent_list):
 
387
        parent_indep_archtags = set(
 
388
            parent.nominatedarchindep.architecturetag
 
389
            for parent in parent_list
 
390
            if parent.nominatedarchindep is not None)
 
391
 
 
392
        if len(self.arches) == 0:
 
393
            return parent_indep_archtags
 
394
        else:
 
395
            return parent_indep_archtags.intersection(self.arches)
371
396
 
372
397
    def _copy_packages(self):
373
398
        # Perform the copies