Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: blimp/tools/create-bundle.py

Issue 2154873002: Update ADD handling in Dockerfiles and test bundle creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove always true if. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/engine/testing/Dockerfile ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/tools/create-bundle.py
diff --git a/blimp/tools/create-bundle.py b/blimp/tools/create-bundle.py
index 5aab7fcb17938874eb42d0c8559aa68fbe074854..ea2303e233de87bfc8d907efc6bc15ee3e7b5c06 100755
--- a/blimp/tools/create-bundle.py
+++ b/blimp/tools/create-bundle.py
@@ -15,19 +15,22 @@ import os
import subprocess
import sys
-def ReadDependencies(manifest):
- """Read the manifest and return the list of dependencies.
+def ReadDependencies(manifest, relative_path):
+ """Read the manifest. Takes each dependency found within, prepends it with
Wez 2016/07/22 00:50:28 nit: Shouldn't the description start with "Returns
Jess 2016/07/22 01:01:51 Good points. I didn't update the comments with the
+ relative path (optional), normalizes the resulting combined path, and adds
+ it to the returned dependency list.
:raises IOError: if the manifest could not be read.
"""
- deps = []
+ dependency_list = []
with open(manifest) as f:
for line in f.readlines():
# Strip comments.
- dep = line.partition('#')[0].strip()
+ dependency = line.partition('#')[0].strip()
# Ignore empty strings.
- if dep:
- deps.append(dep)
- return deps
+ if dependency:
+ dependency = os.path.normpath(os.path.join(relative_path, dependency))
+ dependency_list.append(dependency)
+ return dependency_list
def main():
parser = argparse.ArgumentParser(description=__doc__)
@@ -50,9 +53,19 @@ def main():
help=('name and path of bundle to create'),
required=True,
metavar='FILE')
+ parser.add_argument('--tar-contents-rooted-in',
+ help=('optional path prefix to use inside the resulting '
+ 'tar file'),
+ required=False,
+ metavar='DIR')
args = parser.parse_args()
- deps = ReadDependencies(args.manifest)
+ dependencies_path = args.build_dir
+ if args.tar_contents_rooted_in:
+ dependencies_path = args.tar_contents_rooted_in
+ relative_path = os.path.relpath(args.build_dir, dependencies_path)
+
+ dependency_list = ReadDependencies(args.manifest, relative_path)
try:
env = os.environ.copy()
@@ -65,7 +78,7 @@ def main():
# use as part of a "docker build". That is group readable with
# executable files also being group executable.
"--mode=g+rX",
- "-C", args.build_dir] + deps
Sriram 2016/07/22 00:38:51 I am a little confused... Is the final structure o
Jess 2016/07/22 01:01:51 Here is what is currently generated with a build d
+ "-C", dependencies_path] + dependency_list
for f in args.filelist:
dirname, basename = os.path.split(f)
subprocess_args.extend(["-C", dirname, basename])
« no previous file with comments | « blimp/engine/testing/Dockerfile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698