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 | |
parent | 5dc3a3fb5e3286a9643fece7c7f94cec7fc29f3e (diff) | |
download | qtwebengine-61de0e721f672e854551a8938d2d42ba946398cf.tar.gz |
Adaptations for Chromium 94
Change-Id: I9fb8998a3a7762b0aea70993ca231f0bbf4f7761
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'tools/scripts')
-rw-r--r-- | tools/scripts/git_submodule.py | 28 | ||||
-rwxr-xr-x | tools/scripts/init-repository.py | 11 | ||||
-rwxr-xr-x | tools/scripts/take_snapshot.py | 73 | ||||
-rw-r--r-- | tools/scripts/version_resolver.py | 8 |
4 files changed, 69 insertions, 51 deletions
diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index 43a652b11..350da8a03 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -36,12 +36,12 @@ import version_resolver as resolver extra_os = ['mac', 'win'] def subprocessCall(args): - print args + print(args) return subprocess.call(args) def subprocessCheckOutput(args): - print args - return subprocess.check_output(args) + print(args) + return subprocess.check_output(args).decode() class DEPSParser: def __init__(self): @@ -96,7 +96,7 @@ class DEPSParser: submodule.os = os if not submodule.matchesOS(): - print '-- skipping ' + submodule.pathRelativeToTopMostSupermodule() + ' for this operating system. --' + print('-- skipping ' + submodule.pathRelativeToTopMostSupermodule() + ' for this operating system. --') continue if len(rev) == 40: # Length of a git shasum @@ -201,7 +201,7 @@ class Submodule: def findGitDir(self): try: return subprocessCheckOutput(['git', 'rev-parse', '--git-dir']).strip() - except subprocess.CalledProcessError, e: + except subprocess.CalledProcessError as e: sys.exit("git dir could not be determined! - Initialization failed! " + e.output) def reset(self): @@ -210,27 +210,27 @@ class Submodule: gitdir = self.findGitDir() if os.path.isdir(os.path.join(gitdir, 'rebase-merge')): if os.path.isfile(os.path.join(gitdir, 'MERGE_HEAD')): - print 'merge in progress... aborting merge.' + print('merge in progress... aborting merge.') subprocessCall(['git', 'merge', '--abort']) else: - print 'rebase in progress... aborting merge.' + print('rebase in progress... aborting merge.') subprocessCall(['git', 'rebase', '--abort']) if os.path.isdir(os.path.join(gitdir, 'rebase-apply')): - print 'am in progress... aborting am.' + print('am in progress... aborting am.') subprocessCall(['git', 'am', '--abort']) subprocessCall(['git', 'reset', '--hard']) os.chdir(currentDir) def initialize(self): if self.matchesOS(): - print '\n\n-- initializing ' + self.pathRelativeToTopMostSupermodule() + ' --' + print('\n\n-- initializing ' + self.pathRelativeToTopMostSupermodule() + ' --') oldCwd = os.getcwd() # The submodule operations should be done relative to the current submodule's # supermodule. if self.topmost_supermodule_path_prefix: if not os.path.isdir(self.path): - print '-- creating ' + self.path + ' as dir is missing. --' + print('-- creating ' + self.path + ' as dir is missing. --') os.makedirs(self.path) os.chdir(self.topmost_supermodule_path_prefix) @@ -254,7 +254,7 @@ class Submodule: os.chdir(oldCwd) else: - print '-- skipping ' + self.path + ' for this operating system. --' + print('-- skipping ' + self.path + ' for this operating system. --') def listFiles(self): if self.matchesOS() and os.path.isdir(self.pathRelativeToTopMostSupermodule()): @@ -264,7 +264,7 @@ class Submodule: os.chdir(currentDir) return files else: - print '-- skipping ' + self.path + ' for this operating system. --' + print('-- skipping ' + self.path + ' for this operating system. --') return [] def parseGitModulesFileContents(self, gitmodules_lines): @@ -320,9 +320,9 @@ class Submodule: submodules = [] if use_deps: submodules = resolver.readSubmodules() - print 'DEPS file provides the following submodules:' + print('DEPS file provides the following submodules:') for submodule in submodules: - print '{:<80}'.format(submodule.pathRelativeToTopMostSupermodule()) + '{:<120}'.format(submodule.url) + submodule.ref + print('{:<80}'.format(submodule.pathRelativeToTopMostSupermodule()) + '{:<120}'.format(submodule.url) + submodule.ref) else: # Try .gitmodules instead gitmodules_file_name = '.gitmodules' submodules = self.readSubmodulesFromGitModules(self, gitmodules_file_name, self.path) diff --git a/tools/scripts/init-repository.py b/tools/scripts/init-repository.py index 221f74a65..6209b4866 100755 --- a/tools/scripts/init-repository.py +++ b/tools/scripts/init-repository.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################# ## @@ -66,7 +66,7 @@ if not chromium_src or not os.path.isdir(chromium_src): ninja_src = os.path.join(qtwebengine_root, 'src/3rdparty/ninja') gn_src = os.path.join(qtwebengine_root, 'src/3rdparty/gn') args.snapshot = True - print 'CHROMIUM_SRC_DIR not set, using Chromium in' + chromium_src + print('CHROMIUM_SRC_DIR not set, using Chromium in' + chromium_src) if not args.baseline_upstream: # Write our chromium sources directory into git config. @@ -79,7 +79,7 @@ def updateLastChange(): return currentDir = os.getcwd() os.chdir(chromium_src) - print 'updating LASTCHANGE files' + print('updating LASTCHANGE files') subprocess.call(['python', 'build/util/lastchange.py', '-o', 'build/util/LASTCHANGE']) subprocess.call(['python', 'build/util/lastchange.py', '-m', 'SKIA_COMMIT_HASH', '-s', 'third_party/skia', '--header', 'skia/ext/skia_commit_hash.h']) subprocess.call(['python', 'build/util/lastchange.py', '-m', 'GPU_LISTS_VERSION', '--revision-id-only', '--header', 'gpu/config/gpu_lists_version.h']) @@ -93,7 +93,7 @@ def initUpstreamSubmodules(): chromium_ref = 'refs/tags/' + resolver.currentVersion() os.chdir(qtwebengine_root) - current_submodules = subprocess.check_output(['git', 'submodule']) + current_submodules = subprocess.check_output(['git', 'submodule']).decode() if not 'src/3rdparty_upstream/gn' in current_submodules: subprocess.call(['git', 'submodule', 'add', gn_url, 'src/3rdparty_upstream/gn']) if not 'src/3rdparty_upstream/ninja' in current_submodules: @@ -123,6 +123,7 @@ def initUpstreamSubmodules(): chromiumSubmodule.os = 'all' chromiumSubmodule.initialize() chromiumSubmodule.initSubmodules() + subprocess.call(['src/3rdparty_upstream/chromium/third_party/node/update_npm_deps']) # Unstage repositories so we do not accidentally commit them. subprocess.call(['git', 'reset', '-q', 'HEAD', 'src/3rdparty_upstream/gn']) @@ -141,6 +142,6 @@ if args.upstream: initUpstreamSubmodules() updateLastChange() if not args.baseline_upstream and not use_external_chromium: - subprocess.call(['python', os.path.join(qtwebengine_root, 'tools', 'scripts', 'patch_upstream.py')]) + subprocess.call(['python3', os.path.join(qtwebengine_root, 'tools', 'scripts', 'patch_upstream.py')]) if args.snapshot: initSnapshot() 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.') diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index d339b72dd..986e6d3a3 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -35,11 +35,11 @@ import shutil import subprocess import sys import json -import urllib2 +import urllib3 import git_submodule as GitSubmodule -chromium_version = '90.0.4430.228' -chromium_branch = '4430' +chromium_version = '94.0.4606.126' +chromium_branch = '4606' ninja_version = 'v1.8.2' json_url = 'http://omahaproxy.appspot.com/all.json' @@ -171,7 +171,7 @@ def resetUpstream(): chromium = GitSubmodule.Submodule() chromium.path = "." - submodules = chromium.readSubmodules() + submodules = chromium.readSubmodules(True) submodules.append(chromium) print('-- resetting upstream submodules in ' + os.path.relpath(target_dir) + ' to baseline --') |