Revert "build: Convert build/config/nacl/rules.gni to py3"
This reverts commit 9b0ef8cae9
.
Reason for revert: https://ci.chromium.org/ui/p/chromium/builders/ci/Deterministic%20Linux/30974/overview
Original change's description:
> build: Convert build/config/nacl/rules.gni to py3
>
> Bug: 1205627
> Change-Id: If1dc022cf0d3e670fb6deb9c3a453bbc2e171166
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2909886
> Commit-Queue: Nico Weber <thakis@chromium.org>
> Auto-Submit: Nico Weber <thakis@chromium.org>
> Reviewed-by: Sam Clegg <sbc@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#886318}
Bug: 1205627
Change-Id: I2fec0b541963c66b79a1db7ec099e9e2afa12859
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2918673
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Owners-Override: Takuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#886532}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
8f0bb462ff
commit
0b2982cab5
build/config/nacl
native_client_sdk/src/tools
@ -3,6 +3,7 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
import("//build/config/nacl/config.gni")
|
import("//build/config/nacl/config.gni")
|
||||||
|
import("//build/config/python.gni")
|
||||||
|
|
||||||
# Generate a nmf file
|
# Generate a nmf file
|
||||||
#
|
#
|
||||||
@ -19,7 +20,8 @@ template("generate_nmf") {
|
|||||||
assert(defined(invoker.executables), "Must define executables")
|
assert(defined(invoker.executables), "Must define executables")
|
||||||
assert(defined(invoker.nmf), "Must define nmf")
|
assert(defined(invoker.nmf), "Must define nmf")
|
||||||
|
|
||||||
action(target_name) {
|
# TODO(crbug.com/1112471): Get this to run cleanly under Python 3.
|
||||||
|
python2_action(target_name) {
|
||||||
forward_variables_from(invoker,
|
forward_variables_from(invoker,
|
||||||
[
|
[
|
||||||
"deps",
|
"deps",
|
||||||
|
@ -132,7 +132,7 @@ def ParseElfHeader(path):
|
|||||||
"""Wrap elf.ParseElfHeader to return raise this module's Error on failure."""
|
"""Wrap elf.ParseElfHeader to return raise this module's Error on failure."""
|
||||||
try:
|
try:
|
||||||
return elf.ParseElfHeader(path)
|
return elf.ParseElfHeader(path)
|
||||||
except elf.Error as e:
|
except elf.Error, e:
|
||||||
raise Error(str(e))
|
raise Error(str(e))
|
||||||
|
|
||||||
|
|
||||||
@ -248,14 +248,14 @@ class NmfUtils(object):
|
|||||||
self.lib_path)
|
self.lib_path)
|
||||||
except get_shared_deps.NoObjdumpError:
|
except get_shared_deps.NoObjdumpError:
|
||||||
raise Error('No objdump executable found (see --help for more info)')
|
raise Error('No objdump executable found (see --help for more info)')
|
||||||
except get_shared_deps.Error as e:
|
except get_shared_deps.Error, e:
|
||||||
raise Error(str(e))
|
raise Error(str(e))
|
||||||
|
|
||||||
self.needed = {}
|
self.needed = {}
|
||||||
|
|
||||||
# all_files is a dictionary mapping filename to architecture. self.needed
|
# all_files is a dictionary mapping filename to architecture. self.needed
|
||||||
# should be a dictionary of filename to ArchFile.
|
# should be a dictionary of filename to ArchFile.
|
||||||
for filename, arch in all_files.items():
|
for filename, arch in all_files.iteritems():
|
||||||
name = os.path.basename(filename)
|
name = os.path.basename(filename)
|
||||||
self.needed[filename] = ArchFile(name=name, path=filename, arch=arch)
|
self.needed[filename] = ArchFile(name=name, path=filename, arch=arch)
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ class NmfUtils(object):
|
|||||||
main_dir = ''
|
main_dir = ''
|
||||||
arch_to_main_dir[arch] = main_dir
|
arch_to_main_dir[arch] = main_dir
|
||||||
|
|
||||||
for arch_file in self.needed.values():
|
for arch_file in self.needed.itervalues():
|
||||||
prefix = ''
|
prefix = ''
|
||||||
if DirectoryTreeContainsFile(self.nmf_root, arch_file.path):
|
if DirectoryTreeContainsFile(self.nmf_root, arch_file.path):
|
||||||
# This file is already in the nmf_root tree, so it does not need to be
|
# This file is already in the nmf_root tree, so it does not need to be
|
||||||
@ -317,7 +317,7 @@ class NmfUtils(object):
|
|||||||
destination_dir: The destination directory for staging the dependencies
|
destination_dir: The destination directory for staging the dependencies
|
||||||
"""
|
"""
|
||||||
assert self.needed is not None
|
assert self.needed is not None
|
||||||
for arch_file in self.needed.values():
|
for arch_file in self.needed.itervalues():
|
||||||
source = arch_file.path
|
source = arch_file.path
|
||||||
destination = os.path.join(destination_dir, arch_file.url)
|
destination = os.path.join(destination_dir, arch_file.url)
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ class NmfUtils(object):
|
|||||||
url=url))
|
url=url))
|
||||||
for key, arch, url in self.extra_files]
|
for key, arch, url in self.extra_files]
|
||||||
|
|
||||||
manifest_items = list(needed.items()) + extra_files_kv
|
manifest_items = needed.items() + extra_files_kv
|
||||||
|
|
||||||
# Add dynamic loader to the program section.
|
# Add dynamic loader to the program section.
|
||||||
for need, archinfo in manifest_items:
|
for need, archinfo in manifest_items:
|
||||||
@ -703,7 +703,7 @@ def main(args):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
rtn = main(sys.argv[1:])
|
rtn = main(sys.argv[1:])
|
||||||
except Error as e:
|
except Error, e:
|
||||||
sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e))
|
sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e))
|
||||||
rtn = 1
|
rtn = 1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@ -10,8 +10,6 @@ the location of Chrome. This is used, for example, to determine the correct
|
|||||||
Toolchain to invoke.
|
Toolchain to invoke.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -265,7 +263,7 @@ def main(args):
|
|||||||
out = platform
|
out = platform
|
||||||
|
|
||||||
if out:
|
if out:
|
||||||
print(out)
|
print out
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ def ParseElfHeader(path):
|
|||||||
raise Error("error parsing elf header: %s" % path)
|
raise Error("error parsing elf header: %s" % path)
|
||||||
e_ident, _, e_machine = header[:3]
|
e_ident, _, e_machine = header[:3]
|
||||||
|
|
||||||
elf_magic = b'\x7fELF'
|
elf_magic = '\x7fELF'
|
||||||
if e_ident[:4] != elf_magic:
|
if e_ident[:4] != elf_magic:
|
||||||
raise Error('Not a valid NaCl executable: %s' % path)
|
raise Error('Not a valid NaCl executable: %s' % path)
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ def GetNeeded(main_files, objdump, lib_path):
|
|||||||
def _GetNeededDynamic(main_files, objdump, lib_path):
|
def _GetNeededDynamic(main_files, objdump, lib_path):
|
||||||
examined = set()
|
examined = set()
|
||||||
all_files, unexamined = GleanFromObjdump(main_files, None, objdump, lib_path)
|
all_files, unexamined = GleanFromObjdump(main_files, None, objdump, lib_path)
|
||||||
for arch in all_files.values():
|
for arch in all_files.itervalues():
|
||||||
if unexamined:
|
if unexamined:
|
||||||
if arch == 'arm':
|
if arch == 'arm':
|
||||||
unexamined.add((LOADER_ARM, arch))
|
unexamined.add((LOADER_ARM, arch))
|
||||||
@ -106,7 +106,7 @@ def _GetNeededDynamic(main_files, objdump, lib_path):
|
|||||||
|
|
||||||
# Call GleanFromObjdump() for each architecture.
|
# Call GleanFromObjdump() for each architecture.
|
||||||
needed = set()
|
needed = set()
|
||||||
for arch, files in files_to_examine.items():
|
for arch, files in files_to_examine.iteritems():
|
||||||
new_files, new_needed = GleanFromObjdump(files, arch, objdump, lib_path)
|
new_files, new_needed = GleanFromObjdump(files, arch, objdump, lib_path)
|
||||||
all_files.update(new_files)
|
all_files.update(new_files)
|
||||||
needed |= new_needed
|
needed |= new_needed
|
||||||
@ -117,7 +117,7 @@ def _GetNeededDynamic(main_files, objdump, lib_path):
|
|||||||
# With the runnable-ld.so scheme we have today, the proper name of
|
# With the runnable-ld.so scheme we have today, the proper name of
|
||||||
# the dynamic linker should be excluded from the list of files.
|
# the dynamic linker should be excluded from the list of files.
|
||||||
ldso = [LD_NACL_MAP[arch] for arch in set(OBJDUMP_ARCH_MAP.values())]
|
ldso = [LD_NACL_MAP[arch] for arch in set(OBJDUMP_ARCH_MAP.values())]
|
||||||
for filename, arch in list(all_files.items()):
|
for filename, arch in all_files.items():
|
||||||
name = os.path.basename(filename)
|
name = os.path.basename(filename)
|
||||||
if name in ldso:
|
if name in ldso:
|
||||||
del all_files[filename]
|
del all_files[filename]
|
||||||
@ -160,7 +160,6 @@ def GleanFromObjdump(files, arch, objdump, lib_path):
|
|||||||
env = {'LANG': 'en_US.UTF-8'}
|
env = {'LANG': 'en_US.UTF-8'}
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, bufsize=-1,
|
stderr=subprocess.PIPE, bufsize=-1,
|
||||||
universal_newlines=True,
|
|
||||||
env=env)
|
env=env)
|
||||||
|
|
||||||
input_info = {}
|
input_info = {}
|
||||||
|
@ -454,7 +454,7 @@ def Zip(args):
|
|||||||
zip_info.date_time = time.localtime(st.st_mtime)[0:6]
|
zip_info.date_time = time.localtime(st.st_mtime)[0:6]
|
||||||
zip_info.compress_type = zip_stream.compression
|
zip_info.compress_type = zip_stream.compression
|
||||||
zip_info.flag_bits = 0x00
|
zip_info.flag_bits = 0x00
|
||||||
zip_info.external_attr = (st[0] & 0xFFFF) << 16
|
zip_info.external_attr = (st[0] & 0xFFFF) << 16L
|
||||||
zip_info.CRC = 0
|
zip_info.CRC = 0
|
||||||
zip_info.compress_size = 0
|
zip_info.compress_size = 0
|
||||||
zip_info.file_size = 0
|
zip_info.file_size = 0
|
||||||
|
Reference in New Issue
Block a user