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' ])
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'])
def runCommand(self, cfg, argSet, args, profile = False, callback = None, repos = None): if not args or len(args) < 2: return self.usage() diffArgs = [repos, ] diffArgs.append(argSet.pop('revision', None)); if len(args) > 2: diffArgs.append(args[2:]); return checkin.diff(*diffArgs)
def runCommand(self, cfg, argSet, args, profile=False, callback=None, repos=None): if not args or len(args) < 2: return self.usage() diffArgs = [ repos, ] diffArgs.append(argSet.pop('revision', None)) if len(args) > 2: diffArgs.append(args[2:]) return checkin.diff(*diffArgs)