~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-17 18:23:39 UTC
  • mfrom: (13636.4.12 bug-820452)
  • Revision ID: launchpad@pqm.canonical.com-20110817182339-d6ypg81azfcra947
[r=benji,
        julian-edwards][bug=820452] Improve distroseries initialization
        checks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1442
1442
 
1443
1443
        return conflicts.one()
1444
1444
 
 
1445
    def getBuildsForSources(self, distroseries, status=None, pockets=None,
 
1446
                            names=None):
 
1447
        """See `IPackageUploadSet`."""
 
1448
        # Avoiding circular imports.
 
1449
        from lp.registry.model.distroseries import DistroSeries
 
1450
        from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
 
1451
        from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
 
1452
 
 
1453
        archives = distroseries.distribution.getArchiveIDList()
 
1454
        clauses = [
 
1455
            DistroSeries.id == PackageUpload.distroseriesID,
 
1456
            PackageUpload.archiveID.is_in(archives),
 
1457
            PackageUploadBuild.packageuploadID == PackageUpload.id,
 
1458
            ]
 
1459
 
 
1460
        if status is not None:
 
1461
            clauses.append(PackageUpload.status.is_in(status))
 
1462
        if pockets is not None:
 
1463
            clauses.append(PackageUpload.pocket.is_in(pockets))
 
1464
        if names is not None:
 
1465
            clauses.extend([
 
1466
                BinaryPackageBuild.id == PackageUploadBuild.buildID,
 
1467
                BinaryPackageBuild.source_package_release ==
 
1468
                    SourcePackageRelease.id,
 
1469
                SourcePackageRelease.sourcepackagename ==
 
1470
                    SourcePackageName.id,
 
1471
                SourcePackageName.name.is_in(names),
 
1472
                ])
 
1473
 
 
1474
        store = IStore(PackageUpload)
 
1475
        return store.find(PackageUpload, *clauses)
 
1476
 
1445
1477
    def count(self, status=None, distroseries=None, pocket=None):
1446
1478
        """See `IPackageUploadSet`."""
1447
1479
        clauses = []