Don't assume ordering of $(wildcard ...)
There are no guarantees on the order of the results from a call to the
wildcard function. In fact, the order usually changes between make 3.81
and make 4.0 (and kati).
Instead, sort the results of wildcard in each sepolicy directory, so
that directory order is preserved, but content ordering is reliable.
Change-Id: I1620f89bbdd2b2902f2e0c40526e893ccf5f7775
diff --git a/Android.mk b/Android.mk
index bad7257..aad7f80 100644
--- a/Android.mk
+++ b/Android.mk
@@ -28,7 +28,7 @@
# Builds paths for all policy files found in BOARD_SEPOLICY_DIRS.
# $(1): the set of policy name paths to build
-build_policy = $(foreach type, $(1), $(wildcard $(addsuffix /$(type), $(LOCAL_PATH) $(BOARD_SEPOLICY_DIRS))))
+build_policy = $(foreach type, $(1), $(foreach file, $(addsuffix /$(type), $(LOCAL_PATH) $(BOARD_SEPOLICY_DIRS)), $(sort $(wildcard $(file)))))
sepolicy_build_files := security_classes \
initial_sids \
@@ -116,7 +116,7 @@
include $(BUILD_SYSTEM)/base_rules.mk
exp_sepolicy_build_files :=\
- $(wildcard $(addprefix $(LOCAL_PATH)/, $(sepolicy_build_files)))
+ $(foreach file, $(addprefix $(LOCAL_PATH)/, $(sepolicy_build_files)), $(sort $(wildcard $(file))))
$(LOCAL_BUILT_MODULE): PRIVATE_MLS_SENS := $(MLS_SENS)
$(LOCAL_BUILT_MODULE): PRIVATE_MLS_CATS := $(MLS_CATS)