def download_file(basename, version, tools_directory):
    find_depot_tools_path = os.path.join(CURRENT_PATH, tools_directory)
    sys.path.insert(0, find_depot_tools_path)
    # pylint: disable=F0401
    import find_depot_tools
    depot_tools_path = find_depot_tools.add_depot_tools_to_path()

    gs_path = "gs://mojo/file/" + version + "/" + basename

    output_file = os.path.join(PREBUILT_FILE_PATH, basename)
    gs.download_from_public_bucket(gs_path, output_file, depot_tools_path)
def download_file(basename, version, tools_directory):
  find_depot_tools_path = os.path.join(CURRENT_PATH, tools_directory)
  sys.path.insert(0, find_depot_tools_path)
  # pylint: disable=F0401
  import find_depot_tools
  depot_tools_path = find_depot_tools.add_depot_tools_to_path()

  gs_path = "gs://mojo/file/" + version + "/" + basename

  output_file = os.path.join(PREBUILT_FILE_PATH, basename)
  gs.download_from_public_bucket(gs_path, output_file,
                                 depot_tools_path)
Пример #3
0
def download_binary(version, platform, prebuilt_directory):
  gs_path = "gs://mojo/network/%s/%s.zip" % (version, platform)
  output_directory = os.path.join(prebuilt_directory, platform)
  binary_name = "network_service.mojo"

  with tempfile.NamedTemporaryFile() as temp_zip_file:
    gs.download_from_public_bucket(gs_path, temp_zip_file.name)
    with zipfile.ZipFile(temp_zip_file.name) as z:
      zi = z.getinfo(binary_name)
      mode = zi.external_attr >> 16
      z.extract(zi, output_directory)
      os.chmod(os.path.join(output_directory, binary_name), mode)
Пример #4
0
def roll(target_version):
  find_depot_tools_path = os.path.join(mojo_root_dir, "tools")
  sys.path.insert(0, find_depot_tools_path)
  # pylint: disable=F0401
  import find_depot_tools
  depot_tools_path = find_depot_tools.add_depot_tools_to_path()

  try:
    chromium_rev = chromium_rev_number(target_version)
  except urllib2.HTTPError:
    print ("Failed to identify a Chromium revision associated with %s. "
           "Ensure that target_version is a Chromium origin/master "
           "commit.") % (target_version)
    return 1

  mojoms_gs_path = "gs://mojo/network_service/%s/mojoms.zip" % (target_version,)
  network_service_path = os.path.join(
      mojo_root_dir, "mojo", "services", "network")
  mojoms_path = os.path.join(network_service_path, "public", "interfaces")
  mojo_public_tools_path = os.path.join(
      mojo_root_dir, "mojo", "public", "tools")
  version_path = os.path.join(mojo_public_tools_path, "NETWORK_SERVICE_VERSION")

  try:
    with tempfile.NamedTemporaryFile() as temp_zip_file:
      gs.download_from_public_bucket(mojoms_gs_path, temp_zip_file.name,
                                     depot_tools_path)

      try:
        system(["git", "rm", "-r", mojoms_path], cwd=mojo_root_dir)
      except subprocess.CalledProcessError:
        print ("Could not remove %s. "
               "Ensure your local tree is in a clean state." % mojoms_path)
        return 1

      with zipfile.ZipFile(temp_zip_file.name) as z:
        z.extractall(mojoms_path)
  # pylint: disable=C0302,bare-except
  except:
    print ("Failed to download the mojom files associated with %s. Ensure that "
           "the corresponding network service artifacts were uploaded to "
           "Google Storage.") % (target_version)
    return 1

  with open(version_path, 'w') as stamp_file:
    stamp_file.write(target_version)

  system(["git", "add", "public"], cwd=network_service_path)
  system(["git", "add", "NETWORK_SERVICE_VERSION"], cwd=mojo_public_tools_path)
  commit("Roll the network service to https://crrev.com/" + chromium_rev,
         cwd=mojo_root_dir)
  return 0
def download_app_for_platform(app, version, platform):
    binary_name = app + ".mojo"
    gs_path = "gs://mojo/%s/%s/%s/%s.zip" % (app, version, platform,
                                             binary_name)
    output_directory = os.path.join(_PREBUILT_PATH, app, platform)

    with tempfile.NamedTemporaryFile() as temp_zip_file:
        gs.download_from_public_bucket(gs_path, temp_zip_file.name,
                                       depot_tools_path)
        with zipfile.ZipFile(temp_zip_file.name) as z:
            zi = z.getinfo(binary_name)
            mode = zi.external_attr >> 16
            z.extract(zi, output_directory)
            os.chmod(os.path.join(output_directory, binary_name), mode)
