bump.py remove Level.h dependency
We want to run bump.py during finalization. We don't want to have to update Level.h and the VTS tests that early. So this CL removes the dependency on Level.h and requires the current/next letters of the API levels for the kernerl configs to be passed as arguments. Test: bump.py 202404 202505 v w Bug: 279809333 Change-Id: If8f281eccf62d380949a5ea9f5d0d3bb2d7f19ab
This commit is contained in:
parent
4be20f792a
commit
0425916b68
1 changed files with 15 additions and 24 deletions
|
@ -16,8 +16,6 @@
|
|||
#
|
||||
"""
|
||||
Creates the next compatibility matrix.
|
||||
|
||||
Requires libvintf Level.h to be updated before executing this script.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
@ -44,41 +42,28 @@ class Bump(object):
|
|||
self.top = pathlib.Path(os.environ["ANDROID_BUILD_TOP"])
|
||||
self.interfaces_dir = self.top / "hardware/interfaces"
|
||||
|
||||
self.current_level = cmdline_args.current
|
||||
self.current_level = cmdline_args.current_level
|
||||
self.current_letter = cmdline_args.current_letter
|
||||
self.current_module_name = f"framework_compatibility_matrix.{self.current_level}.xml"
|
||||
self.current_xml = self.interfaces_dir / f"compatibility_matrices/compatibility_matrix.{self.current_level}.xml"
|
||||
self.device_module_name = "framework_compatibility_matrix.device.xml"
|
||||
|
||||
self.next_level = cmdline_args.next
|
||||
self.next_level = cmdline_args.next_level
|
||||
self.next_letter = cmdline_args.next_letter
|
||||
self.next_module_name = f"framework_compatibility_matrix.{self.next_level}.xml"
|
||||
self.next_xml = self.interfaces_dir / f"compatibility_matrices/compatibility_matrix.{self.next_level}.xml"
|
||||
|
||||
self.level_to_letter = self.get_level_to_letter_mapping()
|
||||
print("Found level mapping in libvintf Level.h:", self.level_to_letter)
|
||||
|
||||
def run(self):
|
||||
self.bump_kernel_configs()
|
||||
self.copy_matrix()
|
||||
self.edit_android_bp()
|
||||
self.edit_android_mk()
|
||||
|
||||
def get_level_to_letter_mapping(self):
|
||||
levels_file = self.top / "system/libvintf/include/vintf/Level.h"
|
||||
with open(levels_file) as f:
|
||||
lines = f.readlines()
|
||||
pairs = [
|
||||
line.split("=", maxsplit=2) for line in lines if "=" in line
|
||||
]
|
||||
return {
|
||||
level.strip().removesuffix(","): letter.strip()
|
||||
for letter, level in pairs
|
||||
}
|
||||
|
||||
def bump_kernel_configs(self):
|
||||
check_call([
|
||||
self.top / "kernel/configs/tools/bump.py",
|
||||
self.level_to_letter[self.current_level].lower(),
|
||||
self.level_to_letter[self.next_level].lower(),
|
||||
self.current_letter,
|
||||
self.next_letter,
|
||||
])
|
||||
|
||||
def copy_matrix(self):
|
||||
|
@ -102,7 +87,7 @@ class Bump(object):
|
|||
next_kernel_configs = check_output(
|
||||
"""grep -rh name: | sed -E 's/^.*"(.*)".*/\\1/g'""",
|
||||
cwd=self.top / "kernel/configs" /
|
||||
self.level_to_letter[self.next_level].lower(),
|
||||
self.next_letter,
|
||||
text=True,
|
||||
shell=True,
|
||||
).splitlines()
|
||||
|
@ -146,12 +131,18 @@ class Bump(object):
|
|||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("current",
|
||||
parser.add_argument("current_level",
|
||||
type=str,
|
||||
help="VINTF level of the current version (e.g. 9)")
|
||||
parser.add_argument("next",
|
||||
parser.add_argument("next_level",
|
||||
type=str,
|
||||
help="VINTF level of the next version (e.g. 10)")
|
||||
parser.add_argument("current_letter",
|
||||
type=str,
|
||||
help="Letter of the API level of the current version (e.g. v)")
|
||||
parser.add_argument("next_letter",
|
||||
type=str,
|
||||
help="Letter of the API level of the next version (e.g. w)")
|
||||
cmdline_args = parser.parse_args()
|
||||
|
||||
Bump(cmdline_args).run()
|
||||
|
|
Loading…
Reference in a new issue