summaryrefslogtreecommitdiff
path: root/apexer/apexer.py
diff options
context:
space:
mode:
authorMohammad Samiul Islam <samiul@google.com>2020-02-26 11:37:29 +0000
committerMohammad Samiul Islam <samiul@google.com>2020-02-27 17:31:39 +0000
commit6b4bce2a4f3dc0d2e278ef30ae612162b664a483 (patch)
treee08618b9370d2ccaf11473f83c119d70e54fc4d1 /apexer/apexer.py
parent857738f5c8257c903659395cc47e5d6c21100406 (diff)
Add --payload_only flag to apexer
The flag instructs apexer to output only the payload instead of the complete apex. The payload is signed. The CL also contains new test to ensure the payload only output from apexer is same as what we get when we unzip an apex. Bug: 149993331 Test: atest --host apexer_test Change-Id: I545fcd6e84ea1eb7f55638ca51ff239912758930
Diffstat (limited to 'apexer/apexer.py')
-rw-r--r--apexer/apexer.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/apexer/apexer.py b/apexer/apexer.py
index aec0a3e..bbd2d43 100644
--- a/apexer/apexer.py
+++ b/apexer/apexer.py
@@ -154,6 +154,11 @@ def ParseArgs(argv):
'--build_info',
required=False,
help='Build information file to be used for default values.')
+ parser.add_argument(
+ '--payload_only',
+ action='store_true',
+ help='Outputs the payload image/zip only.'
+ )
return parser.parse_args(argv)
@@ -541,6 +546,12 @@ def CreateApex(args, work_dir):
cmd.extend(['-D', manifests_dir])
RunCommand(cmd, args.verbose)
+ if args.payload_only:
+ shutil.copyfile(img_file, args.output)
+ if (args.verbose):
+ print('Created (payload only) ' + args.output)
+ return True
+
# package the image file and APEX manifest as an APK.
# The AndroidManifest file is automatically generated if not given.
android_manifest_file = os.path.join(work_dir, 'AndroidManifest.xml')