Merge "releasetools: Prefer the avbtool specified in target_files."

This commit is contained in:
Tao Bao
2019-06-28 01:18:21 +00:00
committed by Gerrit Code Review
8 changed files with 51 additions and 28 deletions

View File

@@ -578,7 +578,7 @@ def GetAvbChainedPartitionArg(partition, info_dict, key=None):
"""
if key is None:
key = info_dict["avb_" + partition + "_key_path"]
pubkey_path = ExtractAvbPublicKey(key)
pubkey_path = ExtractAvbPublicKey(info_dict["avb_avbtool"], key)
rollback_index_location = info_dict[
"avb_" + partition + "_rollback_index_location"]
return "{}:{}:{}".format(partition, rollback_index_location, pubkey_path)
@@ -2239,10 +2239,11 @@ def ExtractPublicKey(cert):
return pubkey
def ExtractAvbPublicKey(key):
def ExtractAvbPublicKey(avbtool, key):
"""Extracts the AVB public key from the given public or private key.
Args:
avbtool: The AVB tool to use.
key: The input key file, which should be PEM-encoded public or private key.
Returns:
@@ -2250,7 +2251,7 @@ def ExtractAvbPublicKey(key):
"""
output = MakeTempFile(prefix='avb-', suffix='.avbpubkey')
RunAndCheckOutput(
['avbtool', 'extract_public_key', "--key", key, "--output", output])
[avbtool, 'extract_public_key', "--key", key, "--output", output])
return output