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

Side by Side Diff: client/isolated_format.py

Issue 2484133002: luci-py/isolateserver.py: Add support for tar archives when downloading. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Rebase onto master. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « appengine/isolate/doc/Design.md ('k') | client/isolateserver.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The LUCI Authors. All rights reserved. 1 # Copyright 2014 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Understands .isolated files and can do local operations on them.""" 5 """Understands .isolated files and can do local operations on them."""
6 6
7 import hashlib 7 import hashlib
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
11 import re 11 import re
12 import stat 12 import stat
13 import sys 13 import sys
14 14
15 from utils import file_path 15 from utils import file_path
16 from utils import fs 16 from utils import fs
17 from utils import tools 17 from utils import tools
18 18
19 19
20 # Version stored and expected in .isolated files. 20 # Version stored and expected in .isolated files.
21 ISOLATED_FILE_VERSION = '1.5' 21 ISOLATED_FILE_VERSION = '1.6'
22 22
23 23
24 # Chunk size to use when doing disk I/O. 24 # Chunk size to use when doing disk I/O.
25 DISK_FILE_CHUNK = 1024 * 1024 25 DISK_FILE_CHUNK = 1024 * 1024
26 26
27 27
28 # Sadly, hashlib uses 'sha1' instead of the standard 'sha-1' so explicitly 28 # Sadly, hashlib uses 'sha1' instead of the standard 'sha-1' so explicitly
29 # specify the names here. 29 # specify the names here.
30 SUPPORTED_ALGOS = { 30 SUPPORTED_ALGOS = {
31 'md5': hashlib.md5, 31 'md5': hashlib.md5,
32 'sha-1': hashlib.sha1, 32 'sha-1': hashlib.sha1,
33 'sha-512': hashlib.sha512, 33 'sha-512': hashlib.sha512,
34 } 34 }
35 35
36 36
37 # Used for serialization. 37 # Used for serialization.
38 SUPPORTED_ALGOS_REVERSE = dict((v, k) for k, v in SUPPORTED_ALGOS.iteritems()) 38 SUPPORTED_ALGOS_REVERSE = dict((v, k) for k, v in SUPPORTED_ALGOS.iteritems())
39 39
40 SUPPORTED_FILE_TYPES = ['basic', 'ar'] 40 SUPPORTED_FILE_TYPES = ['basic', 'ar', 'tar']
41 41
42 42
43 class IsolatedError(ValueError): 43 class IsolatedError(ValueError):
44 """Generic failure to load a .isolated file.""" 44 """Generic failure to load a .isolated file."""
45 pass 45 pass
46 46
47 47
48 class MappingError(OSError): 48 class MappingError(OSError):
49 """Failed to recreate the tree.""" 49 """Failed to recreate the tree."""
50 pass 50 pass
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 data['files'] = dict( 567 data['files'] = dict(
568 (k.replace(wrong_path_sep, os.path.sep), v) 568 (k.replace(wrong_path_sep, os.path.sep), v)
569 for k, v in data['files'].iteritems()) 569 for k, v in data['files'].iteritems())
570 for v in data['files'].itervalues(): 570 for v in data['files'].itervalues():
571 if 'l' in v: 571 if 'l' in v:
572 v['l'] = v['l'].replace(wrong_path_sep, os.path.sep) 572 v['l'] = v['l'].replace(wrong_path_sep, os.path.sep)
573 if 'relative_cwd' in data: 573 if 'relative_cwd' in data:
574 data['relative_cwd'] = data['relative_cwd'].replace( 574 data['relative_cwd'] = data['relative_cwd'].replace(
575 wrong_path_sep, os.path.sep) 575 wrong_path_sep, os.path.sep)
576 return data 576 return data
OLDNEW
« no previous file with comments | « appengine/isolate/doc/Design.md ('k') | client/isolateserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698