Пример #6
0
def roll(target_version):
  try:
    chromium_rev = chromium_rev_number(target_version)
  except urllib2.HTTPError:
    print ("Failed to identify a Chromium revision associated with %s. "
           "Ensure that target_version is a Chromium origin/master "
           "commit.") % (target_version)
    return 1

  mojoms_gs_path = "gs://mojo/network_service/%s/mojoms.zip" % (target_version,)
  network_service_path = os.path.join(
      mojo_root_dir, "mojo", "services", "network")
  mojoms_path = os.path.join(network_service_path, "public", "interfaces")
  version_path = os.path.join(network_service_path, "VERSION")

  try:
    with tempfile.NamedTemporaryFile() as temp_zip_file:
      gs.download_from_public_bucket(mojoms_gs_path, temp_zip_file.name)

      try:
        system(["git", "rm", "-r", mojoms_path], cwd=mojo_root_dir)
      except subprocess.CalledProcessError:
        print ("Could not remove %s. "
               "Ensure your local tree is in a clean state." % mojoms_path)
        return 1

      with zipfile.ZipFile(temp_zip_file.name) as z:
        z.extractall(mojoms_path)
  # pylint: disable=C0302,bare-except
  except:
    print ("Failed to download the mojom files associated with %s. Ensure that "
           "the corresponding network service artifacts were uploaded to "
           "Google Storage.") % (target_version)
    return 1

  with open(version_path, 'w') as stamp_file:
    stamp_file.write(target_version)

  system(["git", "add", "public"], cwd=network_service_path)
  system(["git", "add", "VERSION"], cwd=network_service_path)
  commit("Roll the network service to https://crrev.com/" + chromium_rev,
         cwd=mojo_root_dir)
  return 0
Пример #7
0
def download_version_for_platform(version, platform, tools_directory):
  find_depot_tools_path = os.path.join(CURRENT_PATH, tools_directory)
  sys.path.insert(0, find_depot_tools_path)
  # pylint: disable=F0401
  import find_depot_tools
  depot_tools_path = find_depot_tools.add_depot_tools_to_path()

  basename = platform + ".zip"
  gs_path = "gs://mojo/shell/" + version + "/" + basename

  with tempfile.NamedTemporaryFile() as temp_zip_file:
    gs.download_from_public_bucket(gs_path, temp_zip_file.name,
                                   depot_tools_path)
    binary_name = BINARY_FOR_PLATFORM[platform]
    output_dir = os.path.join(PREBUILT_FILE_PATH, platform)
    with zipfile.ZipFile(temp_zip_file.name) as z:
      zi = z.getinfo(binary_name)
      mode = zi.external_attr >> 16
      z.extract(zi, output_dir)
      os.chmod(os.path.join(output_dir, binary_name), mode)
Пример #8
0
def download_version_for_platform(version, platform, tools_directory):
  find_depot_tools_path = os.path.join(CURRENT_PATH, tools_directory)
  sys.path.insert(0, find_depot_tools_path)
  # pylint: disable=F0401
  import find_depot_tools
  depot_tools_path = find_depot_tools.add_depot_tools_to_path()

  basename = platform + ".zip"
  gs_path = "gs://mojo/shell/" + version + "/" + basename

  with tempfile.NamedTemporaryFile() as temp_zip_file:
    gs.download_from_public_bucket(gs_path, temp_zip_file.name,
                                   depot_tools_path)
    binary_name = BINARY_FOR_PLATFORM[platform]
    output_dir = os.path.join(PREBUILT_FILE_PATH, platform)
    with zipfile.ZipFile(temp_zip_file.name) as z:
      zi = z.getinfo(binary_name)
      mode = zi.external_attr >> 16
      z.extract(zi, output_dir)
      os.chmod(os.path.join(output_dir, binary_name), mode)
def download_app_for_platform(app, version, platform, tools_directory):
  find_depot_tools_path = os.path.join(_CURRENT_PATH, tools_directory)
  sys.path.insert(0, find_depot_tools_path)
  # pylint: disable=F0401
  import find_depot_tools
  depot_tools_path = find_depot_tools.add_depot_tools_to_path()

  binary_name = app + ".mojo"
  gs_path = "gs://mojo/%s/%s/%s/%s.zip" % (app, version, platform, binary_name)
  output_directory = os.path.join(script_dir,
                                  "prebuilt/%s/%s" % (app, platform))

  with tempfile.NamedTemporaryFile() as temp_zip_file:
    gs.download_from_public_bucket(gs_path, temp_zip_file.name,
                                   depot_tools_path)
    with zipfile.ZipFile(temp_zip_file.name) as z:
      zi = z.getinfo(binary_name)
      mode = zi.external_attr >> 16
      z.extract(zi, output_directory)
      os.chmod(os.path.join(output_directory, binary_name), mode)
