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

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


# ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/tracebox.py
# This file has been generated by: tools/roll-prebuilts v44.0
TRACEBOX_MANIFEST = [{
    'arch':
        'mac-amd64',
    'file_name':
        'tracebox',
    'file_size':
        1548256,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/mac-amd64/tracebox',
    'sha256':
        '392cb1ae5f11c6a87d15e69fb6576e5c62ae3b1d87a43d68d7fe8bd3cea4fd7e',
    'platform':
        'darwin',
    'machine': ['x86_64']
}, {
    'arch':
        'mac-arm64',
    'file_name':
        'tracebox',
    'file_size':
        1459096,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/mac-arm64/tracebox',
    'sha256':
        '0edde5e3d35ef044848eeca5f63da7fa9f96e4bb3cac5e87ba4e2772a09e8f8f',
    'platform':
        'darwin',
    'machine': ['arm64']
}, {
    'arch':
        'linux-amd64',
    'file_name':
        'tracebox',
    'file_size':
        2304304,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/linux-amd64/tracebox',
    'sha256':
        'cd2b3c0fdc7d0a649bbe4103901263927b2f736836ce56fa06467efa5c825472',
    'platform':
        'linux',
    'machine': ['x86_64']
}, {
    'arch':
        'linux-arm',
    'file_name':
        'tracebox',
    'file_size':
        1408648,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/linux-arm/tracebox',
    'sha256':
        '51794d99493c04ced26a40a242ddb6a53b1213ee96b0b1af9ba874715656ff06',
    'platform':
        'linux',
    'machine': ['armv6l', 'armv7l', 'armv8l']
}, {
    'arch':
        'linux-arm64',
    'file_name':
        'tracebox',
    'file_size':
        2212000,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/linux-arm64/tracebox',
    'sha256':
        '7faf03feecf045ed25bfad7cb845621c533ca50b586e722e1bb61aa7fd54cd74',
    'platform':
        'linux',
    'machine': ['aarch64']
}, {
    'arch':
        'android-arm',
    'file_name':
        'tracebox',
    'file_size':
        1299200,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-arm/tracebox',
    'sha256':
        'fa78644befc527481dac76b217762cbddb9233cc050c2a31444c78391ed7715c'
}, {
    'arch':
        'android-arm64',
    'file_name':
        'tracebox',
    'file_size':
        2067768,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-arm64/tracebox',
    'sha256':
        'f3167ce57aec78e200675640a683a938bcb206219346427e42f86fdc70923386'
}, {
    'arch':
        'android-x86',
    'file_name':
        'tracebox',
    'file_size':
        2241784,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-x86/tracebox',
    'sha256':
        '9c9a4b1c498c985c3fbbd9122a9df66bb5275c715c54475d7fbabfec5722d50a'
}, {
    'arch':
        'android-x64',
    'file_name':
        'tracebox',
    'file_size':
        2092696,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-x64/tracebox',
    'sha256':
        '96fdc7b584247a2f4fc18d4a4a8e8891ab88693c8bc7a301e8dffb3ec8b96a1d'
}]

# ----- Amalgamator: end of python/perfetto/prebuilts/manifests/tracebox.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
import threading

DOWNLOAD_LOCK = threading.Lock()


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

  try:
    # In BatchTraceProcessor, many threads can be trying to execute the below
    # code in parallel. For this reason, protect the whole operation with a
    # lock.
    DOWNLOAD_LOCK.acquire()

    # 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)
  finally:
    DOWNLOAD_LOCK.release()
  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(TRACEBOX_MANIFEST)

#EOF
