Beispiel #1
0
def UpdateTarget(repository, options):
    source = os.path.join(options.v8_path, *repository)
    target = os.path.join(options.node_path, TARGET_SUBDIR, *repository)
    print ">> Updating target directory %s" % target
    print ">>     from active branch at %s" % source
    if not os.path.exists(target):
        os.makedirs(target)
    # Remove possible remnants of previous incomplete runs.
    node_common.UninitGit(target)

    git_commands = [
        ["git", "init"],  # initialize target repo
        ["git", "remote", "add", "origin", source],  # point to the source repo
        ["git", "fetch", "origin", "HEAD"],  # sync to the current branch
        ["git", "reset", "--hard",
         "FETCH_HEAD"],  # reset to the current branch
        ["git", "clean", "-fd"],  # delete removed files
    ]
    try:
        for command in git_commands:
            subprocess.check_call(command, cwd=target)
    except:
        raise
    finally:
        node_common.UninitGit(target)
def UpdateTarget(repository, options, files_to_keep):
    source = os.path.join(options.v8_path, *repository)
    target = os.path.join(options.node_path, TARGET_SUBDIR, *repository)
    print(">> Updating target directory %s" % target)
    print(">>     from active branch at %s" % source)
    if not os.path.exists(target):
        os.makedirs(target)
    # Remove possible remnants of previous incomplete runs.
    node_common.UninitGit(target)

    git_args = []
    git_args.append(["init"])  # initialize target repo

    if files_to_keep:
        git_args.append(["add"] + files_to_keep)  # add and commit
        git_args.append(["commit", "-m",
                         "keep files"])  # files we want to keep

    git_args.append(["clean", "-fxd"])  # nuke everything else
    git_args.append(["remote", "add", "source",
                     source])  # point to source repo
    git_args.append(["fetch", "source", "HEAD"])  # sync to current branch
    git_args.append(["checkout", "-f", "FETCH_HEAD"])  # switch to that branch
    git_args.append(["clean", "-fxd"])  # delete removed files

    if files_to_keep:
        git_args.append(["cherry-pick", "master"])  # restore kept files

    try:
        for args in git_args:
            subprocess.check_call(["git"] + args, cwd=target)
    except:
        raise
    finally:
        node_common.UninitGit(target)
Beispiel #3
0
def FetchDeps(v8_path):
  # Verify path.
  v8_path = os.path.abspath(v8_path)
  assert os.path.isdir(v8_path)

  # Check out depot_tools if necessary.
  depot_tools = node_common.EnsureDepotTools(v8_path, True)

  temporary_git = EnsureGit(v8_path)
  try:
    print "Fetching dependencies."
    env = os.environ.copy()
    # gclient needs to have depot_tools in the PATH.
    env["PATH"] = depot_tools + os.pathsep + env["PATH"]
    spec = "solutions = %s" % GCLIENT_SOLUTION
    subprocess.check_call(["gclient", "sync", "--spec", spec],
                          cwd=os.path.join(v8_path, os.path.pardir),
                          env=env)
  except:
    raise
  finally:
    if temporary_git:
      node_common.UninitGit(v8_path)
    # Clean up .gclient_entries file.
    gclient_entries = os.path.normpath(
        os.path.join(v8_path, os.pardir, ".gclient_entries"))
    if os.path.isfile(gclient_entries):
      os.remove(gclient_entries)
Beispiel #4
0
def FetchDeps(v8_path):
    # TODO(v8:6105):
    # The return value gates whether Node's configure script actually
    # uses GN. Change this to true once everything is ready so that
    # the change to enable the GN build on the bots comes from V8.
    return False

    # Verify path.
    v8_path = os.path.abspath(v8_path)
    assert os.path.isdir(v8_path)

    # Check out depot_tools if necessary.
    depot_tools = node_common.EnsureDepotTools(v8_path, True)

    temporary_git = EnsureGit(v8_path)
    try:
        print "Fetching dependencies."
        env = os.environ.copy()
        # gclient needs to have depot_tools in the PATH.
        env["PATH"] = depot_tools + os.pathsep + env["PATH"]
        spec = "solutions = %s" % GCLIENT_SOLUTION
        subprocess.check_call(["gclient", "sync", "--spec", spec],
                              cwd=os.path.join(v8_path, os.path.pardir),
                              env=env)
    except:
        raise
    finally:
        if temporary_git:
            node_common.UninitGit(v8_path)
        # Clean up .gclient_entries file.
        gclient_entries = os.path.normpath(
            os.path.join(v8_path, os.pardir, ".gclient_entries"))
        if os.path.isfile(gclient_entries):
            os.remove(gclient_entries)
Beispiel #5
0
def FetchDeps(v8_path, depot_tools):
  temporary_git = EnsureGit(v8_path)
  try:
    print "Fetching dependencies."
    gclient = os.path.join(depot_tools, "gclient")
    spec = "solutions = %s" % GCLIENT_SOLUTION
    subprocess.check_call([gclient, "sync", "--spec", spec],
                          cwd=os.path.join(v8_path, os.path.pardir))
  except:
    raise
  finally:
    if temporary_git:
      node_common.UninitGit(v8_path)
Beispiel #6
0
def FetchDeps(v8_path, depot_tools):
    temporary_git = EnsureGit(v8_path)
    try:
        print "Fetching dependencies."
        env = os.environ.copy()
        # gclient needs to have depot_tools in the PATH.
        env["PATH"] = depot_tools + os.pathsep + env["PATH"]
        spec = "solutions = %s" % GCLIENT_SOLUTION
        subprocess.check_call(["gclient", "sync", "--spec", spec],
                              cwd=os.path.join(v8_path, os.path.pardir),
                              env=env)
    except:
        raise
    finally:
        if temporary_git:
            node_common.UninitGit(v8_path)