Commit 96f62d4a authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

apk_operations.py: Fix print-certs command failing for --full-certs

Also fixes ability to run commands on apks not through wrapper scripts
(must have broken a while ago).

Tested with:
build/android/apk_operations.py print-certs --apk-path AndroidWebview.apk --full-cert

Bug: 1065270
Change-Id: I7aa047fd3570c46c1fde4f6f9e8de1895f10bae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135335
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756339}
parent 3cd281c1
...@@ -1620,7 +1620,7 @@ class _PrintCertsCommand(_Command): ...@@ -1620,7 +1620,7 @@ class _PrintCertsCommand(_Command):
raise Exception( raise Exception(
'Cannot print full certificate because apk is not V1 signed.') 'Cannot print full certificate because apk is not V1 signed.')
cmd = [keytool, '-printcert', '-jarfile', '-rfc', self.apk_helper.path] cmd = [keytool, '-printcert', '-jarfile', self.apk_helper.path, '-rfc']
# Redirect stderr to hide a keytool warning about using non-standard # Redirect stderr to hide a keytool warning about using non-standard
# keystore format. # keystore format.
full_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) full_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
...@@ -1816,7 +1816,8 @@ def _ParseArgs(parser, from_wrapper_script, is_bundle): ...@@ -1816,7 +1816,8 @@ def _ParseArgs(parser, from_wrapper_script, is_bundle):
def _RunInternal(parser, output_directory=None, bundle_generation_info=None): def _RunInternal(parser, output_directory=None, bundle_generation_info=None):
colorama.init() colorama.init()
parser.set_defaults(output_directory=output_directory) parser.set_defaults(
additional_apk_paths=None, output_directory=output_directory)
from_wrapper_script = bool(output_directory) from_wrapper_script = bool(output_directory)
args = _ParseArgs(parser, from_wrapper_script, bool(bundle_generation_info)) args = _ParseArgs(parser, from_wrapper_script, bool(bundle_generation_info))
run_tests_helper.SetLogLevel(args.verbose_count) run_tests_helper.SetLogLevel(args.verbose_count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment