Beispiel #1
0
    def testGetTrovesLeavesMultiRepos(self):
        v1 = self.addComponent('foo:foo', '1.0').getVersion()
        v2 = self.addComponent('foo:foo', ':branch/1.0').getVersion()
        installLabelPath = conarycfg.CfgLabelList(
                    [versions.Label('localhost@rpl:branch'), 
                     self.cfg.buildLabel])

        repos = self.openRepository()
        tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                           VERSION_FILTER_LEAVES, 
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor, affinityDb=None)
        assert(set([x[1] for x in tups]) == set((v1, v2)))
        tups = queryrep.getTrovesToDisplay(repos, ['foo:foo'], [], [],
                                           VERSION_FILTER_LEAVES,
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor, affinityDb=None)
        assert(set([x[1] for x in tups]) == set((v1, v2)))
        tups = queryrep.getTrovesToDisplay(repos, ['foo:foo'], [], [],
                                           VERSION_FILTER_LATEST,
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor, affinityDb=None)
        assert(set([x[1] for x in tups]) == set((v1, v2)))
        tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                           VERSION_FILTER_LATEST,
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor, affinityDb=None)
        assert(set([x[1] for x in tups]) == set((v1, v2)))
Beispiel #2
0
 def testGetTrovesLatestByLabel(self):
     # test out the no trove queries that now use getTrovesLatestByLabel
     trv1 = self.addComponent('foo:run',
                              '/localhost@rpl:branch//rpl:linux/1.0-1-1')
     trv2 = self.addComponent('foo:run', '1.0-1-2')
     trv3 = self.addComponent('foo:run',
                              '/localhost@rpl:branch//rpl:linux/1.0-1-3',
                              'ssl')
     repos = self.openRepository()
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                        VERSION_FILTER_LATEST,
                                        FLAVOR_FILTER_BEST,
                                        self.cfg.installLabelPath,
                                        self.cfg.flavor,
                                        affinityDb=None)
     assert (len(tups) == 1)
     assert (tups[0] == trv3.getNameVersionFlavor())
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                        VERSION_FILTER_LEAVES,
                                        FLAVOR_FILTER_BEST,
                                        self.cfg.installLabelPath,
                                        self.cfg.flavor,
                                        affinityDb=None)
     assert (len(tups) == 2)
     assert (set(tups) == set(
         [trv3.getNameVersionFlavor(),
          trv2.getNameVersionFlavor()]))
Beispiel #3
0
    def testGetTrovesLeavesMultiRepos(self):
        v1 = self.addComponent('foo:foo', '1.0').getVersion()
        v2 = self.addComponent('foo:foo', ':branch/1.0').getVersion()
        installLabelPath = conarycfg.CfgLabelList(
            [versions.Label('localhost@rpl:branch'), self.cfg.buildLabel])

        repos = self.openRepository()
        tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                           VERSION_FILTER_LEAVES,
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor,
                                           affinityDb=None)
        assert (set([x[1] for x in tups]) == set((v1, v2)))
        tups = queryrep.getTrovesToDisplay(repos, ['foo:foo'], [], [],
                                           VERSION_FILTER_LEAVES,
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor,
                                           affinityDb=None)
        assert (set([x[1] for x in tups]) == set((v1, v2)))
        tups = queryrep.getTrovesToDisplay(repos, ['foo:foo'], [], [],
                                           VERSION_FILTER_LATEST,
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor,
                                           affinityDb=None)
        assert (set([x[1] for x in tups]) == set((v1, v2)))
        tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                           VERSION_FILTER_LATEST,
                                           FLAVOR_FILTER_ALL,
                                           installLabelPath,
                                           self.cfg.flavor,
                                           affinityDb=None)
        assert (set([x[1] for x in tups]) == set((v1, v2)))
Beispiel #4
0
 def testBadQuery(self):
     try:
         queryrep.getTrovesToDisplay(None, ['=conary.rpath.com@'], [], [],
                 VERSION_FILTER_ALL, FLAVOR_FILTER_ALL, 
                 self.cfg.installLabelPath, self.cfg.flavor,
                 None)
     except errors.ParseError, msg:
         assert(str(msg) == 'Error with spec "=conary.rpath.com@": Trove name is required')
