Make the partition= tag optional.

Since we might use ToT release tools to sign a package
generated by an older build, we make the new
`partition=` tag optional. This also means we need to be
careful to use non-greedy regex matching.

Bug: 153133823
Test: python3 -m unittest
Test: input with and without the new `partition=` tag
Test: new test_ReadApkCerts_WithWithoutOptionalFields
Change-Id: Ic57efd34e745ad302ae17150c6f2318f0b4524cb
Merged-In: Ic57efd34e745ad302ae17150c6f2318f0b4524cb
This commit is contained in:
Bill Peckham
2020-04-03 15:36:23 -07:00
parent aaf43c8d5a
commit 96c9e6ed00
5 changed files with 44 additions and 12 deletions

View File

@@ -1082,8 +1082,8 @@ def ReadApexKeysInfo(tf_zip):
r'public_key="(?P<PAYLOAD_PUBLIC_KEY>.*)"\s+'
r'private_key="(?P<PAYLOAD_PRIVATE_KEY>.*)"\s+'
r'container_certificate="(?P<CONTAINER_CERT>.*)"\s+'
r'container_private_key="(?P<CONTAINER_PRIVATE_KEY>.*)"\s+'
r'partition="(?P<PARTITION>.*)"$',
r'container_private_key="(?P<CONTAINER_PRIVATE_KEY>.*?)"'
r'(\s+partition="(?P<PARTITION>.*?)")?$',
line)
if not matches:
continue