def fetchNuPIC(env, buildWorkspace, nupicRemote, nupicBranch, nupicSha, logger): """ This method clones NuPIC repo if it is not present and checks out to required nupicBranch :param env: The environment which will be used before building. :param buildWorkspace: The workspace where NuPIC should be built :param nupicRemote: URL for NuPIC remote repository :param nupicBranch: The NuPIC branch which will be used to build :param nupicSha: NuPIC SHA used for current run. :raises: infrastructure.utilities.exceptions.MissingSHAError if the given SHA is not found. """ try: with changeToWorkingDir(buildWorkspace): if not os.path.isdir(env["NUPIC"]): git.clone(nupicRemote) with changeToWorkingDir(env["NUPIC"]): git.fetch(nupicRemote, nupicBranch) git.resetHard(nupicSha) except CommandFailedError: logger.exception( "NuPIC checkout failed with %s," " this sha might not exist.", nupicSha)
def fetchNuPIC(env, buildWorkspace, nupicRemote, nupicBranch, nupicSha, logger): """ This method clones NuPIC repo if it is not present and checks out to required nupicBranch :param env: The environment which will be used before building. :param buildWorkspace: The workspace where NuPIC should be built :param nupicRemote: URL for NuPIC remote repository :param nupicBranch: The NuPIC branch which will be used to build :param nupicSha: NuPIC SHA used for current run. :raises infrastructure.utilities.exceptions.MissingSHAError: if the given SHA is not found. """ try: with changeToWorkingDir(buildWorkspace): if not os.path.isdir(env["NUPIC"]): git.clone(nupicRemote, logger=logger) with changeToWorkingDir(env["NUPIC"]): git.fetch(nupicRemote, nupicBranch, logger=logger) git.resetHard(sha=nupicSha, logger=logger) except CommandFailedError: logger.exception("NuPIC checkout failed with %s," " this sha might not exist.", nupicSha)