~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/binarypackagebuild.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:
862
862
        :param tables: container to which to add joined tables.
863
863
        :param status: optional build state for which to add a query clause if
864
864
            present.
865
 
        :param name: optional source package release name for which to add a
 
865
        :param name: optional source package release name (or list of source
 
866
            package release names) for which to add a query clause if
 
867
            present.
 
868
        :param pocket: optional pocket (or list of pockets) for which to add a
866
869
            query clause if present.
867
 
        :param pocket: optional pocket for which to add a query clause if
868
 
            present.
869
870
        :param arch_tag: optional architecture tag for which to add a
870
871
            query clause if present.
871
872
        """
883
884
 
884
885
        # Add query clause that filters on pocket if the latter is provided.
885
886
        if pocket:
886
 
            queries.append('PackageBuild.pocket=%s' % sqlvalues(pocket))
 
887
            if not isinstance(pocket, (list, tuple)):
 
888
                pocket = (pocket,)
 
889
 
 
890
            queries.append('PackageBuild.pocket IN %s' % sqlvalues(pocket))
887
891
 
888
892
        # Add query clause that filters on architecture tag if provided.
889
893
        if arch_tag is not None:
896
900
        # Add query clause that filters on source package release name if the
897
901
        # latter is provided.
898
902
        if name is not None:
899
 
            queries.append('''
900
 
                BinaryPackageBuild.source_package_release =
901
 
                    SourcePackageRelease.id AND
902
 
                SourcePackageRelease.sourcepackagename = SourcePackageName.id
903
 
                AND SourcepackageName.name LIKE '%%' || %s || '%%'
904
 
            ''' % quote_like(name))
 
903
            if not isinstance(name, (list, tuple)):
 
904
                queries.append('''
 
905
                    BinaryPackageBuild.source_package_release =
 
906
                        SourcePackageRelease.id AND
 
907
                    SourcePackageRelease.sourcepackagename =
 
908
                        SourcePackageName.id
 
909
                    AND SourcepackageName.name LIKE '%%' || %s || '%%'
 
910
                ''' % quote_like(name))
 
911
            else:
 
912
                queries.append('''
 
913
                    BinaryPackageBuild.source_package_release =
 
914
                        SourcePackageRelease.id AND
 
915
                    SourcePackageRelease.sourcepackagename =
 
916
                        SourcePackageName.id
 
917
                    AND SourcepackageName.name IN %s
 
918
                ''' % sqlvalues(name))
905
919
            tables.extend(['SourcePackageRelease', 'SourcePackageName'])
906
920
 
907
921
    def getBuildsForBuilder(self, builder_id, status=None, name=None,