#!/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:
# ./trace_processor
# python trace_processor
# bash trace_processor
# cat ./trace_processor | bash
# cat ./trace_processor | python -

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


# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/trace_processor_shell.py
# This file has been generated by: tools/roll-prebuilts v32.1
TRACE_PROCESSOR_SHELL_MANIFEST = [{
    'arch':
        'mac-amd64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8566376,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/mac-amd64/trace_processor_shell',
    'sha256':
        'e918db13f3068de751bacd15fb8b3ff920cc6290508512e820186eed0150731b',
    'platform':
        'darwin',
    'machine': ['x86_64']
}, {
    'arch':
        'mac-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        7286792,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/mac-arm64/trace_processor_shell',
    'sha256':
        'e98902c678b642773e867b9308e041ef9c37d07199077c4903e586ddb3ac6b7c',
    'platform':
        'darwin',
    'machine': ['arm64']
}, {
    'arch':
        'linux-amd64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8976816,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/linux-amd64/trace_processor_shell',
    'sha256':
        'da6a99374f04cc10fd19dd5247a5d6ea9a0e6572a12b6f77de5c64827bc7c98c',
    'platform':
        'linux',
    'machine': ['x86_64']
}, {
    'arch':
        'linux-arm',
    'file_name':
        'trace_processor_shell',
    'file_size':
        7109580,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/linux-arm/trace_processor_shell',
    'sha256':
        'd996276bb125c2d95b677e0c3326f8822947f9d2bedcdfec82581da36c50fa90',
    'platform':
        'linux',
    'machine': ['armv6l', 'armv7l', 'armv8l']
}, {
    'arch':
        'linux-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8395080,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/linux-arm64/trace_processor_shell',
    'sha256':
        'cd9d4dec964223549eb3e6580e1d4f72aa0dd8467ad0da22fcdf8b6c6b39ff34',
    'platform':
        'linux',
    'machine': ['aarch64']
}, {
    'arch':
        'android-arm',
    'file_name':
        'trace_processor_shell',
    'file_size':
        5807400,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-arm/trace_processor_shell',
    'sha256':
        'a691c3b8c4f62dc73bd9e0538e812abe6b340b0ab7c8516d3395d7d726725305'
}, {
    'arch':
        'android-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        7471024,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-arm64/trace_processor_shell',
    'sha256':
        'a2269b32897bc7c16426b0af6f213994b67df439386b5acd19fe67da56e574ad'
}, {
    'arch':
        'android-x86',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8400124,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-x86/trace_processor_shell',
    'sha256':
        'd4d999cd23b3fb3d288227bbb6c42ebed9ea664efda65c03bf1b3d527126517e'
}, {
    'arch':
        'android-x64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8757232,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/android-x64/trace_processor_shell',
    'sha256':
        '5ac30fa1e290a5d6a5f1ae648d0d2e42ebc4abd6be3594a9f8aa843841e26593'
}, {
    'arch':
        'windows-amd64',
    'file_name':
        'trace_processor_shell.exe',
    'file_size':
        8189952,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v32.1/windows-amd64/trace_processor_shell.exe',
    'sha256':
        'f11b220447ecf9a7b6f4394443c915f1dea92a2316b3c35da823e6e42dfacd9d',
    'platform':
        'win32',
    'machine': ['amd64']
}]

# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/trace_processor_shell.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(TRACE_PROCESSOR_SHELL_MANIFEST)

#EOF
