コード例 #1
0
ファイル: committest.py プロジェクト: fedora-conary/rmake-2
    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())
コード例 #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'
        ])
コード例 #3
0
ファイル: committest.py プロジェクト: fedora-conary/rmake-2
    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'])
コード例 #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())
コード例 #5
0
ファイル: helper.py プロジェクト: pombredanne/rmake
                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):
コード例 #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):