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

Unified Diff: client/isolateserver.py

Issue 2060983006: luci-py/isolateserver.py: Add archive support when downloading. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Update hashes as version has changed. 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
Index: client/isolateserver.py
diff --git a/client/isolateserver.py b/client/isolateserver.py
index 00374babb1b50e94e5b12612767091e902674c9a..c1852592a6efb497ff006fd83be813fd9226385b 100755
--- a/client/isolateserver.py
+++ b/client/isolateserver.py
@@ -28,6 +28,7 @@ from third_party import colorama
from third_party.depot_tools import fix_encoding
from third_party.depot_tools import subcommand
+from libs import arfile
from utils import file_path
from utils import fs
from utils import logging_utils
@@ -2071,13 +2072,28 @@ def fetch_isolated(isolated_hash, storage, cache, outdir, use_symlinks):
fullpath = os.path.join(outdir, filepath)
with cache.getfileobj(digest) as srcfileobj:
- file_mode = props.get('m')
- if file_mode:
- # Ignore all bits apart from the user
- file_mode &= 0700
- putfile(
- srcfileobj, fullpath, file_mode,
- use_symlink=use_symlinks)
+ filetype = props.get('t', 'basic')
+
+ if filetype == 'basic':
+ file_mode = props.get('m')
+ if file_mode:
+ # Ignore all bits apart from the user
+ file_mode &= 0700
+ putfile(
+ srcfileobj, fullpath, file_mode,
+ use_symlink=use_symlinks)
+
+ elif filetype == 'ar':
+ basedir = os.path.dirname(fullpath)
+ extractor = arfile.ArFileReader(srcfileobj, fullparse=False)
+ for ai, ifd in extractor:
+ fp = os.path.normpath(os.path.join(basedir, ai.name))
+ file_path.ensure_tree(os.path.dirname(fp))
+ putfile(ifd, fp, 0700, ai.size)
+
+ else:
+ raise isolated_format.IsolatedError(
+ 'Unknown file type %r', filetype)
# Report progress.
duration = time.time() - last_update

Powered by Google App Engine
This is Rietveld 408576698