~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-07-13 11:53:55 UTC
  • mfrom: (13383.1.2 bug-803344)
  • Revision ID: launchpad@pqm.canonical.com-20110713115355-3crwphu7bjya8xq8
[r=henninge][bug=803344] Copy packageset permissions when
        initializing a new distroseries from a parent series in the
        same distribution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
472
472
        packagesets = self._store.find(
473
473
            Packageset, DistroSeries.id.is_in(self.derivation_parent_ids))
474
474
        parent_to_child = {}
475
 
        # Create the packagesets.
 
475
        # Create the packagesets and any archivepermissions if we're not
 
476
        # copying cross-distribution.
476
477
        parent_distro_ids = [
477
478
            parent.distribution.id for parent in self.derivation_parents]
478
479
        for parent_ps in packagesets:
494
495
                    parent_ps.name, parent_ps.description,
495
496
                    new_owner, distroseries=self.distroseries,
496
497
                    related_set=parent_ps)
497
 
 
498
498
            parent_to_child[parent_ps] = child_ps
 
499
            # Copy archivepermissions if we're not copying
 
500
            # cross-distribution.
 
501
            if (self.distroseries.distribution ==
 
502
                    parent_ps.distroseries.distribution):
 
503
                self._store.execute("""
 
504
                    INSERT INTO Archivepermission
 
505
                    (person, permission, archive, packageset, explicit)
 
506
                    SELECT person, permission, %s, %s, explicit
 
507
                    FROM Archivepermission WHERE packageset = %s
 
508
                    """ % sqlvalues(
 
509
                        self.distroseries.main_archive, child_ps.id,
 
510
                        parent_ps.id))
499
511
        # Copy the relations between sets, and the contents.
500
512
        for old_series_ps, new_series_ps in parent_to_child.items():
501
513
            old_series_sets = old_series_ps.setsIncluded(