Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: third_party/android_platform/development/scripts/stack_core.py

Issue 2525513003: stack: Detect library by name and arch (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/android_platform/development/scripts/stack_core.py
diff --git a/third_party/android_platform/development/scripts/stack_core.py b/third_party/android_platform/development/scripts/stack_core.py
index 119bd407009ed0749b0c4d59effd413793831cae..78130220d9de1e6630fd2deedbffa607ba57d80e 100755
--- a/third_party/android_platform/development/scripts/stack_core.py
+++ b/third_party/android_platform/development/scripts/stack_core.py
@@ -488,9 +488,9 @@ def GetUncompressedSharedLibraryFromAPK(apkname, offset):
break
return soname, sosize
-def GetSharedLibraryInHost(soname, sosize, dirs):
+def GetSharedLibraryInHost(soname, dirs):
"""Find the shared library in given host directories by comparing
- the name and size.
+ the name.
Return:
the shared libray in host if found.
"""
@@ -498,9 +498,8 @@ def GetSharedLibraryInHost(soname, sosize, dirs):
host_so_file = os.path.join(dir, os.path.basename(soname))
if not os.path.isfile(host_so_file):
continue
- if sosize == os.stat(host_so_file).st_size:
- logging.debug("%s match to the one in APK" % host_so_file)
- return host_so_file
+ logging.debug("%s match to the one in APK" % host_so_file)
+ return host_so_file
def FindSharedLibraryFromAPKs(out_dir, offset):
"""Find the shared library at the specifc offset of APK.
@@ -521,15 +520,17 @@ def FindSharedLibraryFromAPKs(out_dir, offset):
soname, sosize = GetUncompressedSharedLibraryFromAPK(apk, offset)
if soname == "":
continue
- # These are possible directores for the shared libraries,
- # Beside out_dir, others are possible secondary abi output dir
- # for Monochrome.
- dirs = [out_dir,
- os.path.join(out_dir, "arm_v8_arm"),
- os.path.join(out_dir, "mips_v8_mips"),
- os.path.join(out_dir, "x86"),
+ # The relocation section of libraries in APK is packed, we can't
+ # detect library by its size, and have to rely on the order of lib
+ # directories; for a specific ARCH, the libraries are in either
+ # out_dir or out_dir/android_ARCH, and android_ARCH directory could
+ # exists or not, so having android_ARCH directory be in first, we
+ # will find the correct lib.
+ dirs = [
+ os.path.join(out_dir, "android_%s" % symbol.ARCH),
+ out_dir,
]
- host_so_file = GetSharedLibraryInHost(soname, sosize, dirs)
+ host_so_file = GetSharedLibraryInHost(soname, dirs)
if host_so_file:
shared_libraries += [(soname, host_so_file)]
# If there are more than one libraries found, it means detecting
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698