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

Unified Diff: mojo/public/tools/gn/zip.py

Issue 2396803003: Make mojom.srcjar files produce hermetic zip files. (Closed)
Patch Set: fix accidentally deleted file! Created 4 years, 2 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 | « mojo/public/tools/bindings/generators/mojom_java_generator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/gn/zip.py
diff --git a/mojo/public/tools/gn/zip.py b/mojo/public/tools/gn/zip.py
index 0d4960f4a1a721959303a845eb33164bde14bd94..adc9cb1cba8132ac35ffa355b66e699628fe58ec 100755
--- a/mojo/public/tools/gn/zip.py
+++ b/mojo/public/tools/gn/zip.py
@@ -20,25 +20,30 @@ sys.path.append(os.path.join(os.path.dirname(__file__),
"build"))
import gn_helpers
+sys.path.append(os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir, os.pardir, os.pardir,
+ 'build', 'android', 'gyp'))
+from util import build_utils
+
+
def DoZip(inputs, link_inputs, zip_inputs, output, base_dir):
files = []
with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED) as outfile:
for f in inputs:
file_name = os.path.relpath(f, base_dir)
files.append(file_name)
- outfile.write(f, file_name)
+ build_utils.AddToZipHermetic(outfile, file_name, f)
for f in link_inputs:
realf = os.path.realpath(f) # Resolve symlinks.
file_name = os.path.relpath(realf, base_dir)
files.append(file_name)
- outfile.write(realf, file_name)
+ build_utils.AddToZipHermetic(outfile, file_name, realf)
for zf_name in zip_inputs:
with zipfile.ZipFile(zf_name, 'r') as zf:
for f in zf.namelist():
if f not in files:
files.append(f)
- with zf.open(f) as zff:
- outfile.writestr(f, zff.read())
+ build_utils.AddToZipHermetic(outfile, f, data=zf.read(f))
def main():
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_java_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698