Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f460a638 authored by Justin Yun's avatar Justin Yun
Browse files

Define file_diff allowlist for the next builds.

The current allowlist is based on trunk build configuration. the next
configuration may have more diffs. Define more allowlist for the next
build.

The allowlist can be empty when trunk goes to next.

Bug: 346873717
Test: lunch aosp_cf_x86_64_phone-next-userdebug && m
Change-Id: I47642c6b6f564b041914bccf192a9d9295eb3da0
parent d356d483
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -3567,14 +3567,24 @@ ifneq ($(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE),)
file_list_diff := $(HOST_OUT_EXECUTABLES)/file_list_diff$(HOST_EXECUTABLE_SUFFIX)
file_list_diff := $(HOST_OUT_EXECUTABLES)/file_list_diff$(HOST_EXECUTABLE_SUFFIX)
system_file_diff_timestamp := $(systemimage_intermediates)/file_diff.timestamp
system_file_diff_timestamp := $(systemimage_intermediates)/file_diff.timestamp


# The build configuration to build the REL version may have more files to allow.
# Use allowlist_next in addition to the allowlist in this case.
system_file_diff_allowlist_next :=
ifeq (REL,$(PLATFORM_VERSION_CODENAME))
system_file_diff_allowlist_next := $(ALL_MODULES.system_image_diff_allowlist_next.INSTALLED)
$(system_file_diff_timestamp): PRIVATE_ALLOWLIST_NEXT := $(system_file_diff_allowlist_next)
endif
$(system_file_diff_timestamp): \
$(system_file_diff_timestamp): \
	    $(systemimage_intermediates)/file_list.txt \
	    $(systemimage_intermediates)/file_list.txt \
	    $(ALL_MODULES.$(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE).FILESYSTEM_FILELIST) \
	    $(ALL_MODULES.$(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE).FILESYSTEM_FILELIST) \
	    $(ALL_MODULES.system_image_diff_allowlist.INSTALLED) \
	    $(ALL_MODULES.system_image_diff_allowlist.INSTALLED) \
	    $(system_file_diff_allowlist_next) \
	    $(file_list_diff)
	    $(file_list_diff)
	$(file_list_diff) $(systemimage_intermediates)/file_list.txt \
	$(file_list_diff) $(systemimage_intermediates)/file_list.txt \
	  $(ALL_MODULES.$(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE).FILESYSTEM_FILELIST) \
	  $(ALL_MODULES.$(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE).FILESYSTEM_FILELIST) \
	  $(ALL_MODULES.system_image_diff_allowlist.INSTALLED) $(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE)
	  $(PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE) \
	  --allowlists $(ALL_MODULES.system_image_diff_allowlist.INSTALLED) \
	  $(PRIVATE_ALLOWLIST_NEXT)
	touch $@
	touch $@


$(BUILT_SYSTEMIMAGE): $(system_file_diff_timestamp)
$(BUILT_SYSTEMIMAGE): $(system_file_diff_timestamp)
+6 −1
Original line number Original line Diff line number Diff line
@@ -25,3 +25,8 @@ prebuilt_etc_host {
    name: "system_image_diff_allowlist",
    name: "system_image_diff_allowlist",
    src: "allowlist",
    src: "allowlist",
}
}

prebuilt_etc_host {
    name: "system_image_diff_allowlist_next",
    src: "allowlist_next",
}
+15 −0
Original line number Original line Diff line number Diff line
# Allowlist only for the next release configuration.
# TODO(b/369678122): The list will be cleared when the trunk configurations are
# available to the next.

# KATI only installed files
framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.odex
framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.odex.fsv_meta
framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.vdex
framework/oat/x86_64/apex@com.android.compos@javalib@service-compos.jar@classes.vdex.fsv_meta

# Soong only installed files
etc/aconfig/flag.info
etc/aconfig/flag.map
etc/aconfig/flag.val
etc/aconfig/package.map
+9 −6
Original line number Original line Diff line number Diff line
@@ -19,13 +19,16 @@ COLOR_WARNING = '\033[93m'
COLOR_ERROR = '\033[91m'
COLOR_ERROR = '\033[91m'
COLOR_NORMAL = '\033[0m'
COLOR_NORMAL = '\033[0m'


def find_unique_items(kati_installed_files, soong_installed_files, allowlist, system_module_name):
def find_unique_items(kati_installed_files, soong_installed_files, system_module_name, allowlists):
    with open(kati_installed_files, 'r') as kati_list_file, \
    with open(kati_installed_files, 'r') as kati_list_file, \
            open(soong_installed_files, 'r') as soong_list_file, \
            open(soong_installed_files, 'r') as soong_list_file:
            open(allowlist, 'r') as allowlist_file:
        kati_files = set(kati_list_file.read().split())
        kati_files = set(kati_list_file.read().split())
        soong_files = set(soong_list_file.read().split())
        soong_files = set(soong_list_file.read().split())
        allowed_files = set(filter(lambda x: len(x), map(lambda x: x.lstrip().split('#',1)[0].rstrip() , allowlist_file.read().split('\n'))))

    allowed_files = set()
    for allowlist in allowlists:
        with open(allowlist, 'r') as allowlist_file:
            allowed_files.update(set(filter(lambda x: len(x), map(lambda x: x.lstrip().split('#',1)[0].rstrip() , allowlist_file.read().split('\n')))))


    def is_unknown_diff(filepath):
    def is_unknown_diff(filepath):
        return not filepath in allowed_files
        return not filepath in allowed_files
@@ -60,8 +63,8 @@ if __name__ == '__main__':


    parser.add_argument('kati_installed_file_list')
    parser.add_argument('kati_installed_file_list')
    parser.add_argument('soong_installed_file_list')
    parser.add_argument('soong_installed_file_list')
    parser.add_argument('allowlist')
    parser.add_argument('system_module_name')
    parser.add_argument('system_module_name')
    parser.add_argument('--allowlists', nargs='+')
    args = parser.parse_args()
    args = parser.parse_args()


    find_unique_items(args.kati_installed_file_list, args.soong_installed_file_list, args.allowlist, args.system_module_name)
    find_unique_items(args.kati_installed_file_list, args.soong_installed_file_list, args.system_module_name, args.allowlists)
 No newline at end of file
 No newline at end of file