Drop BOARD_SEPOLICY_UNION.
As suggested in the comments on
https://android-review.googlesource.com/#/c/141560/
drop BOARD_SEPOLICY_UNION and simplify the build_policy logic.
Union all files found under BOARD_SEPOLICY_DIRS.
Unlike BOARD_SEPOLICY_REPLACE/IGNORE, on which we trigger an error
to catch any lingering uses and force updating of the BoardConfig.mk
files, we only warn on uses of BOARD_SEPOLICY_UNION to avoid
breaking the build until all device BoardConfig*.mk files have been
updated, and since they should be harmless - the files will be unioned
regardless.
Change-Id: I4214893c999c23631f5456cb1b8edd59771ef13b
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
diff --git a/Android.mk b/Android.mk
index f7d103c..3635a01 100644
--- a/Android.mk
+++ b/Android.mk
@@ -18,28 +18,13 @@
$(error BOARD_SEPOLICY_IGNORE is no longer supported; please remove from your BoardConfig.mk or other .mk file.)
endif
-# Quick edge case error detection for BOARD_SEPOLICY_UNION.
-# This ensures that a requested union file exists somewhere
-# in one of the listed BOARD_SEPOLICY_DIRS.
-$(foreach pf, $(BOARD_SEPOLICY_UNION), \
- $(if $(filter 0, $(words $(wildcard $(addsuffix /$(pf), $(BOARD_SEPOLICY_DIRS))))), \
- $(error No sepolicy file found for $(pf) in $(BOARD_SEPOLICY_DIRS)), \
- ) \
-)
+ifdef BOARD_SEPOLICY_UNION
+$(warning BOARD_SEPOLICY_UNION is no longer required - all files found in BOARD_SEPOLICY_DIRS are implicitly unioned; please remove from your BoardConfig.mk or other .mk file.)
+endif
-# Builds paths for all requested policy files w.r.t
-# BOARD_SEPOLICY_UNION variables.
+# 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), \
- $(foreach expanded_type, $(notdir $(wildcard $(addsuffix /$(type), $(LOCAL_PATH)))), \
- $(LOCAL_PATH)/$(expanded_type) \
- ) \
- $(foreach union_policy, $(wildcard $(addsuffix /$(type), $(BOARD_SEPOLICY_DIRS))), \
- $(if $(filter $(notdir $(union_policy)), $(BOARD_SEPOLICY_UNION)), \
- $(union_policy), \
- ) \
- ) \
- )
+build_policy = $(foreach type, $(1), $(wildcard $(addsuffix /$(type), $(LOCAL_PATH) $(BOARD_SEPOLICY_DIRS))))
sepolicy_build_files := security_classes \
initial_sids \