am 2e4dd9ab: Merge "Fix the permission in common.ZipWriteStr()."

* commit '2e4dd9ab2635f6a22df407ae1ee4dc16e0601102':
  Fix the permission in common.ZipWriteStr().
This commit is contained in:
Tao Bao
2015-07-11 01:11:43 +00:00
committed by Android Git Automerger

View File

@@ -908,7 +908,7 @@ def ZipWriteStr(zip_file, zinfo_or_arcname, data, perms=None,
zinfo = zipfile.ZipInfo(filename=zinfo_or_arcname)
zinfo.compress_type = zip_file.compression
if perms is None:
perms = 0o644
perms = 0o100644
else:
zinfo = zinfo_or_arcname
@@ -918,6 +918,9 @@ def ZipWriteStr(zip_file, zinfo_or_arcname, data, perms=None,
# If perms is given, it has a priority.
if perms is not None:
# If perms doesn't set the file type, mark it as a regular file.
if perms & 0o770000 == 0:
perms |= 0o100000
zinfo.external_attr = perms << 16
# Use a fixed timestamp so the output is repeatable.