Merge "Support comparing separate workspaces"

am: efe63418b7

Change-Id: I13ae2a2745b0ada2564b630cb9028212c1354b6a
This commit is contained in:
Michael Schwartz
2018-10-16 15:00:54 -07:00
committed by android-build-merger

View File

@@ -24,6 +24,17 @@ VENDOR_PATH_MAP = {
'vendor/realtek' : 'Realtek' 'vendor/realtek' : 'Realtek'
} }
def _get_relative_out_path_from_root(out_path):
"""Given a path to a target out directory, get the relative path from the
Android root.
The module-info.json file paths are relative to the root source folder
ie. one directory before out."""
system_path = os.path.normpath(os.path.join(out_path, 'system'))
system_path_dirs = system_path.split(os.sep)
out_index = system_path_dirs.index("out")
return os.path.join(*system_path_dirs[out_index:])
def system_files(path): def system_files(path):
"""Returns an array of the files under /system, recursively, and ignoring """Returns an array of the files under /system, recursively, and ignoring
symbolic-links""" symbolic-links"""
@@ -44,7 +55,7 @@ def system_files_to_package_map(path):
"""Returns a dictionary mapping from each file in the /system partition to its """Returns a dictionary mapping from each file in the /system partition to its
package, according to modules-info.json.""" package, according to modules-info.json."""
system_files_to_package_map = {} system_files_to_package_map = {}
system_prefix = os.path.join(path, 'system') system_prefix = _get_relative_out_path_from_root(path)
# Skip trailing '/' # Skip trailing '/'
system_prefix_len = len(system_prefix) + 1 system_prefix_len = len(system_prefix) + 1