Add a key directory argument to insertkeys.py

This allows us to better integrate key selection with our existing
build process.

Change-Id: I6e3eb5fbbfffb8e31c5edcf16f74df7c38abe537
This commit is contained in:
Geremy Condra 2013-03-27 19:33:02 -07:00 committed by repo sync
parent 8abf01ac33
commit 020b5ff631
3 changed files with 13 additions and 10 deletions

View File

@ -179,7 +179,7 @@ ALL_MAC_PERMS_FILES := $(call build_policy, $(LOCAL_MODULE))
$(LOCAL_BUILT_MODULE) : $(mac_perms_keys.tmp) $(HOST_OUT_EXECUTABLES)/insertkeys.py $(ALL_MAC_PERMS_FILES)
@mkdir -p $(dir $@)
$(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -c $(TOP) $< -o $@ $(ALL_MAC_PERMS_FILES)
$(hide) $(HOST_OUT_EXECUTABLES)/insertkeys.py -t $(TARGET_BUILD_VARIANT) -d $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE)) -c $(TOP) $< -o $@ $(ALL_MAC_PERMS_FILES)
mac_perms_keys.tmp :=
##################################

View File

@ -9,17 +9,17 @@
#
[@PLATFORM]
ALL : build/target/product/security/platform.x509.pem
ALL : platform.x509.pem
[@MEDIA]
ALL : build/target/product/security/media.x509.pem
ALL : media.x509.pem
[@SHARED]
ALL : build/target/product/security/shared.x509.pem
ALL : shared.x509.pem
# Example of ALL TARGET_BUILD_VARIANTS
[@RELEASE]
ENG : build/target/product/security/testkey.x509.pem
USER : build/target/product/security/testkey.x509.pem
USERDEBUG : build/target/product/security/testkey.x509.pem
ENG : testkey.x509.pem
USER : testkey.x509.pem
USERDEBUG : testkey.x509.pem

View File

@ -65,7 +65,7 @@ class ParseConfig(ConfigParser.ConfigParser):
# This must be lowercase
OPTION_WILDCARD_TAG = "all"
def generateKeyMap(self, target_build_variant):
def generateKeyMap(self, target_build_variant, key_directory):
keyMap = dict()
@ -87,7 +87,7 @@ class ParseConfig(ConfigParser.ConfigParser):
if tag in keyMap:
sys.exit("Duplicate tag detected " + tag)
path = self.get(tag, option)
path = os.path.join(key_directory, self.get(tag, option))
keyMap[tag] = GenerateKeys(path)
@ -188,6 +188,9 @@ if __name__ == "__main__":
parser.add_option("-t", "--target-build-variant", default="eng", dest="target_build_variant",
help="Specify the TARGET_BUILD_VARIANT, defaults to eng")
parser.add_option("-d", "--key-directory", default="", dest="key_directory",
help="Specify a parent directory for keys")
(options, args) = parser.parse_args()
if len(args) < 2:
@ -205,7 +208,7 @@ if __name__ == "__main__":
logging.info("Setting output file to: " + options.output_file)
# Generate the key list
key_map = config.generateKeyMap(options.target_build_variant.lower())
key_map = config.generateKeyMap(options.target_build_variant.lower(), options.key_directory)
logging.info("Generate key map:")
for k in key_map:
logging.info(k + " : " + str(key_map[k]))