Beispiel #1
0
    def testUpdateRecipesAddFile(self):
        simpleRecipe = recipes.simpleRecipe
        repos = self.openRepository()
        trv = self.addComponent('simple:source', '1.0',
                                [('simple.recipe', simpleRecipe),
                                 ('bam', 'bam\n')])
        os.chdir(self.workDir)
        self.checkout('simple')
        os.chdir('simple')
        self.writeFile('foo', 'bar\n')
        self.addfile('foo', text=True)
        self.writeFile('bar', 'bar\n')
        self.addfile('bar', binary=True)
        self.remove('bam')

        trv = self.addComponent('simple:source', '2.0',
                                [('simple.recipe', simpleRecipe),
                                 ('foo', 'bar\n'),
                                 ('bar', 'bar\n')])
        commit.updateRecipes(repos, self.buildCfg,
                             [os.getcwd() + '/simple.recipe'],
                             [trv.getNameVersionFlavor()])
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        stateFile = conaryStateFile.getSourceState()
        assert(stateFile.getVersion() == trv.getVersion())
Beispiel #2
0
    def testUpdateRecipes(self):
        self.logFilter.add()
        log.setVerbosity(log.INFO)
        simpleRecipe = recipes.simpleRecipe
        os.chdir(self.workDir)
        self.newpkg('simple')
        os.chdir('simple')
        self.writeFile('simple.recipe', simpleRecipe)
        self.addfile('simple.recipe')
        self.writeFile('foo', 'bar\n')
        self.buildCfg.configLine('[foo]')
        self.buildCfg.configLine('[bar]')
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        conaryStateFile.setContext('foo')
        conaryStateFile.write(os.getcwd() + '/CONARY')

        # here we pretend we've done an rmake commit of the same job.
        repos = self.openRepository()
        trv = self.addComponent('simple:source', '1.0',
                                [('simple.recipe', simpleRecipe)])
        commit.updateRecipes(repos, self.buildCfg,
                             [os.getcwd() + '/simple.recipe'],
                             [trv.getNameVersionFlavor()])
        assert (os.path.exists('foo'))
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        stateFile = conaryStateFile.getSourceState()
        assert (stateFile.getVersion() == trv.getVersion())
        assert (conaryStateFile.getContext() == 'foo')
        conaryStateFile.setContext('bar')
        conaryStateFile.write(os.getcwd() + '/CONARY')
        assert (checkin.diff(repos) == 0)
        trv = self.addComponent(
            'simple:source', '2.0',
            [('simple.recipe', simpleRecipe + '\n\t#change\n')])
        assert (checkin.diff(repos) == 0)
        commit.updateRecipes(repos, self.buildCfg,
                             [os.getcwd() + '/simple.recipe'],
                             [trv.getNameVersionFlavor()])
        assert (checkin.diff(repos) == 0)
        assert (os.path.exists('foo'))
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        stateFile = conaryStateFile.getSourceState()
        assert (stateFile.getVersion() == trv.getVersion())
        assert (conaryStateFile.getContext() == 'bar')
        self.logFilter.compare([
            '+ Replacing CONARY file %s/simple after initial commit' %
            self.workDir,
            '+ Updating %s/simple after commit' % self.workDir,
            '+ patching %s/simple/simple.recipe' % self.workDir,
            '+ patch: applying hunk 1 of 1'
        ])
