Exemplo n.º 1
0
 def testPrimaryFlavorComesThrough(self):
     # we specified this flavor at the command line.  Even though
     # it may not be needed for display, it's needed to ensure that the
     # flavor gets cooked in the right environ.
     trv = self.addComponent("simple:source", "1", [("simple.recipe", recipes.simpleRecipe)])
     flavor = deps.parseFlavor("!ssl,readline")
     repos = self.openRepository()
     job = self.newJob((trv.getName(), trv.getVersion(), flavor))
     results = recipeutil.getSourceTrovesFromJob(job, repos=repos, reposName=self.rmakeCfg.reposName)
     self.failUnless(results.values()[0].flavor.stronglySatisfies(deps.parseFlavor("readline,!ssl")))
Exemplo n.º 2
0
    def testLoadFactoryRecipe(self):
        import conary.build.factory

        if not hasattr(conary.build.factory, "generateFactoryRecipe"):
            raise testsuite.SkipTestException("Cooking Factories requires a newer conary")
        trv = self.addComponent(
            "factory-simple:source", "1", [("factory-simple.recipe", recipes.simpleFactory)], factory="factory"
        )
        repos = self.openRepository()
        job = self.newJob((trv.getName(), trv.getVersion(), trv.getFlavor()))
        results = recipeutil.getSourceTrovesFromJob(job, repos=repos, reposName=self.rmakeCfg.reposName)
        self.failUnless("setup:runtime" in results.values()[0].buildRequirements, "Build Requirements were not loaded.")
Exemplo n.º 3
0
 def testPrimaryFlavorComesThrough(self):
     # we specified this flavor at the command line.  Even though 
     # it may not be needed for display, it's needed to ensure that the
     # flavor gets cooked in the right environ.
     trv = self.addComponent('simple:source', '1', 
                             [('simple.recipe', recipes.simpleRecipe)])
     flavor = deps.parseFlavor('!ssl,readline')
     repos = self.openRepository()
     job = self.newJob((trv.getName(), trv.getVersion(), flavor))
     results = recipeutil.getSourceTrovesFromJob(job, repos=repos,
         reposName=self.rmakeCfg.reposName)
     self.failUnless(results.values()[0].flavor.stronglySatisfies(
         deps.parseFlavor('readline,!ssl')))
Exemplo n.º 4
0
 def testLoadFactoryRecipe(self):
     import conary.build.factory
     if not hasattr(conary.build.factory, 'generateFactoryRecipe'):
         raise testsuite.SkipTestException('Cooking Factories requires a newer conary')
     trv = self.addComponent('factory-simple:source', '1',
                             [('factory-simple.recipe',
                             recipes.simpleFactory)], factory="factory")
     repos = self.openRepository()
     job = self.newJob((trv.getName(), trv.getVersion(), trv.getFlavor()))
     results = recipeutil.getSourceTrovesFromJob(job, repos=repos,
         reposName=self.rmakeCfg.reposName)
     self.failUnless('setup:runtime'
         in results.values()[0].buildRequirements, 
         "Build Requirements were not loaded.")
Exemplo n.º 5
0
    def testGetSourceTrovesFromJob(self):
        repos = mock.mockClass(repocache.CachingTroveSource)()
        trv1 = self.newBuildTrove(1, *self.makeTroveTuple('bar:source'))
        trv1Tup = trv1.getNameVersionFlavor(True)
        trv1.setConfig(self.buildCfg)
        job = self.newJob()
        job.addBuildTrove(trv1)
        mock.mockFunction(recipeutil.loadSourceTroves, {trv1Tup: 'result'})

        rc = recipeutil.getSourceTrovesFromJob(job, [trv1], repos,
                                               self.rmakeCfg.reposName)
        self.failUnlessEqual(rc, {trv1Tup: 'result'})
        args, kw = recipeutil.loadSourceTroves._mock.popCall()
        assert (args[3] == [trv1])
Exemplo n.º 6
0
    def testGetSourceTrovesFromJob(self):
        repos = mock.mockClass(repocache.CachingTroveSource)()
        trv1 = self.newBuildTrove(1, *self.makeTroveTuple('bar:source'))
        trv1Tup = trv1.getNameVersionFlavor(True)
        trv1.setConfig(self.buildCfg)
        job = self.newJob()
        job.addBuildTrove(trv1)
        mock.mockFunction(recipeutil.loadSourceTroves, {trv1Tup: 'result'})

        rc = recipeutil.getSourceTrovesFromJob(job, [trv1], repos,
            self.rmakeCfg.reposName)
        self.failUnlessEqual(rc, {trv1Tup: 'result'})
        args, kw = recipeutil.loadSourceTroves._mock.popCall()
        assert(args[3] == [trv1])
