~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/publishing.py

  • Committer: Stuart Bishop
  • Date: 2011-09-28 12:49:24 UTC
  • mfrom: (9893.10.1 trivial)
  • mto: This revision was merged to the branch mainline in revision 14178.
  • Revision ID: stuart.bishop@canonical.com-20110928124924-m5a22fymqghw6c5i
Merged trivial into distinct-db-users.

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
from lp.soyuz.scripts.changeoverride import ArchiveOverriderError
115
115
 
116
116
 
117
 
# XXX cprov 2006-08-18: move it away, perhaps archivepublisher/pool.py
118
 
 
119
117
def makePoolPath(source_name, component_name):
 
118
    # XXX cprov 2006-08-18: move it away, perhaps archivepublisher/pool.py
120
119
    """Return the pool path for a given source name and component name."""
121
120
    from lp.archivepublisher.diskpool import poolify
122
121
    return os.path.join(
421
420
    """A source package release publishing record."""
422
421
    implements(ISourcePackagePublishingHistory)
423
422
 
424
 
    sourcepackagename = ForeignKey(foreignKey='SourcePackageName',
425
 
        dbName='sourcepackagename')
426
 
    sourcepackagerelease = ForeignKey(foreignKey='SourcePackageRelease',
427
 
        dbName='sourcepackagerelease')
428
 
    distroseries = ForeignKey(foreignKey='DistroSeries',
429
 
        dbName='distroseries')
 
423
    sourcepackagename = ForeignKey(
 
424
        foreignKey='SourcePackageName', dbName='sourcepackagename')
 
425
    sourcepackagerelease = ForeignKey(
 
426
        foreignKey='SourcePackageRelease', dbName='sourcepackagerelease')
 
427
    distroseries = ForeignKey(
 
428
        foreignKey='DistroSeries', dbName='distroseries')
430
429
    component = ForeignKey(foreignKey='Component', dbName='component')
431
430
    section = ForeignKey(foreignKey='Section', dbName='section')
432
431
    status = EnumCol(schema=PackagePublishingStatus)
449
448
    ancestor = ForeignKey(
450
449
        dbName="ancestor", foreignKey="SourcePackagePublishingHistory",
451
450
        default=None)
 
451
    creator = ForeignKey(
 
452
        dbName='creator', foreignKey='Person',
 
453
        storm_validator=validate_public_person, notNull=False, default=None)
452
454
 
453
455
    @property
454
456
    def package_creator(self):
685
687
        return self.distroseries.distribution.getSourcePackageRelease(
686
688
            self.supersededby)
687
689
 
688
 
    # XXX: StevenK 2011-09-13 bug=848563: This can die when 
 
690
    # XXX: StevenK 2011-09-13 bug=848563: This can die when
689
691
    # self.sourcepackagename is populated.
690
692
    @property
691
693
    def source_package_name(self):
795
797
            archive=current.archive)
796
798
 
797
799
    def copyTo(self, distroseries, pocket, archive, override=None,
798
 
               create_dsd_job=True):
 
800
               create_dsd_job=True, creator=None):
799
801
        """See `ISourcePackagePublishingHistory`."""
800
802
        component = self.component
801
803
        section = self.section
811
813
            component,
812
814
            section,
813
815
            pocket,
814
 
            ancestor=None,
815
 
            create_dsd_job=create_dsd_job)
 
816
            ancestor=self,
 
817
            create_dsd_job=create_dsd_job,
 
818
            creator=creator)
816
819
 
817
820
    def getStatusSummaryForBuilds(self):
818
821
        """See `ISourcePackagePublishingHistory`."""
908
911
 
909
912
    implements(IBinaryPackagePublishingHistory)
910
913
 
911
 
    binarypackagename = ForeignKey(foreignKey='BinaryPackageName',
912
 
        dbName='binarypackagename')
913
 
    binarypackagerelease = ForeignKey(foreignKey='BinaryPackageRelease',
914
 
                                      dbName='binarypackagerelease')
915
 
    distroarchseries = ForeignKey(foreignKey='DistroArchSeries',
916
 
                                   dbName='distroarchseries')
 
914
    binarypackagename = ForeignKey(
 
915
        foreignKey='BinaryPackageName', dbName='binarypackagename')
 
916
    binarypackagerelease = ForeignKey(
 
917
        foreignKey='BinaryPackageRelease', dbName='binarypackagerelease')
 
918
    distroarchseries = ForeignKey(
 
919
        foreignKey='DistroArchSeries', dbName='distroarchseries')
917
920
    component = ForeignKey(foreignKey='Component', dbName='component')
918
921
    section = ForeignKey(foreignKey='Section', dbName='section')
919
922
    priority = EnumCol(dbName='priority', schema=PackagePublishingPriority)
957
960
        """See `IBinaryPackagePublishingHistory`"""
958
961
        return self.distroarchseries.distroseries
959
962
 
960
 
    # XXX: StevenK 2011-09-13 bug=848563: This can die when 
 
963
    # XXX: StevenK 2011-09-13 bug=848563: This can die when
961
964
    # self.binarypackagename is populated.
962
965
    @property
963
966
    def binary_package_name(self):
1487
1490
 
1488
1491
    def newSourcePublication(self, archive, sourcepackagerelease,
1489
1492
                             distroseries, component, section, pocket,
1490
 
                             ancestor=None, create_dsd_job=True):
 
1493
                             ancestor=None, create_dsd_job=True,
 
1494
                             creator=None):
1491
1495
        """See `IPublishingSet`."""
1492
1496
        # Avoid circular import.
1493
1497
        from lp.registry.model.distributionsourcepackage import (
1494
1498
            DistributionSourcePackage)
1495
1499
 
 
1500
        if creator is None:
 
1501
            creator = sourcepackagerelease.creator
 
1502
 
1496
1503
        pub = SourcePackagePublishingHistory(
1497
1504
            distroseries=distroseries,
1498
1505
            pocket=pocket,
1503
1510
            section=section,
1504
1511
            status=PackagePublishingStatus.PENDING,
1505
1512
            datecreated=UTC_NOW,
1506
 
            ancestor=ancestor)
 
1513
            ancestor=ancestor,
 
1514
            creator=creator)
1507
1515
        DistributionSourcePackage.ensure(pub)
1508
1516
 
1509
1517
        if create_dsd_job: