Skip to content
Snippets Groups Projects
Commit 52f3c178 authored by Sandeep Patil's avatar Sandeep Patil Committed by android-build-merger
Browse files

sepolicy_version: change current version to NN.m format

am: 9a3a6a81

Change-Id: If95f7f3f75f213549a15cdab969073a25b9776c3
parents 84a1cd0d 9a3a6a81
No related branches found
No related tags found
No related merge requests found
...@@ -92,11 +92,15 @@ PLAT_PRIVATE_POLICY := $(LOCAL_PATH)/private ...@@ -92,11 +92,15 @@ PLAT_PRIVATE_POLICY := $(LOCAL_PATH)/private
PLAT_VENDOR_POLICY := $(LOCAL_PATH)/vendor PLAT_VENDOR_POLICY := $(LOCAL_PATH)/vendor
REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask
# The current version of the platform sepolicy.
# TODO: This must be fetched from build system after b/36783775
PLAT_PUBLIC_POLICY_CURRENT_VERSION := 100000.0
# TODO: move to README when doing the README update and finalizing versioning. # TODO: move to README when doing the README update and finalizing versioning.
# BOARD_SEPOLICY_VERS should contain the platform version identifier # BOARD_SEPOLICY_VERS must take the format "NN.m" and contain the sepolicy
# corresponding to the platform on which the non-platform policy is to be # version identifier corresponding to the sepolicy on which the non-platform
# based. If unspecified, this will build against the current public platform # policy is to be based. If unspecified, this will build against the current
# policy in tree. # public platform policy in tree
# BOARD_SEPOLICY_VERS_DIR should contain the public platform policy which # BOARD_SEPOLICY_VERS_DIR should contain the public platform policy which
# is associated with the given BOARD_SEPOLICY_VERS. The policy therein will be # is associated with the given BOARD_SEPOLICY_VERS. The policy therein will be
# versioned according to the BOARD_SEPOLICY_VERS identifier and included as # versioned according to the BOARD_SEPOLICY_VERS identifier and included as
...@@ -104,7 +108,8 @@ REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask ...@@ -104,7 +108,8 @@ REQD_MASK_POLICY := $(LOCAL_PATH)/reqd_mask
# platform policy does not break non-platform policy. # platform policy does not break non-platform policy.
ifndef BOARD_SEPOLICY_VERS ifndef BOARD_SEPOLICY_VERS
$(warning BOARD_SEPOLICY_VERS not specified, assuming current platform version) $(warning BOARD_SEPOLICY_VERS not specified, assuming current platform version)
BOARD_SEPOLICY_VERS := current # The default platform policy version.
BOARD_SEPOLICY_VERS := $(PLAT_PUBLIC_POLICY_CURRENT_VERSION)
BOARD_SEPOLICY_VERS_DIR := $(PLAT_PUBLIC_POLICY) BOARD_SEPOLICY_VERS_DIR := $(PLAT_PUBLIC_POLICY)
else else
ifndef BOARD_SEPOLICY_VERS_DIR ifndef BOARD_SEPOLICY_VERS_DIR
...@@ -319,13 +324,14 @@ include $(BUILD_SYSTEM)/base_rules.mk ...@@ -319,13 +324,14 @@ include $(BUILD_SYSTEM)/base_rules.mk
# auto-generate the mapping file for current platform policy, since it needs to # auto-generate the mapping file for current platform policy, since it needs to
# track platform policy development # track platform policy development
current_mapping.cil := $(intermediates)/mapping/current.cil current_mapping.cil := $(intermediates)/mapping/$(PLAT_PUBLIC_POLICY_CURRENT_VERSION).cil
$(current_mapping.cil) : PRIVATE_VERS := $(BOARD_SEPOLICY_VERS) $(current_mapping.cil) : PRIVATE_VERS := $(PLAT_PUBLIC_POLICY_CURRENT_VERSION)
$(current_mapping.cil) : $(plat_pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy $(current_mapping.cil) : $(plat_pub_policy.cil) $(HOST_OUT_EXECUTABLES)/version_policy
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@ $(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@
ifeq ($(BOARD_SEPOLICY_VERS), current)
ifeq ($(BOARD_SEPOLICY_VERS), $(PLAT_PUBLIC_POLICY_CURRENT_VERSION))
mapping_policy_nvr := $(current_mapping.cil) mapping_policy_nvr := $(current_mapping.cil)
else else
mapping_policy_nvr := $(addsuffix /$(BOARD_SEPOLICY_VERS).cil, $(PLAT_PRIVATE_POLICY)/mapping) mapping_policy_nvr := $(addsuffix /$(BOARD_SEPOLICY_VERS).cil, $(PLAT_PRIVATE_POLICY)/mapping)
...@@ -562,13 +568,13 @@ plat_policy.recovery.conf := ...@@ -562,13 +568,13 @@ plat_policy.recovery.conf :=
# auto-generate the mapping file for current platform policy, since it needs to # auto-generate the mapping file for current platform policy, since it needs to
# track platform policy development # track platform policy development
current_mapping.recovery.cil := $(intermediates)/mapping/current.recovery.cil current_mapping.recovery.cil := $(intermediates)/mapping/$(PLAT_PUBLIC_POLICY_CURRENT_VERSION).recovery.cil
$(current_mapping.recovery.cil) : PRIVATE_VERS := $(BOARD_SEPOLICY_VERS) $(current_mapping.recovery.cil) : PRIVATE_VERS := $(PLAT_PUBLIC_POLICY_CURRENT_VERSION)
$(current_mapping.recovery.cil) : $(plat_pub_policy.recovery.cil) $(HOST_OUT_EXECUTABLES)/version_policy $(current_mapping.recovery.cil) : $(plat_pub_policy.recovery.cil) $(HOST_OUT_EXECUTABLES)/version_policy
@mkdir -p $(dir $@) @mkdir -p $(dir $@)
$(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@ $(hide) $(HOST_OUT_EXECUTABLES)/version_policy -b $< -m -n $(PRIVATE_VERS) -o $@
ifeq ($(BOARD_SEPOLICY_VERS), current) ifeq ($(BOARD_SEPOLICY_VERS), $(PLAT_PUBLIC_POLICY_CURRENT_VERSION))
mapping_policy_nvr.recovery := $(current_mapping.recovery.cil) mapping_policy_nvr.recovery := $(current_mapping.recovery.cil)
else else
mapping_policy_nvr.recovery := $(addsuffix /$(BOARD_SEPOLICY_VERS).recovery.cil, \ mapping_policy_nvr.recovery := $(addsuffix /$(BOARD_SEPOLICY_VERS).recovery.cil, \
......
...@@ -87,6 +87,7 @@ int main(int argc, char *argv[]) ...@@ -87,6 +87,7 @@ int main(int argc, char *argv[])
char *base = NULL; char *base = NULL;
char *tgt_policy = NULL; char *tgt_policy = NULL;
char *num = NULL; char *num = NULL;
char *dot;
char *output = NULL; char *output = NULL;
struct cil_db *base_db = NULL; struct cil_db *base_db = NULL;
struct cil_db *out_db = NULL; struct cil_db *out_db = NULL;
...@@ -138,6 +139,13 @@ int main(int argc, char *argv[]) ...@@ -138,6 +139,13 @@ int main(int argc, char *argv[])
usage(argv[0]); usage(argv[0]);
} }
/* policy language doesn't like '.', so replace them with '_' in mapping version */
dot = num;
while ((dot = strchr(dot, '.')) != NULL) {
*dot = '_';
++dot;
}
if (mapping && tgt_policy) { if (mapping && tgt_policy) {
fprintf(stderr, "Please select only one mode between --mapping and --tgt_policy\n"); fprintf(stderr, "Please select only one mode between --mapping and --tgt_policy\n");
usage(argv[0]); usage(argv[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment