sign_apex --sign_tool
A new argument is a custom signing tool for APEX contents. When specified, apex_util invokes the tool with payload's key and payload directory. For now, the Virt APEX has its own custom signing tool (sign_virt_apex) to re-sign filesystem images in it. Bug: 193504286 Test: atest releasetools_test Test: m sign_apex sign_virt_apex Test: sign_apex --sign_tool sign_virt_apex --payload_key .. --container_key .. resigned.apex adb install resigned.apex reboot & vm run-app Change-Id: Ic4d369c2ba42a8295044a0a75e054dc8def93208
This commit is contained in:
@@ -187,3 +187,19 @@ class ApexUtilsTest(test_utils.ReleaseToolsTestCase):
|
||||
|
||||
self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
|
||||
signer.ProcessApexFile(apk_keys, self.payload_key)
|
||||
|
||||
@test_utils.SkipIfExternalToolsUnavailable()
|
||||
def test_ApexApkSigner_invokesCustomSignTool(self):
|
||||
apex_path = common.MakeTempFile(suffix='.apex')
|
||||
shutil.copy(self.apex_with_apk, apex_path)
|
||||
apk_keys = {'wifi-service-resources.apk': os.path.join(
|
||||
self.testdata_dir, 'testkey')}
|
||||
self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
|
||||
|
||||
# pass `false` as a sign_tool to see the invocation error
|
||||
with self.assertRaises(common.ExternalError) as cm:
|
||||
signer = apex_utils.ApexApkSigner(apex_path, None, None, sign_tool='false')
|
||||
signer.ProcessApexFile(apk_keys, self.payload_key)
|
||||
|
||||
the_exception = cm.exception
|
||||
self.assertIn('Failed to run command \'[\'false\'', the_exception.message)
|
||||
|
Reference in New Issue
Block a user