 Chromium Code Reviews
 Chromium Code Reviews Issue 1641703002:
  support symlinks in zip files in build_utils.ExtractAll  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1641703002:
  support symlinks in zip files in build_utils.ExtractAll  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: build/android/gyp/util/build_utils.py | 
| diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py | 
| index fe69c956f0f9f49db1ceb4e085c84668e1c7a5fc..5d8400b73f8a64d60b7a2ced147c4196995af252 100644 | 
| --- a/build/android/gyp/util/build_utils.py | 
| +++ b/build/android/gyp/util/build_utils.py | 
| @@ -198,6 +198,14 @@ def CheckZipPath(name): | 
| raise Exception('Absolute zip path: %s' % name) | 
| +def IsSymlink(zip_file, name): | 
| + zi = zip_file.getinfo(name) | 
| + symlink_attr = 0120000 << 16L | 
| + if zi.external_attr & symlink_attr == symlink_attr: | 
| + return True | 
| + return False | 
| + | 
| + | 
| def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None, | 
| predicate=None): | 
| if path is None: | 
| @@ -221,7 +229,14 @@ def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None, | 
| raise Exception( | 
| 'Path already exists from zip: %s %s %s' | 
| % (zip_path, name, output_path)) | 
| - z.extract(name, path) | 
| + if IsSymlink(z, name): | 
| + dest = os.path.join(path, name) | 
| + dest_dir = os.path.dirname(dest) | 
| + if not os.path.exists(dest_dir): | 
| + os.makedirs(dest_dir) | 
| 
Mostyn Bramley-Moore
2016/01/28 21:20:41
I should use the MakeDirectory function here, I gu
 | 
| + os.symlink(z.read(name), dest) | 
| + else: | 
| + z.extract(name, path) | 
| def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None, |