Esempio n. 1
0
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"]):
        YOMP.clone(nupicRemote)

    with changeToWorkingDir(env["NUPIC"]):
      YOMP.fetch(nupicRemote, nupicBranch)
      YOMP.resetHard(nupicSha)
  except CommandFailedError:
    logger.exception("NuPIC checkout failed with %s,"
                     " this sha might not exist.", nupicSha)
Esempio n. 2
0
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"]):
                YOMP.clone(nupicRemote)

        with changeToWorkingDir(env["NUPIC"]):
            YOMP.fetch(nupicRemote, nupicBranch)
            YOMP.resetHard(nupicSha)
    except CommandFailedError:
        logger.exception(
            "NuPIC checkout failed with %s,"
            " this sha might not exist.", nupicSha)