Commit ab83ee3c authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

Fix Clank official build failure. Speculatively revert CL.

Clank Official Build Failure:
~~~
  File "../../build/android/gyp/apkbuilder.py", line 383, in <module>
    main(sys.argv[1:])
  File "../../build/android/gyp/apkbuilder.py", line 307, in main
    with zipfile.ZipFile(options.dex_file, 'r') as dex_zip:
  File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
    self._RealGetContents()
  File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
    x._decodeExtra()
  File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
    tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
~~~

This CL speculatively revert the CLs that seems to be linked with build
failure.

The bug happens while trying to zip dex file:
~~~
with zipfile.ZipFile(options.dex_file, 'r') as dex_zip:
~~~
and the following branch of CL deals with zip + dex files:

Revert "dex.py: Remove obsolete flags, code clean-up."
  commit 35fc212e.
  https://chromium-review.googlesource.com/c/chromium/src/+/1694090/4
Revert "Android: Zipalign library dex files for incremental install"
  commit 209eac23.
  https://chromium-review.googlesource.com/c/chromium/src/+/1692492/6

TBR=agrieve@chromium.org

Bug: 983519
Change-Id: Ia90b7f5d16b09ae29cf0617a09a80e5312ed858a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700064
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarSam Maier <smaier@chromium.org>
Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676898}
parent 222a2e43
This diff is collapsed.
...@@ -34,6 +34,10 @@ DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', ...@@ -34,6 +34,10 @@ DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT',
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir, os.pardir, os.pardir, os.pardir))) os.pardir, os.pardir, os.pardir, os.pardir)))
HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0)
_HERMETIC_FILE_ATTR = (0o644 << 16)
try: try:
string_types = basestring string_types = basestring
except NameError: except NameError:
...@@ -310,14 +314,6 @@ def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None, ...@@ -310,14 +314,6 @@ def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None,
return extracted return extracted
def HermeticZipInfo(*args, **kwargs):
"""Creates a ZipInfo with a constant timestamp and external_attr."""
ret = zipfile.ZipInfo(*args, **kwargs)
ret.date_time = (2001, 1, 1, 0, 0, 0)
ret.external_attr = (0o644 << 16)
return ret
def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None, def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None,
compress=None): compress=None):
"""Adds a file to the given ZipFile with a hard-coded modified time. """Adds a file to the given ZipFile with a hard-coded modified time.
...@@ -333,7 +329,8 @@ def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None, ...@@ -333,7 +329,8 @@ 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 = HermeticZipInfo(filename=zip_path) zipinfo = zipfile.ZipInfo(filename=zip_path, date_time=HERMETIC_TIMESTAMP)
zipinfo.external_attr = _HERMETIC_FILE_ATTR
if src_path and os.path.islink(src_path): if src_path and os.path.islink(src_path):
zipinfo.filename = zip_path zipinfo.filename = zip_path
......
...@@ -1295,11 +1295,13 @@ if (enable_java_templates) { ...@@ -1295,11 +1295,13 @@ if (enable_java_templates) {
invoker.output, invoker.output,
] ]
_rebased_output = rebase_path(invoker.output, root_build_dir)
args = [ args = [
"--depfile", "--depfile",
rebase_path(depfile, root_build_dir), rebase_path(depfile, root_build_dir),
"--output", "--dex-path",
rebase_path(outputs[0], root_build_dir), _rebased_output,
] ]
if (_proguard_enabled) { if (_proguard_enabled) {
...@@ -1320,7 +1322,7 @@ if (enable_java_templates) { ...@@ -1320,7 +1322,7 @@ if (enable_java_templates) {
if (defined(invoker.input_dex_classpath)) { if (defined(invoker.input_dex_classpath)) {
inputs += [ invoker.build_config ] inputs += [ invoker.build_config ]
args += [ "--input-list=@FileArg(${invoker.input_dex_classpath})" ] args += [ "--inputs=@FileArg(${invoker.input_dex_classpath})" ]
} }
inputs += _dexing_jars inputs += _dexing_jars
......
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