devops: fix Chromium archiving logic (#9940)

Upstream Chromium changed the way they configure browser bundles;
this patch moves us from relying upon `FILES.cfg` onto
`//infra/archive_config/*` configs.

Fixes #9936
This commit is contained in:
Andrey Lushnikov 2021-11-01 16:49:38 -07:00 коммит произвёл GitHub
Родитель 0221f1a4e0
Коммит 567e80eef7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 17 добавлений и 61 удалений

Просмотреть файл

@ -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"

Просмотреть файл

@ -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);

Просмотреть файл

@ -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'])