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

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: Lint clean up. 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
« blimp/engine/Dockerfile ('K') | « 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..603fabc9d6f4a487e81ab3e6921dd68657a8c341 100755
--- a/blimp/tools/create-bundle.py
+++ b/blimp/tools/create-bundle.py
@@ -15,7 +15,7 @@ import os
import subprocess
import sys
-def ReadDependencies(manifest):
+def ReadDependencies(manifest, relpath):
Wez 2016/07/16 00:26:36 Here & below, Python Style Guide is to use unix_ha
Jess 2016/07/16 01:10:32 Updated the variable names you mentioned.
"""Read the manifest and return the list of dependencies.
:raises IOError: if the manifest could not be read.
"""
@@ -26,6 +26,8 @@ def ReadDependencies(manifest):
dep = line.partition('#')[0].strip()
# Ignore empty strings.
if dep:
+ if relpath != '':
+ dep = os.path.normpath(os.path.join(relpath, dep))
deps.append(dep)
return deps
@@ -50,9 +52,19 @@ def main():
help=('name and path of bundle to create'),
required=True,
metavar='FILE')
+ parser.add_argument('--root-dir',
+ help=('optional docker rootdir to use to reference '
+ 'dependencies; defaults to build-dir'),
+ required=False,
+ metavar='DIR')
args = parser.parse_args()
- deps = ReadDependencies(args.manifest)
+ deppath = args.build_dir
+ if args.root_dir:
+ deppath = args.root_dir
+ relpath = os.path.relpath(args.build_dir, deppath)
+
+ deps = ReadDependencies(args.manifest, relpath)
try:
env = os.environ.copy()
@@ -65,7 +77,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
+ "-C", deppath] + deps
for f in args.filelist:
dirname, basename = os.path.split(f)
subprocess_args.extend(["-C", dirname, basename])
« blimp/engine/Dockerfile ('K') | « blimp/engine/testing/Dockerfile ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698