#!/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 v41.0
TRACE_PROCESSOR_SHELL_MANIFEST = [{
    'arch':
        'mac-amd64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        10175112,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/mac-amd64/trace_processor_shell',
    'sha256':
        '62b14997b0c21755b80e82de03b487615a4abc9a99702acd9382b5bdd67ce28f',
    'platform':
        'darwin',
    'machine': ['x86_64']
}, {
    'arch':
        'mac-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8692328,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/mac-arm64/trace_processor_shell',
    'sha256':
        '04e37680992b6b52ad3abdae34792858e70bf7a5523b2b2d9e76248b5bc6cbe4',
    'platform':
        'darwin',
    'machine': ['arm64']
}, {
    'arch':
        'linux-amd64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        10025552,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/linux-amd64/trace_processor_shell',
    'sha256':
        '3ffce07c28144eb9da315b548b14f6304e7bd62fca485b4c4a625b80489ba2de',
    'platform':
        'linux',
    'machine': ['x86_64']
}, {
    'arch':
        'linux-arm',
    'file_name':
        'trace_processor_shell',
    'file_size':
        7417332,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/linux-arm/trace_processor_shell',
    'sha256':
        '767056bd8f1d7415552d1ca109918d35fb457673bf754b9641149a9b9980ba35',
    'platform':
        'linux',
    'machine': ['armv6l', 'armv7l', 'armv8l']
}, {
    'arch':
        'linux-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        9434600,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/linux-arm64/trace_processor_shell',
    'sha256':
        'b17cfb3e78a1aa2c8b83e60d5f716bbf23c8d613053b268a3489295218006540',
    'platform':
        'linux',
    'machine': ['aarch64']
}, {
    'arch':
        'android-arm',
    'file_name':
        'trace_processor_shell',
    'file_size':
        7051720,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/android-arm/trace_processor_shell',
    'sha256':
        '1f62f0957208d7043d4eba5f1acadb57c14542790a95b6be46db12f63434ad02'
}, {
    'arch':
        'android-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8612232,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/android-arm64/trace_processor_shell',
    'sha256':
        '132cea4fe3208ae4c4b8d1aadc95c1d5f1dddd3ec77f64aa1d7c9230e9d6259f'
}, {
    'arch':
        'android-x86',
    'file_name':
        'trace_processor_shell',
    'file_size':
        9525644,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/android-x86/trace_processor_shell',
    'sha256':
        '4cbea3a6e9158d4ac0a68040755520511143254653ab1ed553ab0b4e0b16c30b'
}, {
    'arch':
        'android-x64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        9775560,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/android-x64/trace_processor_shell',
    'sha256':
        '469467f9f7d4f521d48f3938d0ec8b964b7552c4747b94aed1dd9c7e40ba82a7'
}, {
    'arch':
        'windows-amd64',
    'file_name':
        'trace_processor_shell.exe',
    'file_size':
        9444864,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v41.0/windows-amd64/trace_processor_shell.exe',
    'sha256':
        '695174fd2791096db233e52673bffa2c5cb92275d191e760ab5d9fe33261da6e',
    '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
