From c76931fe8b8c847165e7df45916b11d0939fb6a5 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Thu, 4 Nov 2021 16:59:39 -0700 Subject: [PATCH] Use python 3 for release tools The release tools have already been updated in prior cls to support python 3. To test this, I added code to print the script name to a temp file at the beginning of every script, and then ran various builds, ensuring that the scripts were run afterwards. The builds run: m brillo_update_payload checkvintf minigzip lz4 toybox unpack_bootimg deapexer (needed for releasetools_test) m (as both sdk_phone_x86_64 and beagle_x15) m target-files-package (as both sdk_phone_x86_64 and beagle_x15) m releasetools_test && out/host/linux-x86/nativetest64/releasetools_test/releasetools_test (25 errors with and without python3) m check_target_files_signatures apksigner target-files-package && out/host/linux-x86/bin/check_target_files_signatures out/target/product/emulator_x86_64/obj/PACKAGING/target_files_intermediates/sdk_phone_x86_64-target_files-eng.colefaust.zip m dist As aosp_cf_x86_64_phone: m dist && sign_target_files_apks out/dist/aosp_cf_x86_64_phone-target_files-eng.$USER.zip /tmp/signed_target_files.zip && validate_target_files /tmp/signed_target_files.zip This hit all the scripts except for make_recovery_patch, merge_builds, and ota_package_parser. I couldn't find anything that uses merge_builds, so it must only be run manually. make_recovery_patch and ota_package_parser are only run if TARGET_OTA_ALLOW_NON_AB is true (among other things), which is not the case for any product in aosp. Test: Described in commit message + presubmits Change-Id: I1a29eafa7ff1a69973b27055e311de77f7ee628b --- tools/releasetools/Android.bp | 73 ++--------------------------------- 1 file changed, 4 insertions(+), 69 deletions(-) diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp index fc588e437d..827aaac8f1 100644 --- a/tools/releasetools/Android.bp +++ b/tools/releasetools/Android.bp @@ -100,14 +100,6 @@ python_defaults { python_library_host { name: "ota_metadata_proto", - version: { - py2: { - enabled: true, - }, - py3: { - enabled: true, - }, - }, srcs: [ "ota_metadata.proto", ], @@ -187,29 +179,15 @@ python_defaults { // Host libraries. // -python_defaults { - name: "releasetools_library_defaults", - version: { - py2: { - enabled: true, - }, - py3: { - enabled: true, - }, - }, -} - python_library_host { name: "releasetools_add_img_to_target_files", defaults: [ - "releasetools_library_defaults", "releasetools_add_img_to_target_files_defaults", ], } python_library_host { name: "releasetools_apex_utils", - defaults: ["releasetools_library_defaults"], srcs: [ "apex_utils.py", ], @@ -223,7 +201,6 @@ python_library_host { python_library_host { name: "releasetools_build_image", defaults: [ - "releasetools_library_defaults", "releasetools_build_image_defaults", ], } @@ -231,7 +208,6 @@ python_library_host { python_library_host { name: "releasetools_build_super_image", defaults: [ - "releasetools_library_defaults", "releasetools_build_super_image_defaults", ], } @@ -239,14 +215,12 @@ python_library_host { python_library_host { name: "releasetools_check_target_files_vintf", defaults: [ - "releasetools_library_defaults", "releasetools_check_target_files_vintf_defaults", ], } python_library_host { name: "releasetools_common", - defaults: ["releasetools_library_defaults"], srcs: [ "blockimgdiff.py", "common.py", @@ -274,7 +248,6 @@ python_library_host { python_library_host { name: "releasetools_img_from_target_files", defaults: [ - "releasetools_library_defaults", "releasetools_img_from_target_files_defaults", ], } @@ -282,14 +255,12 @@ python_library_host { python_library_host { name: "releasetools_ota_from_target_files", defaults: [ - "releasetools_library_defaults", "releasetools_ota_from_target_files_defaults", ], } python_library_host { name: "releasetools_verity_utils", - defaults: ["releasetools_library_defaults"], srcs: [ "verity_utils.py", ], @@ -308,13 +279,8 @@ python_library_host { python_defaults { name: "releasetools_binary_defaults", version: { - py2: { - enabled: true, - embedded_launcher: true, - }, py3: { - enabled: false, - embedded_launcher: false, + embedded_launcher: true, }, }, // TODO (b/140144201) Build imgdiff from releasetools_common @@ -443,7 +409,6 @@ python_library_host { name: "releasetools_find_shareduid_violation", defaults: [ "releasetools_find_shareduid_violation_defaults", - "releasetools_library_defaults", ], } @@ -628,39 +593,9 @@ python_test_host { name: "releasetools_test", defaults: ["releasetools_test_defaults"], main: "test_utils.py", - version: { - py2: { - enabled: true, - // When using embedded launcher, atest will try (but may fail) to load libc++.so from - // host, because the test executable won't be able to find the needed libs via its - // runpath. - embedded_launcher: false, - }, - py3: { - enabled: false, - embedded_launcher: false, - }, - }, - test_options: { - unit_test: true, - }, -} - -python_test_host { - name: "releasetools_py3_test", - defaults: ["releasetools_test_defaults"], - main: "test_utils.py", - test_suites: ["general-tests"], - version: { - py2: { - enabled: false, - embedded_launcher: false, - }, - py3: { - enabled: true, - embedded_launcher: false, - }, - }, + // Don't use embedded_launcher, atest will try (but may fail) to load libc++.so from + // host, because the test executable won't be able to find the needed libs via its + // runpath. test_options: { unit_test: true, },