#!/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 v44.0
TRACE_PROCESSOR_SHELL_MANIFEST = [{
    'arch':
        'mac-amd64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8879352,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/mac-amd64/trace_processor_shell',
    'sha256':
        '8ac591150919d5e3701a3fdb7ce44f2ae9b48a4b27afc2da31b97dba3238c4c8',
    'platform':
        'darwin',
    'machine': ['x86_64']
}, {
    'arch':
        'mac-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8261544,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/mac-arm64/trace_processor_shell',
    'sha256':
        '55ef799a383fb460e0167fad68b8f169d6d46bc10285df9db26cecec52dd24f1',
    'platform':
        'darwin',
    'machine': ['arm64']
}, {
    'arch':
        'linux-amd64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        9035064,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/linux-amd64/trace_processor_shell',
    'sha256':
        'd4826f1c2acf0a4caaa167bc089d12a1e6460fcd2847ec8c026933ed73d30540',
    'platform':
        'linux',
    'machine': ['x86_64']
}, {
    'arch':
        'linux-arm',
    'file_name':
        'trace_processor_shell',
    'file_size':
        6581588,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/linux-arm/trace_processor_shell',
    'sha256':
        '1918aa71521e3daaeedadd9a0760f597c94c3baa803836e442f54c584dc402ac',
    'platform':
        'linux',
    'machine': ['armv6l', 'armv7l', 'armv8l']
}, {
    'arch':
        'linux-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8698104,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/linux-arm64/trace_processor_shell',
    'sha256':
        '9b4e77e541bf397bcdb4f51b30b0cea23aea761865c5bebdac424b15beecdf18',
    'platform':
        'linux',
    'machine': ['aarch64']
}, {
    'arch':
        'android-arm',
    'file_name':
        'trace_processor_shell',
    'file_size':
        6581420,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-arm/trace_processor_shell',
    'sha256':
        'cdf7d4f0ad38f977f20d52c2d881f5aeac3ad1a9b07032dee32b08ee631ad041'
}, {
    'arch':
        'android-arm64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8592256,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-arm64/trace_processor_shell',
    'sha256':
        '8df9e4e01509184fe5d65f79af343384f8e11f90eabebe8075cf779d6d82304d'
}, {
    'arch':
        'android-x86',
    'file_name':
        'trace_processor_shell',
    'file_size':
        9457000,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-x86/trace_processor_shell',
    'sha256':
        'd0404998a661864dfabb440a1227ded43c6e793741675576c863460ce869bead'
}, {
    'arch':
        'android-x64',
    'file_name':
        'trace_processor_shell',
    'file_size':
        8848144,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/android-x64/trace_processor_shell',
    'sha256':
        '8e5a539457f8a50b898a2f2178acd14d7f4076a6a10bbc030a7c2a8cb229b57f'
}, {
    'arch':
        'windows-amd64',
    'file_name':
        'trace_processor_shell.exe',
    'file_size':
        8951296,
    'url':
        'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v44.0/windows-amd64/trace_processor_shell.exe',
    'sha256':
        'd01a7d0c3bd460a041fdd25cba88163d945ef939f48de3c76cdc554e19321419',
    '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
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(TRACE_PROCESSOR_SHELL_MANIFEST)

#EOF