Beispiel #5
0
 def testBadQuery(self):
     try:
         queryrep.getTrovesToDisplay(None, ['=conary.rpath.com@'], [], [],
                                     VERSION_FILTER_ALL, FLAVOR_FILTER_ALL,
                                     self.cfg.installLabelPath,
                                     self.cfg.flavor, None)
     except errors.ParseError, msg:
         assert (
             str(msg) ==
             'Error with spec "=conary.rpath.com@": Trove name is required')
Beispiel #6
0
 def _get(versionFilter, flavorFilter, whatProvidesList):
     return queryrep.getTrovesToDisplay(repos, [], [],
                         [deps.parseDep(x) for x in whatProvidesList],
                                        versionFilter,
                                        flavorFilter,
                                        self.cfg.installLabelPath,
                                        targetFlavor, None)
Beispiel #7
0
 def _check(troveSpecs, versionFilter, flavorFilter, expected):
     tups = queryrep.getTrovesToDisplay(repos, troveSpecs, [], [],
                                 versionFilter, flavorFilter,
                                 self.cfg.installLabelPath,
                                 targetFlavor,
                                 None)
     self._checkTupVers(tups, expected)
Beispiel #8
0
 def _get(troveSpec):
     try:
         return queryrep.getTrovesToDisplay(repos, [troveSpec], [], [],
                                            VERSION_FILTER_LATEST,
                                            FLAVOR_FILTER_EXACT,
                                            self.cfg.installLabelPath,
                                            self.cfg.flavor, None)
     except errors.TroveNotFound:
         return []
Beispiel #9
0
 def _get(troveSpec):
     try:
         return queryrep.getTrovesToDisplay(repos, [troveSpec], [], [],
                                            VERSION_FILTER_LATEST,
                                            FLAVOR_FILTER_EXACT,
                                            self.cfg.installLabelPath,
                                            self.cfg.flavor, None)
     except errors.TroveNotFound:
         return []
Beispiel #10
0
 def testLatestIsOfWrongFlavor(self):
     # CNY-784 - if the latest version was of an incompatible flavor,
     # conary rq <no args> would display nothing for that trove
     v1 = self.addComponent('foo:foo', '1.0', 'is:x86').getVersion()
     v2 = self.addComponent('foo:foo', '1.1', 'is:x86_64').getVersion()
     targetFlavor = [ deps.parseFlavor('is:x86') ]
     repos = self.openRepository()
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                        VERSION_FILTER_LATEST, 
                                        FLAVOR_FILTER_BEST,
                                        self.cfg.installLabelPath,
                                        targetFlavor, affinityDb=None)
     assert(set([x[1] for x in tups]) == set((v1,)))
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                        VERSION_FILTER_LATEST, 
                                        FLAVOR_FILTER_AVAIL,
                                        self.cfg.installLabelPath,
                                        targetFlavor, affinityDb=None)
     assert(set([x[1] for x in tups]) == set((v1,)))
Beispiel #11
0
 def testLatestIsOfWrongFlavor(self):
     # CNY-784 - if the latest version was of an incompatible flavor,
     # conary rq <no args> would display nothing for that trove
     v1 = self.addComponent('foo:foo', '1.0', 'is:x86').getVersion()
     v2 = self.addComponent('foo:foo', '1.1', 'is:x86_64').getVersion()
     targetFlavor = [deps.parseFlavor('is:x86')]
     repos = self.openRepository()
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                        VERSION_FILTER_LATEST,
                                        FLAVOR_FILTER_BEST,
                                        self.cfg.installLabelPath,
                                        targetFlavor,
                                        affinityDb=None)
     assert (set([x[1] for x in tups]) == set((v1, )))
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                        VERSION_FILTER_LATEST,
                                        FLAVOR_FILTER_AVAIL,
                                        self.cfg.installLabelPath,
                                        targetFlavor,
                                        affinityDb=None)
     assert (set([x[1] for x in tups]) == set((v1, )))
