~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/model/distroseries.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-18 05:47:37 UTC
  • mfrom: (14157.2.5 bug-876171)
  • Revision ID: launchpad@pqm.canonical.com-20111018054737-s0b72mtu8grdpwfy
[r=stevenk][bug=876171] obsolete-distroseries.py will now schedule
        deletion of any publications that remain uncondemned.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1141
1141
            SeriesStatus.EXPERIMENTAL,
1142
1142
        ]
1143
1143
 
 
1144
    def _getAllSources(self):
 
1145
        """Get all sources ever published in this series' main archives."""
 
1146
        return IStore(SourcePackagePublishingHistory).find(
 
1147
            SourcePackagePublishingHistory,
 
1148
            SourcePackagePublishingHistory.distroseriesID == self.id,
 
1149
            SourcePackagePublishingHistory.archiveID.is_in(
 
1150
                self.distribution.all_distro_archive_ids),
 
1151
            ).order_by(SourcePackagePublishingHistory.id)
 
1152
 
 
1153
    def _getAllBinaries(self):
 
1154
        """Get all binaries ever published in this series' main archives."""
 
1155
        return IStore(BinaryPackagePublishingHistory).find(
 
1156
            BinaryPackagePublishingHistory,
 
1157
            DistroArchSeries.distroseriesID == self.id,
 
1158
            BinaryPackagePublishingHistory.distroarchseriesID
 
1159
                == DistroArchSeries.id,
 
1160
            BinaryPackagePublishingHistory.archiveID.is_in(
 
1161
                self.distribution.all_distro_archive_ids),
 
1162
            ).order_by(BinaryPackagePublishingHistory.id)
 
1163
 
1144
1164
    def getAllPublishedSources(self):
1145
1165
        """See `IDistroSeries`."""
1146
1166
        # Consider main archives only, and return all sources in
1147
1167
        # the PUBLISHED state.
1148
 
        archives = self.distribution.getArchiveIDList()
1149
 
        return SourcePackagePublishingHistory.select("""
1150
 
            distroseries = %s AND
1151
 
            status = %s AND
1152
 
            archive in %s
1153
 
            """ % sqlvalues(self, PackagePublishingStatus.PUBLISHED,
1154
 
                            archives),
1155
 
            orderBy="id")
 
1168
        return self._getAllSources().find(
 
1169
            status=PackagePublishingStatus.PUBLISHED)
1156
1170
 
1157
1171
    def getAllPublishedBinaries(self):
1158
1172
        """See `IDistroSeries`."""
1159
1173
        # Consider main archives only, and return all binaries in
1160
1174
        # the PUBLISHED state.
1161
 
        archives = self.distribution.getArchiveIDList()
1162
 
        return BinaryPackagePublishingHistory.select("""
1163
 
            BinaryPackagePublishingHistory.distroarchseries =
1164
 
                DistroArchSeries.id AND
1165
 
            DistroArchSeries.distroseries = DistroSeries.id AND
1166
 
            DistroSeries.id = %s AND
1167
 
            BinaryPackagePublishingHistory.status = %s AND
1168
 
            BinaryPackagePublishingHistory.archive in %s
1169
 
            """ % sqlvalues(self, PackagePublishingStatus.PUBLISHED,
1170
 
                            archives),
1171
 
            clauseTables=["DistroArchSeries", "DistroSeries"],
1172
 
            orderBy="BinaryPackagePublishingHistory.id")
 
1175
        return self._getAllBinaries().find(
 
1176
            status=PackagePublishingStatus.PUBLISHED)
 
1177
 
 
1178
    def getAllUncondemnedSources(self):
 
1179
        """See `IDistroSeries`."""
 
1180
        return self._getAllSources().find(scheduleddeletiondate=None)
 
1181
 
 
1182
    def getAllUncondemnedBinaries(self):
 
1183
        """See `IDistroSeries`."""
 
1184
        return self._getAllBinaries().find(scheduleddeletiondate=None)
1173
1185
 
1174
1186
    def getSourcesPublishedForAllArchives(self):
1175
1187
        """See `IDistroSeries`."""