Exemplo n.º 7
0
    def testLoadRecipeUsingInternalRepos(self):
        self.openRepository()
        repos = self.openRmakeRepository()

        upstreamV = VFS('/localhost@rpl:1/1.0-1')
        sourceV = VFS('/localhost@rpl:1//rmakehost@rpl:1/1.0-1')

        self.addComponent('loaded:source', str(sourceV),
                          [('loaded.recipe', 
                            fixtures.loadedRecipe.replace('@@', '1.0'))])
        self.addComponent('loaded:source', str(upstreamV).replace('1.0', '2.0'),
                          [('loaded.recipe', 
                            fixtures.loadedRecipe.replace('@@', '2.0'))])
        trv = self.addComponent('load:source', str(sourceV),
                          [('load.recipe', fixtures.loadRecipe)])
        job = self.newJob(trv)
        results = recipeutil.getSourceTrovesFromJob(job, repos=repos)
        self.assertEqual(results.values()[0].packages,
            set(['load', 'loaded-2.0']))
Exemplo n.º 8
0
    def testLoadRecipeUsingInternalRepos(self):
        self.openRepository()
        repos = self.openRmakeRepository()

        upstreamV = VFS("/localhost@rpl:1/1.0-1")
        sourceV = VFS("/localhost@rpl:1//rmakehost@rpl:1/1.0-1")

        self.addComponent(
            "loaded:source", str(sourceV), [("loaded.recipe", fixtures.loadedRecipe.replace("@@", "1.0"))]
        )
        self.addComponent(
            "loaded:source",
            str(upstreamV).replace("1.0", "2.0"),
            [("loaded.recipe", fixtures.loadedRecipe.replace("@@", "2.0"))],
        )
        trv = self.addComponent("load:source", str(sourceV), [("load.recipe", fixtures.loadRecipe)])
        job = self.newJob(trv)
        results = recipeutil.getSourceTrovesFromJob(job, repos=repos)
        self.assertEqual(results.values()[0].packages, set(["load", "loaded-2.0"]))
Exemplo n.º 9
0
def _buildJob(self, buildConfig, buildTroveSpecs, builtMapping):
    client = conaryclient.ConaryClient(buildConfig)
    job = buildcmd.getBuildJob(buildConfig, client, buildTroveSpecs)
    db = self.openRmakeDatabase()
    db.addJob(job)
    db.subscribeToJob(job)
    loadResults = recipeutil.getSourceTrovesFromJob(job,
                                                    repos=client.getRepos())
    for trove in job.iterLoadableTroves():
        result = loadResults.get(trove.getNameVersionFlavor(True), None)
        if result:
            trove.troveLoaded(result)
    job.setBuildTroves(list(job.iterTroves()))
    for buildTrove in job.iterTroves():
        binaries = builtMapping.get(buildTrove.getName().split(':')[0], None)
        if isinstance(binaries, dict):
            binaries = binaries.get(buildTrove.getContext(), None)
        if binaries:
            buildTrove.troveBuilt([x.getNameVersionFlavor() for x in binaries])
        else:
            buildTrove.troveFailed('Failure')
    job.jobPassed('passed')
    return job
Exemplo n.º 10
0
def _buildJob(self, buildConfig, buildTroveSpecs, builtMapping):
    client = conaryclient.ConaryClient(buildConfig)
    job = buildcmd.getBuildJob(buildConfig, client, buildTroveSpecs)
    db = self.openRmakeDatabase()
    db.addJob(job)
    db.subscribeToJob(job)
    loadResults = recipeutil.getSourceTrovesFromJob(job,
        repos=client.getRepos())
    for trove in job.iterLoadableTroves():
        result = loadResults.get(trove.getNameVersionFlavor(True), None)
        if result:
            trove.troveLoaded(result)
    job.setBuildTroves(list(job.iterTroves()))
    for buildTrove in job.iterTroves():
        binaries =  builtMapping.get(buildTrove.getName().split(':')[0], None)
        if isinstance(binaries, dict):
            binaries = binaries.get(buildTrove.getContext(), None)
        if binaries:
            buildTrove.troveBuilt([x.getNameVersionFlavor() for x in binaries])
        else:
            buildTrove.troveFailed('Failure')
    job.jobPassed('passed')
    return job