diff options
author | kmarshall <kmarshall@chromium.org> | 2016-02-23 18:49:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-24 02:51:26 +0000 |
commit | e9ccb88ea8b020919b266061a7b283d3ce789a64 (patch) | |
tree | 7e7718362a1f660e9793f8c365e984849247f68e /blimp | |
parent | 7e9fd7734fc93011d9058d90646b02345424e252 (diff) | |
download | chromium_src-e9ccb88ea8b020919b266061a7b283d3ce789a64.zip chromium_src-e9ccb88ea8b020919b266061a7b283d3ce789a64.tar.gz chromium_src-e9ccb88ea8b020919b266061a7b283d3ce789a64.tar.bz2 |
Add pattern-based blacklists to Docker manifest generator.
This change allows us to automatically prune lines from the output with glob-based blacklisting rules.
Previously, the generator script would emit manifest entries for all possible dependencies of an executable, regardless of whether or not the dependencies would be needed at execution time.
R=marcinjb@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1685943003
Cr-Commit-Position: refs/heads/master@{#377197}
Diffstat (limited to 'blimp')
-rw-r--r-- | blimp/engine/engine-manifest.txt | 7 | ||||
-rwxr-xr-x | blimp/tools/generate-engine-manifest.py | 22 | ||||
-rw-r--r-- | blimp/tools/manifest-blacklist.txt | 14 |
3 files changed, 37 insertions, 6 deletions
diff --git a/blimp/engine/engine-manifest.txt b/blimp/engine/engine-manifest.txt index 9b78601..d84b8f9 100644 --- a/blimp/engine/engine-manifest.txt +++ b/blimp/engine/engine-manifest.txt @@ -1,11 +1,12 @@ # Runtime dependencies for the Blimp Engine # # This file was generated by running: -# generate-engine-manifest.py --build-dir out-linux/Debug --target //blimp/engine:blimp_engine --output blimp/engine/engine-manifest.txt +# generate-engine-manifest.py --build-dir out/Linux --target //blimp/engine:blimp_engine --output blimp/engine/engine-manifest.txt # -# Note: After generating, you should remove any unnecessary dependencies. +# Note: Any unnecessary dependencies should be added to +# manifest-blacklist.txt and this file should be regenerated. ./blimp_engine_app icudtl.dat natives_blob.bin blimp_engine.pak -./chrome_sandbox +./chrome_sandbox
\ No newline at end of file diff --git a/blimp/tools/generate-engine-manifest.py b/blimp/tools/generate-engine-manifest.py index 0c5c90c..f8e70bb 100755 --- a/blimp/tools/generate-engine-manifest.py +++ b/blimp/tools/generate-engine-manifest.py @@ -9,11 +9,17 @@ import argparse import errno +import fnmatch import os import subprocess import sys import tarfile +# Returns True if |entry| matches any of the patterns in |blacklist|. +def IsBlacklisted(entry, blacklist): + return any([next_pat for next_pat in blacklist + if fnmatch.fnmatch(entry, next_pat)]) + def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--build-dir', @@ -31,7 +37,7 @@ def main(): try: deps = subprocess.check_output(['gn', 'desc', args.build_dir, args.target, - 'runtime_deps']) + 'runtime_deps']).split() except subprocess.CalledProcessError as e: print "Error: " + ' '.join(e.cmd) print e.output @@ -44,12 +50,22 @@ def main(): '# This file was generated by running:', '# ' + command_line + '', '#', - '# Note: After generating, you should remove any unnecessary dependencies.', + '# Note: Any unnecessary dependencies should be added to', + '# manifest-blacklist.txt and this file should be regenerated.', '', ] + + blacklist_patterns = [] + with open(os.path.join(os.sys.path[0], 'manifest-blacklist.txt'), 'r') \ + as blacklist_file: + blacklist_patterns = \ + [entry.partition('#')[0].strip() for entry \ + in blacklist_file.readlines()] + with open(args.output, 'w') as manifest: manifest.write('\n'.join(header)) - manifest.write(deps) + manifest.write('\n'.join([dep for dep in deps + if not IsBlacklisted(dep, blacklist_patterns)])) print 'Created ' + args.output diff --git a/blimp/tools/manifest-blacklist.txt b/blimp/tools/manifest-blacklist.txt new file mode 100644 index 0000000..ce4c1c9b --- /dev/null +++ b/blimp/tools/manifest-blacklist.txt @@ -0,0 +1,14 @@ +# Listing of filename patterns to be excluded from the Blimp Docker manifest. +# Wildcards (* or ?) are allowed. + +*.mojo +./libfont_service_library.so +./libtracing_library.so +./libmus_library.so +./libosmesa.so +./libresource_provider_library.so +./mojo_runner +gen/* +mus/mus.mojo +snapshot_blob.bin + |