diff options
Diffstat (limited to 'tools/scripts/take_snapshot.py')
-rwxr-xr-x | tools/scripts/take_snapshot.py | 76 |
1 files changed, 52 insertions, 24 deletions
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 8769d096d..70ce7e5bf 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -12,6 +12,7 @@ import shutil from distutils.version import StrictVersion import git_submodule as GitSubmodule +import cipd_package as CIPDPackage qtwebengine_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) os.chdir(qtwebengine_root) @@ -32,10 +33,14 @@ def isInChromiumBlacklist(file_path): if file_path.endswith('.gn') or file_path.endswith('.gni') or file_path.endswith('.typemap') or \ file_path.endswith('.mojom'): return False + # Add android dependencies info so gn build tree can be parsed + if file_path.endswith('.info') or file_path.endswith('.pydeps'): + return False + if file_path.endswith('.mailmap') or file_path.endswith('.tat.gz.sha1'): + return True if (file_path.startswith('android_webview') or file_path.startswith('apps/') or file_path.startswith('ash/') - or file_path.startswith('base/android') or file_path.startswith('buildtools/clang_format/script') or file_path.startswith('buildtools/third_party/libc++') or file_path.startswith('buildtools/third_party/libc++abi') @@ -72,6 +77,7 @@ def isInChromiumBlacklist(file_path): and not (file_path.startswith('chrome/common/') and not file_path.startswith('chrome/common/extensions/docs')) and not file_path.startswith('chrome/renderer/') + and not file_path.startswith('chrome/test/chromedriver/') and not file_path.startswith('chrome/tools/convert_dict/') and not file_path.endswith('.grd') and not file_path.endswith('.grdp') @@ -112,7 +118,10 @@ def isInChromiumBlacklist(file_path): or (file_path.startswith('net/data/') and '_unittest/' in file_path) or file_path.startswith('net/data/fuzzer_data/') - or file_path.startswith('remoting') + or (file_path.startswith('remoting') + and not file_path.endswith('VERSION') + and not file_path.endswith('branding_Chromium') + and not file_path.endswith('remove_spaces.py')) or file_path.startswith('rlz') or file_path.startswith('testing/android') or file_path.startswith('testing/buildbot') @@ -121,6 +130,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/accessibility') or file_path.startswith('third_party/afl') or file_path.startswith('third_party/android_') + or file_path.startswith('third_party/androidx') or file_path.startswith('third_party/angle/third_party/deqp') or file_path.startswith('third_party/angle/third_party/glmark2') or file_path.startswith('third_party/angle/third_party/VK-GL-CTS') @@ -148,6 +158,7 @@ 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/third_party/image_diff') or (file_path.startswith('third_party/node/node_modules/') and not file_path.startswith('third_party/node/node_modules/@babel/') and not file_path.startswith('third_party/node/node_modules/@types/d3') @@ -173,9 +184,14 @@ def isInChromiumBlacklist(file_path): and not file_path.startswith('third_party/node/node_modules/indent/') and not file_path.startswith('third_party/node/node_modules/is-core-module/') and not file_path.startswith('third_party/node/node_modules/is-windows/') + and not file_path.startswith('third_party/node/node_modules/@jridgewell/') and not file_path.startswith('third_party/node/node_modules/js-tokens/') and not file_path.startswith('third_party/node/node_modules/jsesc/') and not file_path.startswith('third_party/node/node_modules/jsonschema/') + and not file_path.startswith('third_party/node/node_modules/@lit/reactive-element/') + and not file_path.startswith('third_party/node/node_modules/lit-element/') + and not file_path.startswith('third_party/node/node_modules/lit-html/') + and not file_path.startswith('third_party/node/node_modules/lit/') and not file_path.startswith('third_party/node/node_modules/lodash.camelcase/') and not file_path.startswith('third_party/node/node_modules/lodash.sortby/') and not file_path.startswith('third_party/node/node_modules/minimatch/') @@ -201,7 +217,6 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/google_') or file_path.startswith('third_party/grpc/') or file_path.startswith('third_party/hunspell_dictionaries') - or file_path.startswith('third_party/icu/android') or file_path.startswith('third_party/icu/cast') or file_path.startswith('third_party/icu/chromeos') or file_path.startswith('third_party/instrumented_libraries') @@ -213,6 +228,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/libFuzzer') or file_path.startswith('third_party/liblouis') or file_path.startswith('third_party/libphonenumber') + or file_path.startswith('third_party/libunwindstack') or file_path.startswith('third_party/logilab') or file_path.startswith('third_party/markdown') or file_path.startswith('third_party/openh264/src/res') @@ -259,6 +275,7 @@ def isInChromiumBlacklist(file_path): or '/fuzzer/' in file_path or '/fuzzers/' in file_path or '/fuzzing/' in file_path + and not file_path.endswith('internals_fuzzing.idl') )) or ('/test' in file_path and ('/testdata/' in file_path @@ -266,6 +283,7 @@ def isInChromiumBlacklist(file_path): or ('/test/' in file_path and not '/webrtc/' in file_path and not file_path.startswith('net/test/') + and not file_path.startswith('chrome/test/chromedriver/') and not file_path.endswith('test_hook.h') and not file_path.endswith('perftimer.h') and not file_path.endswith('test-torque.tq') @@ -292,7 +310,7 @@ def printProgress(current, total): sys.stdout.write("\r{} of {}".format(current, total)) sys.stdout.flush() -def copyFile(src, dst): +def copyFile(src, dst, use_link = True, force_remove = False): src = os.path.abspath(src) dst = os.path.abspath(dst) dst_dir = os.path.dirname(dst) @@ -300,11 +318,14 @@ def copyFile(src, dst): if not os.path.isdir(dst_dir): os.makedirs(dst_dir) - if os.path.exists(dst): + if force_remove or os.path.exists(dst): os.remove(dst) try: - os.link(src, dst) + if use_link: + os.link(src, dst) + else: + shutil.copy(src,dst) # Qt uses LF-only but Chromium isn't. subprocess.call(['dos2unix', '--keep-bom', '--quiet', dst]) except OSError as exception: @@ -336,6 +357,16 @@ def listFilesInCurrentRepository(use_deps=False): files.append(os.path.join(submodule.pathRelativeToTopMostSupermodule(), submodule_file)) return files +def listPackageFilesInCurrentRepositoryForPackage(packageName): + cipd = CIPDPackage.CIPDEntity(os.getcwd()) + cipd_entities = cipd.readEntities() + files = [] + for e in cipd_entities: + pkg = e.findPackage(CIPDPackage.androidx_package_name) + if pkg: + files.extend(pkg.listFiles()) + return files + def exportGn(): third_party_upstream_gn = os.path.join(third_party_upstream, 'gn') third_party_gn = os.path.join(third_party, 'gn') @@ -351,21 +382,6 @@ def exportGn(): copyFile(f, os.path.join(third_party_gn, f)) print("") -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) - os.chdir(third_party_upstream_ninja) - files = listFilesInCurrentRepository() - print('copying files to ' + third_party_ninja) - for i in range(len(files)): - printProgress(i+1, len(files)) - f = files[i].decode() - if not isInGitBlacklist(f): - copyFile(f, os.path.join(third_party_ninja, f)) - print("") - def exportChromium(): third_party_upstream_chromium = os.path.join(third_party_upstream, 'chromium') third_party_chromium = os.path.join(third_party, 'chromium') @@ -378,11 +394,15 @@ def exportChromium(): 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') + + files.extend(listPackageFilesInCurrentRepositoryForPackage(CIPDPackage.androidx_package_name)) + 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) + symlinks = [] print('copying files to ' + third_party_chromium) for i in range(len(files)): printProgress(i+1, len(files)) @@ -391,10 +411,19 @@ def exportChromium(): else: f = files[i] if not isInChromiumBlacklist(f) and not isInGitBlacklist(f): - copyFile(f, os.path.join(third_party_chromium, f)) + d = os.path.join(third_party_chromium, f) + copyFile(f,d) + # make sure we did not make a hardlink of symlink which is broken afterwards + if os.path.islink(f): + symlinks.append((f,d)) + # this is mostly used for files coming from cipd packages + for s in symlinks: + if not os.path.exists(s[1]): + print('fixing ivalid link ' + s[1]) + copyFile(s[0],s[1], use_link = False, force_remove = True) # 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']) + subprocess.call(['gzip', '-n', third_party_chromium + '/net/http/transport_security_state_static.json']) print("") commandNotFound = subprocess.call(['which', 'dos2unix']) @@ -417,7 +446,6 @@ if b'true' in ignore_case_setting: clearDirectory(third_party) exportGn() -exportNinja() exportChromium() print('done.') |