Exemple #1
0
def updateRecipes(repos, cfg, recipeList, committedSources):
    committedSourcesByNB = {}
    for name, version, flavor in committedSources:
        committedSourcesByNB[name, version.branch()] = version
    for recipe in recipeList:
        recipeDir = os.path.dirname(recipe)
        stateFilePath = recipeDir + '/CONARY'
        if not os.path.exists(stateFilePath):
            continue
        conaryStateFile = state.ConaryStateFromFile(stateFilePath)
        if not conaryStateFile.hasSourceState():
            continue
        context = conaryStateFile.getContext()
        stateFile = conaryStateFile.getSourceState()
        troveName = stateFile.getName()
        branch = stateFile.getBranch()
        if (troveName, branch) not in committedSourcesByNB:
            continue
        stateVersion = stateFile.getVersion()
        newVersion = committedSourcesByNB[troveName, branch]
        if stateVersion != versions.NewVersion():
            log.info('Updating %s after commit' % recipeDir)
            try:
                # Added in CNY-3035
                checkin.nologUpdateSrc(repos, [recipeDir])
            except checkin.builderrors.UpToDate:
                pass # Don't mention if the source is already up to date
            except checkin.builderrors.CheckinError, e:
                e.logError()
            except AttributeError:
                checkin.updateSrc(repos, [recipeDir])
Exemple #2
0
def updateRecipes(repos, cfg, recipeList, committedSources):
    committedSourcesByNB = {}
    for name, version, flavor in committedSources:
        committedSourcesByNB[name, version.branch()] = version
    for recipe in recipeList:
        recipeDir = os.path.dirname(recipe)
        stateFilePath = recipeDir + '/CONARY'
        if not os.path.exists(stateFilePath):
            continue
        conaryStateFile = state.ConaryStateFromFile(stateFilePath)
        if not conaryStateFile.hasSourceState():
            continue
        context = conaryStateFile.getContext()
        stateFile = conaryStateFile.getSourceState()
        troveName = stateFile.getName()
        branch = stateFile.getBranch()
        if (troveName, branch) not in committedSourcesByNB:
            continue
        stateVersion = stateFile.getVersion()
        newVersion = committedSourcesByNB[troveName, branch]
        if stateVersion != versions.NewVersion():
            log.info('Updating %s after commit' % recipeDir)
            if compat.ConaryVersion().updateSrcTakesMultipleVersions():
                try:
                    # Added in CNY-3035
                    checkin.nologUpdateSrc(repos, [recipeDir])
                except checkin.builderrors.UpToDate:
                    pass  # Don't mention if the source is already up to date
                except checkin.builderrors.CheckinError, e:
                    e.logError()
                except AttributeError:
                    checkin.updateSrc(repos, [recipeDir])
            else:
                curDir = os.getcwd()
                try:
                    os.chdir(recipeDir)
                    checkin.updateSrc(repos)
                finally:
                    os.chdir(curDir)
Exemple #3
0
 def updateCheckout(self, targetDir):
     """
     Update a subdirectory containing a checkout of a conary
     source package.  Similar to the C{cvc update} command.
     @param targetDir: subdirectory containing package to update
     @type targetDir: string
     @return: Status
     @rtype: bool
     """
     # Conary likes absolute paths RBLD-137
     targetDir = os.path.abspath(targetDir)
     try:
         return checkin.nologUpdateSrc(self._getRepositoryClient(),
                                       [targetDir])
     except (builderrors.UpToDate, builderrors.NotCheckedInError):
         # The end result is an up to date checkout, so ignore the exception
         return True
     except builderrors.CheckinError, e:
         # All other exceptions are deemed failures
         raise errors.RbuildError(str(e))
Exemple #4
0
 def updateCheckout(self, targetDir):
     """
     Update a subdirectory containing a checkout of a conary
     source package.  Similar to the C{cvc update} command.
     @param targetDir: subdirectory containing package to update
     @type targetDir: string
     @return: Status
     @rtype: bool
     """
     # Conary likes absolute paths RBLD-137
     targetDir = os.path.abspath(targetDir)
     try:
         return checkin.nologUpdateSrc(self._getRepositoryClient(),
                                       [targetDir])
     except (builderrors.UpToDate, builderrors.NotCheckedInError):
         # The end result is an up to date checkout, so ignore the exception
         return True
     except builderrors.CheckinError, e:
         # All other exceptions are deemed failures
         raise errors.RbuildError(str(e))