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

Unified Diff: build/android/gyp/util/build_utils.py

Issue 1641703002: support symlinks in zip files in build_utils.ExtractAll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use the MakeDirectory function Created 4 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b716c9bb5ac29dbbe5e98bad4b2651eeddbd7b0a 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:
jbudorick 2016/01/30 01:52:56 does stat.S_ISLNK(zi.external_attr) work here?
Mostyn Bramley-Moore 2016/01/30 12:57:05 It works if you pass only the two high order bytes
+ return True
+ return False
+
+
def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None,
predicate=None):
if path is None:
@@ -221,7 +229,12 @@ 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)
+ MakeDirectory(os.path.dirname(dest))
+ os.symlink(z.read(name), dest)
+ else:
+ z.extract(name, path)
def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698