From 77bdbfd2611c17a698dd9c6d0746d786b902d2f7 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 8 May 2024 19:48:20 +0000 Subject: [PATCH] Add bpfmt step to bump.py When we create next year's kernel configs with bump.py, we copy and modify the previous Android.bp file. Make sure it's properly formatted with bpfmt so the CL can uploaded without manual changes. Test before and after `rm out/host/linux-x86/bin/bpfmt` Test: python tools/bump.py w x Bug: 326134954 Change-Id: Ia1a631bcae915aeeb5218d1048270d64c3e9e2de --- tools/bump.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/bump.py b/tools/bump.py index 3563275..8aed6bd 100755 --- a/tools/bump.py +++ b/tools/bump.py @@ -54,6 +54,11 @@ class Bump(object): year = datetime.datetime.now().year check_call("sed -i'' -E 's/Copyright \\(C\\) [0-9]{{4,}}/Copyright (C) {}/g' {}".format(year, abs_path), shell=True) replace_configs_module_name(self.current_release, self.new_release, abs_path) + if os.path.basename(abs_path) == "Android.bp": + if shutil.which("bpfmt") is not None: + check_call("bpfmt -w {}".format(abs_path), shell=True) + else: + print("bpfmt is not available so {} is not being formatted. Try `m bpfmt` first".format(abs_path)) def main(): parser = argparse.ArgumentParser(description=__doc__)