Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: fix Chromium archiving logic (#9940)

Andrey Lushnikov567e80eef72b
diff --git a/browser_patches/chromium/archive.sh b/browser_patches/chromium/archive.sh
index 30aeaac76a..041990acd1 100755
--- a/browser_patches/chromium/archive.sh
+++ b/browser_patches/chromium/archive.sh
@@ -62,15 +62,15 @@ function archive_compiled_chromium() {
if [[ $1 == "--compile-mac"* ]]; then
CHROMIUM_FOLDER_NAME="chrome-mac"
- CHROMIUM_FILES_TO_ARCHIVE=("Chromium.app")
+ IFS=$'\n' CHROMIUM_FILES_TO_ARCHIVE=($(node "${SCRIPT_PATH}/compute_files_to_archive.js" "${CR_CHECKOUT_PATH}/src/infra/archive_config/mac-archive-rel.json"))
+ unset IFS
elif [[ $1 == "--compile-linux"* ]]; then
CHROMIUM_FOLDER_NAME="chrome-linux"
- # Run python script and convert output to array.
- IFS=$'\n' CHROMIUM_FILES_TO_ARCHIVE=($(python "${SCRIPT_PATH}/compute_files_to_archive.py" 64bit "${CR_CHECKOUT_PATH}/src/chrome/tools/build/linux/FILES.cfg"))
+ IFS=$'\n' CHROMIUM_FILES_TO_ARCHIVE=($(node "${SCRIPT_PATH}/compute_files_to_archive.js" "${CR_CHECKOUT_PATH}/src/infra/archive_config/linux-archive-rel.json"))
unset IFS
elif [[ $1 == "--compile-win64" ]]; then
CHROMIUM_FOLDER_NAME="chrome-win"
- IFS=$'\n\r' CHROMIUM_FILES_TO_ARCHIVE=($(python "${SCRIPT_PATH}/compute_files_to_archive.py" 64bit "${CR_CHECKOUT_PATH}/src/chrome/tools/build/win/FILES.cfg"))
+ IFS=$'\n\r' CHROMIUM_FILES_TO_ARCHIVE=($(node "${SCRIPT_PATH}/compute_files_to_archive.js" "${CR_CHECKOUT_PATH}/src/infra/archive_config/win-archive-rel.json"))
unset IFS
else
echo "ERROR: unknown command, use --help for details"
diff --git a/browser_patches/chromium/compute_files_to_archive.js b/browser_patches/chromium/compute_files_to_archive.js
new file mode 100644
index 0000000000..d660794655
--- /dev/null
+++ b/browser_patches/chromium/compute_files_to_archive.js
@@ -0,0 +1,13 @@
+// This script is supposed to be run with a path to either of the following configs from chromium checkout:
+// - infra/archive_config/mac-archive-rel.json
+// - infra/archive_config/linux-archive-rel.json
+// - infra/archive_config/win-archive-rel.json
+
+const fs = require('fs');
+
+const configs = JSON.parse(fs.readFileSync(process.argv[2], 'utf8')).archive_datas;
+const config = configs.find(config => config.gcs_path.includes('chrome-linux.zip') || config.gcs_path.includes('chrome-win.zip') || config.gcs_path.includes('chrome-mac.zip'));
+for (const file of config.files || [])
+ console.log(file);
+for (const dir of config.dirs || [])
+ console.log(dir);
diff --git a/browser_patches/chromium/compute_files_to_archive.py b/browser_patches/chromium/compute_files_to_archive.py
deleted file mode 100755
index 1cb80cc51d..0000000000
--- a/browser_patches/chromium/compute_files_to_archive.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import json
-
-if len(sys.argv) < 2:
- print("ERROR: expected arch: 32bit or 64bit")
- sys.exit(1)
-
-if str(sys.argv[1]) == "--help" or str(sys.argv[1]) == "-h":
- print("Usage: read_files.py [32bit|64bit] <files.cfg path>")
- sys.exit(1)
-
-if len(sys.argv) < 3:
- print("ERROR: expected FILE.cfg path")
- sys.exit(1)
-
-exclude_list = [
- # Windows exclude list
- "chrome_child.dll",
- "gaia1_0.dll",
- "gcp_setup.exe",
- "icudt.dll",
- "interactive_ui_tests.exe",
- "*.manifest",
- # Linux exclude list
- "session",
-]
-
-target_arch = sys.argv[1]
-file_name = sys.argv[2]
-
-descriptors=[]
-if sys.version_info > (3, 0):
- exec(open(file_name).read())
- descriptors = FILES
-else:
- variables = {}
- execfile(file_name, variables)
- descriptors = variables['FILES']
-
-def filter_descriptors(entry):
- if 'archive' in entry:
- return False
- if not 'buildtype' in entry:
- return False
- if not 'dev' in entry['buildtype']:
- return False
- if ('arch' in entry) and (entry['arch'] != target_arch):
- return False
- if entry['filename'] in exclude_list:
- return False
- return True
-
-for entry in filter(filter_descriptors, descriptors):
- print(entry['filename'])
-