def download_app_for_platform(app, version, platform, tools_directory):
  find_depot_tools_path = os.path.join(_CURRENT_PATH, tools_directory)
  sys.path.insert(0, find_depot_tools_path)
  # pylint: disable=F0401
  import find_depot_tools
  depot_tools_path = find_depot_tools.add_depot_tools_to_path()

  binary_name = app + ".mojo"
  gs_path = "gs://mojo/%s/%s/%s/%s.zip" % (app, version, platform, binary_name)
  output_directory = os.path.join(script_dir,
                                  "prebuilt/%s/%s" % (app, platform))

  with tempfile.NamedTemporaryFile() as temp_zip_file:
    gs.download_from_public_bucket(gs_path, temp_zip_file.name,
                                   depot_tools_path)
    with zipfile.ZipFile(temp_zip_file.name) as z:
      zi = z.getinfo(binary_name)
      mode = zi.external_attr >> 16
      z.extract(zi, output_directory)
      os.chmod(os.path.join(output_directory, binary_name), mode)
Пример #11
0
def roll(target_version):
    mojoms_gs_path = "gs://mojo/network/%s/mojoms.zip" % (target_version, )
    network_service_path = os.path.join(mojo_root_dir, "mojo", "services",
                                        "network")
    mojoms_path = os.path.join(network_service_path, "public", "interfaces")
    version_path = os.path.join(network_service_path, "VERSION")

    with tempfile.NamedTemporaryFile() as temp_zip_file:
        gs.download_from_public_bucket(mojoms_gs_path, temp_zip_file.name)
        with zipfile.ZipFile(temp_zip_file.name) as z:
            z.extractall(mojoms_path)

    with open(version_path, 'w') as stamp_file:
        stamp_file.write(target_version)

    system(["git", "add", "public"], cwd=network_service_path)
    system(["git", "add", "VERSION"], cwd=network_service_path)
    chromium_rev = chromium_rev_number(target_version)
    commit("Roll the network service to https://crrev.com/" + chromium_rev,
           cwd=mojo_root_dir)
    return 0
Пример #12
0
def roll(target_version, custom_build):
  find_depot_tools_path = os.path.join(mojo_root_dir, "tools")
  sys.path.insert(0, find_depot_tools_path)
  # pylint: disable=F0401
  import find_depot_tools
  depot_tools_path = find_depot_tools.add_depot_tools_to_path()

  if custom_build:
    match = re.search(
        "^custom_build_base_([^_]+)_issue_([0-9]+)_patchset_([0-9]+)$",
        target_version)
    if not match:
      print "Failed to parse the version name."
      return 1
    chromium_commit_hash = match.group(1)
    rietveld_issue = match.group(2)
    rietveld_patchset = match.group(3)
  else:
    chromium_commit_hash = target_version

  try:
    chromium_rev = chromium_rev_number(chromium_commit_hash)
  except urllib2.HTTPError:
    print ("Failed to identify a Chromium revision associated with %s. "
           "Ensure that it is a Chromium origin/master "
           "commit.") % (chromium_commit_hash)
    return 1

  mojoms_gs_path = "gs://mojo/network_service/%s/mojoms.zip" % (target_version,)
  network_service_path = os.path.join(
      mojo_root_dir, "mojo", "services", "network")
  mojoms_path = os.path.join(network_service_path, "public", "interfaces")
  mojo_public_tools_path = os.path.join(
      mojo_root_dir, "mojo", "public", "tools")
  version_path = os.path.join(mojo_public_tools_path, "NETWORK_SERVICE_VERSION")

  try:
    with tempfile.NamedTemporaryFile() as temp_zip_file:
      gs.download_from_public_bucket(mojoms_gs_path, temp_zip_file.name,
                                     depot_tools_path)

      try:
        system(["git", "rm", "-r", mojoms_path], cwd=mojo_root_dir)
      except subprocess.CalledProcessError:
        print ("Could not remove %s. "
               "Ensure your local tree is in a clean state." % mojoms_path)
        return 1

      with zipfile.ZipFile(temp_zip_file.name) as z:
        z.extractall(mojoms_path)
  # pylint: disable=C0302,bare-except
  except:
    print ("Failed to download the mojom files associated with %s. Ensure that "
           "the corresponding network service artifacts were uploaded to "
           "Google Storage.") % (target_version)
    return 1

  with open(version_path, 'w') as stamp_file:
    stamp_file.write(target_version)

  system(["git", "add", "public"], cwd=network_service_path)
  system(["git", "add", "NETWORK_SERVICE_VERSION"], cwd=mojo_public_tools_path)

  if custom_build:
    commit_message = ("Roll the network service to a custom build created from "
                      "https://crrev.com/%s/#ps%s") % (rietveld_issue,
                                                       rietveld_patchset)
  else:
    commit_message = ("Roll the network service to "
                      "https://crrev.com/%s") % chromium_rev
  commit(commit_message, cwd=mojo_root_dir)
  return 0