Пример #1
0
 def getBinaryPackage(self, name):
     """See `IDistroArchSeries`."""
     from lp.soyuz.model.distroarchseriesbinarypackage import (
         DistroArchSeriesBinaryPackage, )
     if not IBinaryPackageName.providedBy(name):
         try:
             name = BinaryPackageName.byName(name)
         except SQLObjectNotFound:
             return None
     return DistroArchSeriesBinaryPackage(self, name)
Пример #2
0
 def getBinaryPackage(self, name):
     """See `IDistroArchSeries`."""
     from lp.soyuz.model.distroarchseriesbinarypackage import (
         DistroArchSeriesBinaryPackage,
         )
     if not IBinaryPackageName.providedBy(name):
         try:
             name = BinaryPackageName.byName(name)
         except SQLObjectNotFound:
             return None
     return DistroArchSeriesBinaryPackage(
         self, name)
Пример #3
0
    def getReleasedPackages(self,
                            binary_name,
                            pocket=None,
                            include_pending=False,
                            archive=None):
        """See IDistroArchSeries."""
        from lp.soyuz.model.publishing import BinaryPackagePublishingHistory

        queries = []

        if not IBinaryPackageName.providedBy(binary_name):
            binary_name = BinaryPackageName.byName(binary_name)

        queries.append("""
        binarypackagerelease=binarypackagerelease.id AND
        binarypackagerelease.binarypackagename=%s AND
        distroarchseries = %s
        """ % sqlvalues(binary_name, self))

        if pocket is not None:
            queries.append("pocket=%s" % sqlvalues(pocket.value))

        if include_pending:
            queries.append("status in (%s, %s)" %
                           sqlvalues(PackagePublishingStatus.PUBLISHED,
                                     PackagePublishingStatus.PENDING))
        else:
            queries.append("status=%s" %
                           sqlvalues(PackagePublishingStatus.PUBLISHED))

        archives = self.distroseries.distribution.getArchiveIDList(archive)
        queries.append("archive IN %s" % sqlvalues(archives))

        published = BinaryPackagePublishingHistory.select(
            " AND ".join(queries),
            clauseTables=['BinaryPackageRelease'],
            orderBy=['-id'])

        return shortlist(published)
Пример #4
0
    def getReleasedPackages(self, binary_name, pocket=None,
                            include_pending=False, archive=None):
        """See IDistroArchSeries."""
        from lp.soyuz.model.publishing import BinaryPackagePublishingHistory

        queries = []

        if not IBinaryPackageName.providedBy(binary_name):
            binary_name = BinaryPackageName.byName(binary_name)

        queries.append("""
        binarypackagerelease=binarypackagerelease.id AND
        binarypackagerelease.binarypackagename=%s AND
        distroarchseries = %s
        """ % sqlvalues(binary_name, self))

        if pocket is not None:
            queries.append("pocket=%s" % sqlvalues(pocket.value))

        if include_pending:
            queries.append("status in (%s, %s)" % sqlvalues(
                PackagePublishingStatus.PUBLISHED,
                PackagePublishingStatus.PENDING))
        else:
            queries.append("status=%s" % sqlvalues(
                PackagePublishingStatus.PUBLISHED))

        archives = self.distroseries.distribution.getArchiveIDList(archive)
        queries.append("archive IN %s" % sqlvalues(archives))

        published = BinaryPackagePublishingHistory.select(
            " AND ".join(queries),
            clauseTables=['BinaryPackageRelease'],
            orderBy=['-id'])

        return shortlist(published)