From bc72be2e4edb918427f8f421f7c4efaad1ea744f Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Fri, 28 Jul 2023 11:59:28 +0200 Subject: [PATCH] Remove `chromium*` entries from DEPS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we’re using consistently-versioned Chrome for Testing binaries, we no longer need to track Chromium revisions nor download their binaries. Bug: chromium:1465312 Change-Id: I89e2afa8fe5f4735919608f5dbb9ad874aaeb8ca Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4729681 Reviewed-by: Liviu Rau Commit-Queue: Mathias Bynens --- DEPS | 60 --------------------- scripts/deps/download_chromium.py | 90 ------------------------------- 2 files changed, 150 deletions(-) delete mode 100755 scripts/deps/download_chromium.py diff --git a/DEPS b/DEPS index a964189eaf..221ab4325c 100644 --- a/DEPS +++ b/DEPS @@ -42,16 +42,6 @@ vars = { # https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja 'ninja_version': 'version:2@1.11.1.chromium.6', - # Chromium build number for unit tests. It should be regularly updated to - # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE - 'chromium_linux': '1176408', - # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE - 'chromium_win': '1176366', - # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE - 'chromium_mac': '1176398', - # the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/LAST_CHANGE - 'chromium_mac_arm': '1176396', - # Chrome version used for tests. It should be regularly updated to # match the Canary version listed here: # https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json @@ -273,56 +263,6 @@ hooks = [ ], }, - # Pull chromium from common storage - { - 'name': 'download_chromium_win', - 'pattern': '.', - 'condition': 'host_os == "win" and build_with_chromium == False', - 'action': [ 'python3', - 'scripts/deps/download_chromium.py', - 'https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/' + Var('chromium_win') + '/chrome-win.zip', - 'third_party/chromium', - 'chrome-win/chrome.exe', - Var('chromium_win'), - ], - }, - { - 'name': 'download_chromium_mac', - 'pattern': '.', - 'condition': 'host_os == "mac" and build_with_chromium == False and host_cpu != "arm64"', - 'action': [ 'python3', - 'scripts/deps/download_chromium.py', - 'https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/' + Var('chromium_mac') + '/chrome-mac.zip', - 'third_party/chromium', - 'chrome-mac/Chromium.app/Contents', - Var('chromium_mac'), - ], - }, - { - 'name': 'download_chromium_mac', - 'pattern': '.', - 'condition': 'host_os == "mac" and build_with_chromium == False and host_cpu == "arm64"', - 'action': [ 'python3', - 'scripts/deps/download_chromium.py', - 'https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac_Arm/' + Var('chromium_mac_arm') + '/chrome-mac.zip', - 'third_party/chromium', - 'chrome-mac/Chromium.app/Contents', - Var('chromium_mac_arm'), - ], - }, - { - 'name': 'download_chromium_linux', - 'pattern': '.', - 'condition': 'host_os == "linux" and build_with_chromium == False', - 'action': [ 'python3', - 'scripts/deps/download_chromium.py', - 'https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/' + Var('chromium_linux') + '/chrome-linux.zip', - 'third_party/chromium', - 'chrome-linux/chrome', - Var('chromium_linux'), - ], - }, - # Pull Chrome binaries from CfT buckets. { 'name': 'download_chrome_win', diff --git a/scripts/deps/download_chromium.py b/scripts/deps/download_chromium.py deleted file mode 100755 index d9294c9c68..0000000000 --- a/scripts/deps/download_chromium.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2019 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -""" -Used to download a pre-built version of Chrome for running unit tests -""" - -import argparse -import io -import os -import shutil -import stat -import subprocess -import sys -import urllib.request -import zipfile - - -def parse_options(cli_args): - parser = argparse.ArgumentParser(description='Download Chromium') - parser.add_argument('url', help='download URL') - parser.add_argument('target', help='target directory') - parser.add_argument('path_to_binary', help='path to binary inside of the zip archive') - parser.add_argument('build_number', help='build number to find out whether we need to re-download') - return parser.parse_args(cli_args) - - -def handleAccessDeniedOnWindows(func, path, exc): - if not os.name == 'nt': - raise exc - if not os.access(path, os.W_OK): - # Is the error an access error? - print("Retrying due to access error...") - os.chmod(path, stat.S_IWUSR) - func(path) - else: - raise exc - -def download_and_extract(options): - BUILD_NUMBER_FILE = os.path.join(options.target, 'build_number') - EXPECTED_BINARY = os.path.join(options.target, options.path_to_binary) - # Check whether we already downloaded pre-built Chromium of right build number - if os.path.exists(BUILD_NUMBER_FILE): - with open(BUILD_NUMBER_FILE) as file: - build_number = file.read().strip() - if build_number == options.build_number: - assert os.path.exists(EXPECTED_BINARY) - return - - # Remove previous download - if os.path.exists(options.target): - shutil.rmtree(options.target, ignore_errors=False, onerror=handleAccessDeniedOnWindows) - - try: - # Download again and save build number - try: - filehandle, headers = urllib.request.urlretrieve(options.url) - except: - print( - "Using curl as fallback. You should probably update OpenSSL.") - filehandle = io.BytesIO( - subprocess.check_output( - ['curl', '--output', '-', '-sS', options.url])) - zip_file = zipfile.ZipFile(filehandle, 'r') - zip_file.extractall(path=options.target) - - finally: - urllib.request.urlcleanup() - - # Fix permissions. Do this recursively is necessary for MacOS bundles. - if os.path.isfile(EXPECTED_BINARY): - os.chmod(EXPECTED_BINARY, 0o555) - # On linux, the crashpad_handler binary needs the +x bit, too. - crashpad = os.path.join(os.path.dirname(EXPECTED_BINARY), - 'chrome_crashpad_handler') - if os.path.isfile(crashpad): - os.chmod(crashpad, 0o555) - else: - for root, dirs, files in os.walk(EXPECTED_BINARY): - for f in files: - os.chmod(os.path.join(root, f), 0o555) - with open(BUILD_NUMBER_FILE, 'w') as file: - file.write(options.build_number) - - -if __name__ == '__main__': - OPTIONS = parse_options(sys.argv[1:]) - download_and_extract(OPTIONS)