diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-06 17:06:14 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-12-02 09:18:45 +0100 |
commit | 61de0e721f672e854551a8938d2d42ba946398cf (patch) | |
tree | 2a36dfb72417701b093cde8b333a434f8fcacd27 /tools/scripts/take_snapshot.py | |
parent | 5dc3a3fb5e3286a9643fece7c7f94cec7fc29f3e (diff) |
Adaptations for Chromium 94
Change-Id: I9fb8998a3a7762b0aea70993ca231f0bbf4f7761
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'tools/scripts/take_snapshot.py')
-rwxr-xr-x | tools/scripts/take_snapshot.py | 73 |
1 files changed, 45 insertions, 28 deletions
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 8b03076bc..126b88537 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################# ## @@ -32,7 +32,7 @@ import glob import os import subprocess import sys -import imp +import importlib import errno import shutil @@ -80,6 +80,8 @@ def isInChromiumBlacklist(file_path): and not file_path.startswith('chrome/browser/prefs/') and not file_path.startswith('chrome/browser/printing/') and not file_path.startswith('chrome/browser/renderer_host/') + and not file_path.startswith('chrome/browser/share/core/') + and not file_path.startswith('chrome/browser/share/proto/') and not file_path.startswith('chrome/browser/spellchecker') and not file_path.startswith('chrome/browser/tab_contents/') and not file_path.startswith('chrome/browser/ui/webui/') @@ -93,7 +95,8 @@ def isInChromiumBlacklist(file_path): and not file_path.startswith('chrome/tools/convert_dict/') and not file_path.endswith('.grd') and not file_path.endswith('.grdp') - and not file_path.endswith('chrome_version.rc.version')) + and not file_path.endswith('chrome_version.rc.version') + and not file_path.endswith('service_sandbox_type.h')) or file_path.startswith('chrome_elf') or file_path.startswith('chromecast') or file_path.startswith('chromeos') @@ -166,7 +169,10 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/chromite') or file_path.startswith('third_party/colorama') or file_path.startswith('third_party/depot_tools') - or file_path.startswith('third_party/devtools-frontend/src/node-modules/') + or (file_path.startswith('third_party/node/node_modules/') + and not file_path.startswith('third_party/node/node_modules/source-map/') + and not file_path.startswith('third_party/node/node_modules/terser/') + and not file_path.startswith('third_party/node/node_modules/typescript/')) or file_path.startswith('third_party/fuschsia-sdk/') or file_path.startswith('third_party/glslang/src/Test/') or file_path.startswith('third_party/google_') @@ -196,7 +202,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/sfntly/src/java') or file_path.startswith('third_party/skia/docs/') or file_path.startswith('third_party/skia/infra') - or file_path.startswith('third_party/skia/site/dev/tools/calendar.mskp') + or file_path.startswith('third_party/skia/site/docs/dev/tools/calendar.mskp') or file_path.startswith('third_party/sqlite/sqlite-src-') or file_path.startswith('third_party/spirv-cross/spirv-cross/reference/') or file_path.startswith('third_party/swiftshader/third_party/') @@ -279,7 +285,7 @@ def copyFile(src, dst): subprocess.call(['dos2unix', '--keep-bom', '--quiet', dst]) except OSError as exception: if exception.errno == errno.ENOENT: - print 'file does not exist:' + src + print('file does not exist: ' + src) else: raise @@ -289,10 +295,10 @@ third_party = os.path.join(qtwebengine_root, 'src/3rdparty') def clearDirectory(directory): currentDir = os.getcwd() os.chdir(directory) - print 'clearing the directory:' + directory + print('clearing the directory:' + directory) for direntry in os.listdir(directory): if not direntry == '.git' and os.path.isdir(direntry): - print 'clearing:' + direntry + print('clearing:' + direntry) shutil.rmtree(direntry) os.chdir(currentDir) @@ -310,13 +316,13 @@ def exportGn(): third_party_upstream_gn = os.path.join(third_party_upstream, 'gn') third_party_gn = os.path.join(third_party, 'gn') os.makedirs(third_party_gn); - print 'exporting contents of:' + third_party_upstream_gn + print('exporting contents of:' + third_party_upstream_gn) os.chdir(third_party_upstream_gn) files = listFilesInCurrentRepository() - print 'copying files to ' + third_party_gn - for i in xrange(len(files)): + print('copying files to ' + third_party_gn) + for i in range(len(files)): printProgress(i+1, len(files)) - f = files[i] + f = files[i].decode() if not isInGitBlacklist(f): copyFile(f, os.path.join(third_party_gn, f)) print("") @@ -325,13 +331,13 @@ def exportNinja(): third_party_upstream_ninja = os.path.join(third_party_upstream, 'ninja') third_party_ninja = os.path.join(third_party, 'ninja') os.makedirs(third_party_ninja); - print 'exporting contents of:' + third_party_upstream_ninja + print('exporting contents of:' + third_party_upstream_ninja) os.chdir(third_party_upstream_ninja) files = listFilesInCurrentRepository() - print 'copying files to ' + third_party_ninja - for i in xrange(len(files)): + print('copying files to ' + third_party_ninja) + for i in range(len(files)): printProgress(i+1, len(files)) - f = files[i] + f = files[i].decode() if not isInGitBlacklist(f): copyFile(f, os.path.join(third_party_ninja, f)) print("") @@ -340,36 +346,47 @@ def exportChromium(): third_party_upstream_chromium = os.path.join(third_party_upstream, 'chromium') third_party_chromium = os.path.join(third_party, 'chromium') os.makedirs(third_party_chromium); - print 'exporting contents of:' + third_party_upstream_chromium + print('exporting contents of:' + third_party_upstream_chromium) os.chdir(third_party_upstream_chromium) files = listFilesInCurrentRepository(True) # Add LASTCHANGE files which are not tracked by git. - files.append('build/util/LASTCHANGE') - files.append('build/util/LASTCHANGE.committime') - files.append('skia/ext/skia_commit_hash.h') - files.append('gpu/config/gpu_lists_version.h') - print 'copying files to ' + third_party_chromium - for i in xrange(len(files)): + files.append(b'build/util/LASTCHANGE') + files.append(b'build/util/LASTCHANGE.committime') + files.append(b'skia/ext/skia_commit_hash.h') + files.append(b'gpu/config/gpu_lists_version.h') + for root, directories, local_files in os.walk(third_party_upstream_chromium + '/third_party/node/node_modules'): + for name in local_files: + f = os.path.relpath(os.path.join(root, name)) + files.append(f) + + print('copying files to ' + third_party_chromium) + for i in range(len(files)): printProgress(i+1, len(files)) - f = files[i] + if isinstance(files[i], bytes): + f = files[i].decode() + else: + f = files[i] if not isInChromiumBlacklist(f) and not isInGitBlacklist(f): copyFile(f, os.path.join(third_party_chromium, f)) + + # We need to gzip transport_security_state_static.json since it is otherwise too big for our git configuration: + subprocess.call(['gzip', third_party_chromium + '/net/http/transport_security_state_static.json']) print("") commandNotFound = subprocess.call(['which', 'dos2unix']) if not commandNotFound: - dos2unixVersion , err = subprocess.Popen(['dos2unix', '-V', '| true'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + dos2unixVersion, err = subprocess.Popen(['dos2unix', '-V', '| true'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() if not dos2unixVersion: raise Exception("You need dos2unix version 6.0.6 minimum.") - dos2unixVersion = StrictVersion(dos2unixVersion.splitlines()[0].split()[1]) + dos2unixVersion = StrictVersion(dos2unixVersion.splitlines()[0].split()[1].decode()) if commandNotFound or dos2unixVersion < StrictVersion('6.0.6'): raise Exception("You need dos2unix version 6.0.6 minimum.") os.chdir(third_party) ignore_case_setting = subprocess.Popen(['git', 'config', '--get', 'core.ignorecase'], stdout=subprocess.PIPE).communicate()[0] -if 'true' in ignore_case_setting: +if b'true' in ignore_case_setting: raise Exception("Your 3rdparty repository is configured to ignore case. " "A snapshot created with these settings would cause problems on case sensitive file systems.") @@ -379,5 +396,5 @@ exportGn() exportNinja() exportChromium() -print 'done.' +print('done.') |