Revert "Check added types/attributes on freeze test too"

This reverts commit a6a3726ed2.

Reason for revert: Breaks an internal build (see b/329217616)

Bug: 329217616
Bug: 296875906
Change-Id: Iac204a3e7501cd2d0e691f10b5bca88586f315aa
This commit is contained in:
Roland Levillain 2024-03-12 15:32:12 +00:00 committed by Gerrit Code Review
parent a6a3726ed2
commit 590bbddbd0

View file

@ -37,46 +37,20 @@ def do_main():
current_policy = mini_parser.MiniCilParser(options.current)
prebuilt_policy = mini_parser.MiniCilParser(options.prebuilt)
current_policy.typeattributes = set(filter(lambda x: "base_typeattr_" not in x,
current_policy.typeattributes))
prebuilt_policy.typeattributes = set(filter(lambda x: "base_typeattr_" not in x,
prebuilt_policy.typeattributes))
results = ""
removed_types = prebuilt_policy.types - current_policy.types
added_types = current_policy.types - prebuilt_policy.types
removed_attributes = prebuilt_policy.typeattributes - current_policy.typeattributes
added_attributes = current_policy.typeattributes - prebuilt_policy.typeattributes
removed_attributes = set(filter(lambda x: "base_typeattr_" not in x, removed_attributes))
if removed_types:
results += "The following public types were removed:\n" + ", ".join(removed_types) + "\n"
if added_types:
results += "The following public types were added:\n" + ", ".join(added_types) + "\n"
if removed_attributes:
results += "The following public attributes were removed:\n" + ", ".join(removed_attributes) + "\n"
if added_attributes:
results += "The following public attributes were added:\n" + ", ".join(added_attributes) + "\n"
if results:
sys.exit(f'''{results}
******************************
You have tried to change system/sepolicy/public after vendor API freeze.
To make these errors go away, you have two choices:
1. You can flag-guard types and attributes listed above, so they won't be
included to the release build. See examples of how to flag-guard them:
https://android-review.googlesource.com/2854391
https://android-review.googlesource.com/2967637
2. You can update prebuilts by executing the following command:
$ cd $ANDROID_BUILD_TOP
$ cp -r system/sepolicy/public system/sepolicy/private \\
system/sepolicy/prebuilts/api/$(get_build_var BOARD_API_LEVEL)
To submit the revised prebuilts to the main Android repository,
you will need approval.
******************************
''')
if len(results) > 0:
sys.exit(results)
if __name__ == '__main__':
do_main()