Beispiel #3
0
    def testUpdateRecipes(self):
        self.logFilter.add()
        log.setVerbosity(log.INFO)
        simpleRecipe = recipes.simpleRecipe
        os.chdir(self.workDir)
        self.newpkg('simple')
        os.chdir('simple')
        self.writeFile('simple.recipe', simpleRecipe)
        self.addfile('simple.recipe')
        self.writeFile('foo', 'bar\n')
        self.buildCfg.configLine('[foo]')
        self.buildCfg.configLine('[bar]')
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        conaryStateFile.setContext('foo')
        conaryStateFile.write(os.getcwd() + '/CONARY')

        # here we pretend we've done an rmake commit of the same job.
        repos = self.openRepository()
        trv = self.addComponent('simple:source', '1.0',
                                [('simple.recipe', simpleRecipe)])
        commit.updateRecipes(repos, self.buildCfg,
                             [os.getcwd() + '/simple.recipe'],
                             [trv.getNameVersionFlavor()])
        assert(os.path.exists('foo'))
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        stateFile = conaryStateFile.getSourceState()
        assert(stateFile.getVersion() == trv.getVersion())
        assert(conaryStateFile.getContext() == 'foo')
        conaryStateFile.setContext('bar')
        conaryStateFile.write(os.getcwd() + '/CONARY')
        assert(checkin.diff(repos) == 0)
        trv = self.addComponent('simple:source', '2.0',
                                [('simple.recipe',
                                 simpleRecipe + '\n\t#change\n')])
        assert(checkin.diff(repos) == 0)
        commit.updateRecipes(repos, self.buildCfg,
                             [os.getcwd() + '/simple.recipe'],
                             [trv.getNameVersionFlavor()])
        assert(checkin.diff(repos) == 0)
        assert(os.path.exists('foo'))
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        stateFile = conaryStateFile.getSourceState()
        assert(stateFile.getVersion() == trv.getVersion())
        assert(conaryStateFile.getContext() == 'bar')
        self.logFilter.compare([
       '+ Replacing CONARY file %s/simple after initial commit' % self.workDir, 
       '+ Updating %s/simple after commit' % self.workDir,
       '+ patching %s/simple/simple.recipe' % self.workDir, 
       '+ patch: applying hunk 1 of 1'])
Beispiel #4
0
    def testUpdateRecipesAddFile(self):
        simpleRecipe = recipes.simpleRecipe
        repos = self.openRepository()
        trv = self.addComponent('simple:source', '1.0',
                                [('simple.recipe', simpleRecipe),
                                 ('bam', 'bam\n')])
        os.chdir(self.workDir)
        self.checkout('simple')
        os.chdir('simple')
        self.writeFile('foo', 'bar\n')
        self.addfile('foo', text=True)
        self.writeFile('bar', 'bar\n')
        self.addfile('bar', binary=True)
        self.remove('bam')

        trv = self.addComponent('simple:source', '2.0',
                                [('simple.recipe', simpleRecipe),
                                 ('foo', 'bar\n'), ('bar', 'bar\n')])
        commit.updateRecipes(repos, self.buildCfg,
                             [os.getcwd() + '/simple.recipe'],
                             [trv.getNameVersionFlavor()])
        conaryStateFile = state.ConaryStateFromFile(os.getcwd() + '/CONARY')
        stateFile = conaryStateFile.getSourceState()
        assert (stateFile.getVersion() == trv.getVersion())
Beispiel #5
0
                print '    %s ->' % _formatTup(buildTroveTup)
                print ''.join('       %s=%s[%s]\n' % x
                              for x in sorted(committedList,
                                              _sortCommitted))
        if updateRecipes:
            # After the build is done, update .recipe files with the
            # committed versions.
            recipes = []
            for config in job.iterConfigList():
                for name, version, flavor in config.buildTroveSpecs:
                    if (os.path.exists(name)
                        and name.endswith('.recipe')):
                        recipes.append(name)
            recipes = list(set(recipes))
            if recipes:
                commit.updateRecipes(self.getRepos(), self.buildConfig, recipes,
                                     sourceComponents)
        return True

    commitJob = commitJobs # for bw compat

    def deleteJobs(self, jobIdList):
        """
            Deletes the given jobs.

            @param jobIdList: list of jobIds to delete
            @type jobIdList: int or uuid list
        """
        deleted = self.client.deleteJobs(jobIdList)
        print 'deleted %d jobs' % len(deleted)

    def waitForJob(self, jobId):
Beispiel #6
0
                print '    %s ->' % _formatTup(buildTroveTup)
                print ''.join('       %s=%s[%s]\n' % x
                              for x in sorted(committedList,
                                              _sortCommitted))
        if updateRecipes:
            # After the build is done, update .recipe files with the
            # committed versions.
            recipes = []
            for config in job.iterConfigList():
                for name, version, flavor in config.buildTroveSpecs:
                    if (os.path.exists(name)
                        and name.endswith('.recipe')):
                        recipes.append(name)
            recipes = list(set(recipes))
            if recipes:
                commit.updateRecipes(self.getRepos(), self.buildConfig, recipes,
                                     sourceComponents)
        return True

    commitJob = commitJobs # for bw compat

    def deleteJobs(self, jobIdList):
        """
            Deletes the given jobs.

            @param jobIdList: list of jobIds to delete
            @type jobIdList: int or uuid list
        """
        deleted = self.client.deleteJobs(jobIdList)
        print 'deleted %d jobs' % len(deleted)

    def waitForJob(self, jobId):