#!/usr/bin/env python3
# Copyright (C) 2021 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DO NOT EDIT. Auto-generated by tools/gen_amalgamated_python_tools
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

# This file should do the same thing when being invoked in any of these ways:
# ./traceconv
# python traceconv
# bash traceconv
# cat ./traceconv | bash
# cat ./traceconv | python -

BASH_FALLBACK=""" "
exec python3 - "$@" <<'#'EOF
#"""  # yapf: disable


# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/traceconv.py
# This file has been generated by: tools/roll-prebuilts v32.1
TRACECONV_MANIFEST = [{
    'arch':
        'mac-amd64',
    'file_name':
        'traceconv',
    'file_size':
        7805800,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/mac-amd64/traceconv',
    'sha256':
        '0ea0a025cedab2b6cfe605f127daa2a12c98f051f9314c9ab8a59c55306b36c2',
    'platform':
        'darwin',
    'machine': ['x86_64']
}, {
    'arch':
        'mac-arm64',
    'file_name':
        'traceconv',
    'file_size':
        6587480,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/mac-arm64/traceconv',
    'sha256':
        '85bb771be931fe90c9da122f412efb884ff8bd2bd2eaa3f083c2c6ea5dd9205a',
    'platform':
        'darwin',
    'machine': ['arm64']
}, {
    'arch':
        'linux-amd64',
    'file_name':
        'traceconv',
    'file_size':
        8100352,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/linux-amd64/traceconv',
    'sha256':
        'c201fe1c30a00c0e7a1eac169ab91f05d6468a485b0791db3c439888e9334fde',
    'platform':
        'linux',
    'machine': ['x86_64']
}, {
    'arch':
        'linux-arm',
    'file_name':
        'traceconv',
    'file_size':
        6674592,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/linux-arm/traceconv',
    'sha256':
        '5a0bc650e39a289b2051a55ac3e7e2c05cb56f053e2b8dc31bb183e75892be28',
    'platform':
        'linux',
    'machine': ['armv6l', 'armv7l', 'armv8l']
}, {
    'arch':
        'linux-arm64',
    'file_name':
        'traceconv',
    'file_size':
        7554976,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/linux-arm64/traceconv',
    'sha256':
        'f2a3d4c3a7e6af760a4a03fe70e6c32479260bd6487f4b89d49412231c42e197',
    'platform':
        'linux',
    'machine': ['aarch64']
}, {
    'arch':
        'android-arm',
    'file_name':
        'traceconv',
    'file_size':
        5355916,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-arm/traceconv',
    'sha256':
        '58101b41d4930abfebef729d2657252ca6f2c3cff4ebcb838165d606808ff0ad'
}, {
    'arch':
        'android-arm64',
    'file_name':
        'traceconv',
    'file_size':
        6773264,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-arm64/traceconv',
    'sha256':
        'a7fc9fb02e94c92821d36cd0fb90bff75cbe32688e5f2678426b796a5f86ba53'
}, {
    'arch':
        'android-x86',
    'file_name':
        'traceconv',
    'file_size':
        7670116,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-x86/traceconv',
    'sha256':
        '1a64a26516b5a0db710532b4a6f495d4f83153df56b2847093d1b6d17e749b6b'
}, {
    'arch':
        'android-x64',
    'file_name':
        'traceconv',
    'file_size':
        7916104,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-x64/traceconv',
    'sha256':
        '9badc970a3573a038977a7fef59b4d57797ef57e2e4e2d5f23804a0bfcdf1585'
}, {
    'arch':
        'windows-amd64',
    'file_name':
        'traceconv.exe',
    'file_size':
        7217664,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/windows-amd64/traceconv.exe',
    'sha256':
        'd2b9c3ca448c9815c2393716758e85d4d2c8033ce0531b4551703a2b7e3d43a0',
    'platform':
        'win32',
    'machine': ['amd64']
}]

# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/traceconv.py

# ----- Amalgamator: begin of python/perfetto/prebuilts/perfetto_prebuilts.py
# Copyright (C) 2021 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Functions to fetch pre-pinned Perfetto prebuilts.

