Commit 70e151d1 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Make build_utils.ZipDir() preserve executable bit.

This function is now used to zip the remoting installer on mac. That
zip contains a .sh script that the build server extracts and tries to
run, so make sure it remains executable after unpacking.

Bug: 875279,870611
Change-Id: Ia515a997f9d67943daa8e09907b52ec070650de2
Reviewed-on: https://chromium-review.googlesource.com/c/1301793
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Reviewed-by: default avataragrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603088}
parent e62ee2dd
...@@ -321,6 +321,13 @@ def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None, ...@@ -321,6 +321,13 @@ def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None,
zip_file.writestr(zipinfo, os.readlink(src_path)) zip_file.writestr(zipinfo, os.readlink(src_path))
return return
# zipfile.write() does
# external_attr = (os.stat(src_path)[0] & 0xFFFF) << 16L
# but we want to use _HERMETIC_FILE_ATTR, so manually set
# the few attr bits we care about.
if src_path and os.access(src_path, os.X_OK):
zipinfo.external_attr |= stat.S_IXUSR << 16L
if src_path: if src_path:
with open(src_path, 'rb') as f: with open(src_path, 'rb') as f:
data = f.read() data = f.read()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment