Revert of [Android] Sanitize APK signing file timestamps. (patchset #3 id:40001 of https://codereview.chromium.org/2176023002/ )

Reason for revert:
Breaking builds:
https://bugs.chromium.org/p/chromium/issues/detail?id=632400

Original issue's description:
> [Android] Sanitize APK signing file timestamps.
>
> BUG=630931
>
> Committed: https://crrev.com/61e1a7ac087039d43e694c08584724252f9785ce
> Cr-Commit-Position: refs/heads/master@{#408389}

TBR=stip@chromium.org,jbudorick@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=630931

Review-Url: https://codereview.chromium.org/2191673004
Cr-Original-Commit-Position: refs/heads/master@{#408425}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c7b32ac6019e85f6485d46860eb43bdbaf72a76f
This commit is contained in:
agrieve 2016-07-28 10:35:40 -07:00 коммит произвёл Commit bot
Родитель b9c03c27dd
Коммит 275935d0d9
2 изменённых файлов: 2 добавлений и 12 удалений

Просмотреть файл

@ -11,7 +11,6 @@ import optparse
import shutil import shutil
import sys import sys
import tempfile import tempfile
import zipfile
from util import build_utils from util import build_utils
@ -144,15 +143,6 @@ def FinalizeApk(options):
JarSigner(options.key_path, options.key_name, options.key_passwd, JarSigner(options.key_path, options.key_name, options.key_passwd,
apk_to_sign, signed_apk_path) apk_to_sign, signed_apk_path)
# Make the signing files hermetic.
with tempfile.NamedTemporaryFile(suffix='.zip') as hermetic_signed_apk:
with zipfile.ZipFile(signed_apk_path, 'r') as zi:
with zipfile.ZipFile(hermetic_signed_apk, 'w') as zo:
for info in zi.infolist():
info.date_time = build_utils.HERMETIC_TIMESTAMP
zo.writestr(info, zi.read(info.filename))
shutil.copy(hermetic_signed_apk.name, signed_apk_path)
if options.load_library_from_zip: if options.load_library_from_zip:
# Reorder the contents of the APK. This re-establishes the canonical # Reorder the contents of the APK. This re-establishes the canonical
# order which means the library will be back at its page aligned location. # order which means the library will be back at its page aligned location.

Просмотреть файл

@ -28,7 +28,7 @@ COLORAMA_ROOT = os.path.join(host_paths.DIR_SOURCE_ROOT,
# aapt should ignore OWNERS files in addition the default ignore pattern. # aapt should ignore OWNERS files in addition the default ignore pattern.
AAPT_IGNORE_PATTERN = ('!OWNERS:!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:' + AAPT_IGNORE_PATTERN = ('!OWNERS:!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:' +
'!CVS:!thumbs.db:!picasa.ini:!*~:!*.d.stamp') '!CVS:!thumbs.db:!picasa.ini:!*~:!*.d.stamp')
HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0) _HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0)
_HERMETIC_FILE_ATTR = (0644 << 16L) _HERMETIC_FILE_ATTR = (0644 << 16L)
@ -267,7 +267,7 @@ def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None,
assert (src_path is None) != (data is None), ( assert (src_path is None) != (data is None), (
'|src_path| and |data| are mutually exclusive.') '|src_path| and |data| are mutually exclusive.')
CheckZipPath(zip_path) CheckZipPath(zip_path)
zipinfo = zipfile.ZipInfo(filename=zip_path, date_time=HERMETIC_TIMESTAMP) zipinfo = zipfile.ZipInfo(filename=zip_path, date_time=_HERMETIC_TIMESTAMP)
zipinfo.external_attr = _HERMETIC_FILE_ATTR zipinfo.external_attr = _HERMETIC_FILE_ATTR
if src_path and os.path.islink(src_path): if src_path and os.path.islink(src_path):