Beispiel #12
0
 def testGetTrovesLatestByLabel(self):
     # test out the no trove queries that now use getTrovesLatestByLabel
     trv1 = self.addComponent('foo:run', '/localhost@rpl:branch//rpl:linux/1.0-1-1')
     trv2 = self.addComponent('foo:run', '1.0-1-2')
     trv3 = self.addComponent('foo:run', '/localhost@rpl:branch//rpl:linux/1.0-1-3', 'ssl')
     repos = self.openRepository()
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                    VERSION_FILTER_LATEST,
                                    FLAVOR_FILTER_BEST,
                                    self.cfg.installLabelPath,
                                    self.cfg.flavor, affinityDb=None)
     assert(len(tups) == 1)
     assert(tups[0] == trv3.getNameVersionFlavor())
     tups = queryrep.getTrovesToDisplay(repos, [], [], [],
                                    VERSION_FILTER_LEAVES,
                                    FLAVOR_FILTER_BEST,
                                    self.cfg.installLabelPath,
                                    self.cfg.flavor, affinityDb=None)
     assert(len(tups) == 2)
     assert(set(tups) == set([trv3.getNameVersionFlavor(),
                              trv2.getNameVersionFlavor()]))
Beispiel #13
0
 def repo_query(self, trove):
     '''
     trove is a string "n[=v][[f]]".
     Returns a list of (name, Version, Flavor) tuples.
     '''
     repos = self._get_repos()
     try:
         ret = queryrep.getTrovesToDisplay(repos, [trove], [], [],
                 queryrep.VERSION_FILTER_LATEST,
                 queryrep.FLAVOR_FILTER_BEST, self.default_label,
                 self.flavors, None)
     except errors.TroveNotFound:
         ret = []
     return ret
Beispiel #14
0
        def _check(troveSpecs, versionFilter, flavorFilter, expected, all=False,
                   present=False):
            if all:
                troveTypes = TROVE_QUERY_ALL
            elif present:
                troveTypes = TROVE_QUERY_PRESENT
            else:
                troveTypes = TROVE_QUERY_NORMAL

            tups = queryrep.getTrovesToDisplay(repos, troveSpecs, [], [],
                                        versionFilter, flavorFilter,
                                        self.cfg.installLabelPath,
                                        self.cfg.flavor,
                                        None,
                                        troveTypes=troveTypes)
            self._checkTupVers(tups, expected)
Beispiel #15
0
        def _check(troveSpecs,
                   versionFilter,
                   flavorFilter,
                   expected,
                   all=False,
                   present=False):
            if all:
                troveTypes = TROVE_QUERY_ALL
            elif present:
                troveTypes = TROVE_QUERY_PRESENT
            else:
                troveTypes = TROVE_QUERY_NORMAL

            tups = queryrep.getTrovesToDisplay(repos,
                                               troveSpecs, [], [],
                                               versionFilter,
                                               flavorFilter,
                                               self.cfg.installLabelPath,
                                               self.cfg.flavor,
                                               None,
                                               troveTypes=troveTypes)
            self._checkTupVers(tups, expected)
Beispiel #16
0
 def _check(troveSpecs, versionFilter, flavorFilter, expected):
     tups = queryrep.getTrovesToDisplay(repos, troveSpecs, [], [],
                                        versionFilter, flavorFilter,
                                        self.cfg.installLabelPath,
                                        targetFlavor, None)
     self._checkTupVers(tups, expected)
Beispiel #17
0
 def _get(affinityDb, versionFilter, flavorFilter, troveSpec):
     return queryrep.getTrovesToDisplay(repos, troveSpec, [], [],
                                        versionFilter, flavorFilter,
                                        self.cfg.installLabelPath,
                                        self.cfg.flavor, affinityDb)
Beispiel #18
0
 def _get(versionFilter, flavorFilter, whatProvidesList):
     return queryrep.getTrovesToDisplay(
         repos, [], [], [deps.parseDep(x)
                         for x in whatProvidesList], versionFilter,
         flavorFilter, self.cfg.installLabelPath, targetFlavor, None)
Beispiel #19
0
 def _get(affinityDb, versionFilter, flavorFilter, troveSpec):
     return queryrep.getTrovesToDisplay(repos, troveSpec, [], [],
                                        versionFilter,
                                        flavorFilter, 
                                        self.cfg.installLabelPath,
                                        self.cfg.flavor, affinityDb)