This function is used in different places:
- Into the //tools/{trace_processor, traceconv} scripts, which are just plain
  wrappers around executables.
- Into the //tools/{heap_profiler, record_android_trace} scripts, which contain
  some other hand-written python code.

The manifest argument looks as follows:
TRACECONV_MANIFEST = [
  {
    'arch': 'mac-amd64',
    'file_name': 'traceconv',
    'file_size': 7087080,
    'url': https://commondatastorage.googleapis.com/.../trace_to_text',
    'sha256': 7d957c005b0dc130f5bd855d6cec27e060d38841b320d04840afc569f9087490',
    'platform': 'darwin',
    'machine': 'x86_64'
  },
  ...
]

The intended usage is:

  from perfetto.prebuilts.manifests.traceconv import TRACECONV_MANIFEST
  bin_path = get_perfetto_prebuilt(TRACECONV_MANIFEST)
  subprocess.call(bin_path, ...)
"""

import hashlib
import os
import platform
import subprocess
import sys


def download_or_get_cached(file_name, url, sha256):
  """ Downloads a prebuilt or returns a cached version

  The first time this is invoked, it downloads the |url| and caches it into
  ~/.local/share/perfetto/prebuilts/$tool_name. On subsequent invocations it
  just runs the cached version.
  """
  dir = os.path.join(
      os.path.expanduser('~'), '.local', 'share', 'perfetto', 'prebuilts')
  os.makedirs(dir, exist_ok=True)
  bin_path = os.path.join(dir, file_name)
  sha256_path = os.path.join(dir, file_name + '.sha256')
  needs_download = True

  # Avoid recomputing the SHA-256 on each invocation. The SHA-256 of the last
  # download is cached into file_name.sha256, just check if that matches.
  if os.path.exists(bin_path) and os.path.exists(sha256_path):
    with open(sha256_path, 'rb') as f:
      digest = f.read().decode()
      if digest == sha256:
        needs_download = False

  if needs_download:
    # Either the filed doesn't exist or the SHA256 doesn't match.
    tmp_path = bin_path + '.tmp'
    print('Downloading ' + url)
    subprocess.check_call(['curl', '-f', '-L', '-#', '-o', tmp_path, url])
    with open(tmp_path, 'rb') as fd:
      actual_sha256 = hashlib.sha256(fd.read()).hexdigest()
    if actual_sha256 != sha256:
      raise Exception('Checksum mismatch for %s (actual: %s, expected: %s)' %
                      (url, actual_sha256, sha256))
    os.chmod(tmp_path, 0o755)
    os.replace(tmp_path, bin_path)
    with open(sha256_path, 'w') as f:
      f.write(sha256)
  return bin_path


def get_perfetto_prebuilt(manifest, soft_fail=False, arch=None):
  """ Downloads the prebuilt, if necessary, and returns its path on disk. """
  plat = sys.platform.lower()
  machine = platform.machine().lower()
  manifest_entry = None
  for entry in manifest:
    # If the caller overrides the arch, just match that (for Android prebuilts).
    if arch:
      if entry.get('arch') == arch:
        manifest_entry = entry
        break
      continue
    # Otherwise guess the local machine arch.
    if entry.get('platform') == plat and machine in entry.get('machine', []):
      manifest_entry = entry
      break
  if manifest_entry is None:
    if soft_fail:
      return None
    raise Exception(
        ('No prebuilts available for %s-%s\n' % (plat, machine)) +
        'See https://perfetto.dev/docs/contributing/build-instructions')

  return download_or_get_cached(
      file_name=manifest_entry['file_name'],
      url=manifest_entry['url'],
      sha256=manifest_entry['sha256'])


def run_perfetto_prebuilt(manifest):
  bin_path = get_perfetto_prebuilt(manifest)
  if sys.platform.lower() == 'win32':
    sys.exit(subprocess.check_call([bin_path, *sys.argv[1:]]))
  os.execv(bin_path, [bin_path] + sys.argv[1:])

# ----- Amalgamator: end of python/perfetto/prebuilts/perfetto_prebuilts.py

if __name__ == '__main__':
  run_perfetto_prebuilt(TRACECONV_MANIFEST)

#EOF
