am 15b3ceda: Add BOARD_SEPOLICY_IGNORE
* commit '15b3ceda5cd0fea1f0b5b19d4795d7290a75b39d':
Add BOARD_SEPOLICY_IGNORE
diff --git a/Android.mk b/Android.mk
index 44c1ef6..aad5451 100644
--- a/Android.mk
+++ b/Android.mk
@@ -25,7 +25,8 @@
$(error Ambiguous request for sepolicy $(pf). Appears in both \
BOARD_SEPOLICY_REPLACE and BOARD_SEPOLICY_UNION), \
) \
- $(eval _paths := $(wildcard $(addsuffix /$(pf), $(BOARD_SEPOLICY_DIRS)))) \
+ $(eval _paths := $(filter-out $(BOARD_SEPOLICY_IGNORE), \
+ $(wildcard $(addsuffix /$(pf), $(BOARD_SEPOLICY_DIRS))))) \
$(eval _occurrences := $(words $(_paths))) \
$(if $(filter 0,$(_occurrences)), \
$(error No sepolicy file found for $(pf) in $(BOARD_SEPOLICY_DIRS)), \
@@ -45,15 +46,17 @@
# product variables.
# $(1): the set of policy name paths to build
build_policy = $(foreach type, $(1), \
- $(foreach expanded_type, $(notdir $(wildcard $(addsuffix /$(type), $(LOCAL_PATH)))), \
- $(if $(filter $(expanded_type), $(BOARD_SEPOLICY_REPLACE)), \
- $(wildcard $(addsuffix $(expanded_type), $(sort $(dir $(sepolicy_replace_paths))))), \
- $(LOCAL_PATH)/$(expanded_type) \
+ $(filter-out $(BOARD_SEPOLICY_IGNORE), \
+ $(foreach expanded_type, $(notdir $(wildcard $(addsuffix /$(type), $(LOCAL_PATH)))), \
+ $(if $(filter $(expanded_type), $(BOARD_SEPOLICY_REPLACE)), \
+ $(wildcard $(addsuffix $(expanded_type), $(sort $(dir $(sepolicy_replace_paths))))), \
+ $(LOCAL_PATH)/$(expanded_type) \
+ ) \
) \
- ) \
- $(foreach union_policy, $(wildcard $(addsuffix /$(type), $(BOARD_SEPOLICY_DIRS))), \
- $(if $(filter $(notdir $(union_policy)), $(BOARD_SEPOLICY_UNION)), \
- $(union_policy), \
+ $(foreach union_policy, $(wildcard $(addsuffix /$(type), $(BOARD_SEPOLICY_DIRS))), \
+ $(if $(filter $(notdir $(union_policy)), $(BOARD_SEPOLICY_UNION)), \
+ $(union_policy), \
+ ) \
) \
) \
)
diff --git a/README b/README
index 5cba383..3cdd01a 100644
--- a/README
+++ b/README
@@ -8,6 +8,7 @@
1. BOARD_SEPOLICY_REPLACE
2. BOARD_SEPOLICY_UNION
3. BOARD_SEPOLICY_DIRS
+4. BOARD_SEPOLICY_IGNORE
The variables should be set in the BoardConfig.mk file in
the device or vendor directories.
@@ -38,7 +39,9 @@
eg.) if you specify shell.te in BOARD_SEPOLICY_REPLACE and
BOARD_SEPOLICY_DIRS is set to
"vendor/widget/common/sepolicy device/widget/x/sepolicy" and shell.te
-appears in both locations, it is an error.
+appears in both locations, it is an error. Unless it is in
+BOARD_SEPOLICY_IGNORE to be filtered out. See BOARD_SEPOLICY_IGNORE
+for more details.
It is an error to specify the same file name in both
BOARD_POLICY_REPLACE and BOARD_POLICY_UNION.
@@ -46,7 +49,23 @@
It is an error to specify a BOARD_SEPOLICY_DIRS that has no entries when
specifying BOARD_SEPOLICY_REPLACE.
-Example Usage:
+BOARD_SEPOLICY_IGNORE is a list of paths (directory + filename) of
+files that are not to be included in the resulting policy. This list
+is passed to filter-out to remove any paths you may want to ignore. This
+is useful if you have numerous config directories that contain a file
+and you want to NOT include a particular file in your resulting
+policy file, either by UNION or REPLACE.
+Eg.) Suppose the follwoing:
+ BOARD_SEPOLICY_DIRS := X Y
+ BOARD_SEPOLICY_REPLACE := A
+ BOARD_SEPOLICY_IGNORE := X/A
+
+ Directories X and Y contain A.
+
+ The resulting policy is created by using Y/A only, thus X/A was
+ ignored.
+
+Example BoardConfig.mk Usage:
From the Tuna device BoardConfig.mk, device/samsung/tuna/BoardConfig.mk
BOARD_SEPOLICY_DIRS := \