Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: build/android/gyp/apk_install.py

Issue 13489004: Make apk_install.py check input md5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Installs an APK. 7 """Installs an APK.
8 8
9 """ 9 """
10 10
11 import optparse 11 import optparse
12 import os 12 import os
13 import subprocess 13 import subprocess
14 import sys 14 import sys
15 15
16 from util import build_utils 16 from util import build_utils
17 from util import md5_check
newt (away) 2013/04/04 03:07:08 is this a new file? did you forget to upload it?
cjhopman 2013/04/04 15:29:59 This was added with https://codereview.chromium.or
17 18
19 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..')
20 sys.path.append(BUILD_ANDROID_DIR)
21
22 from pylib import android_commands
18 23
19 def main(argv): 24 def main(argv):
20 parser = optparse.OptionParser() 25 parser = optparse.OptionParser()
21 parser.add_option('--android-sdk-tools', 26 parser.add_option('--android-sdk-tools',
22 help='Path to Android SDK tools.') 27 help='Path to Android SDK tools.')
23 parser.add_option('--apk-path', 28 parser.add_option('--apk-path',
24 help='Path to .apk to install.') 29 help='Path to .apk to install.')
25 parser.add_option('--stamp', 30 parser.add_option('--stamp',
26 help='Path to touch on success.') 31 help='Path to touch on success.')
27 options, _ = parser.parse_args() 32 options, _ = parser.parse_args()
28 33
29 # TODO(cjhopman): Should this install to all devices/be configurable? 34 # TODO(cjhopman): Should this install to all devices/be configurable?
30 install_cmd = [ 35 install_cmd = [
31 os.path.join(options.android_sdk_tools, 'adb'), 36 os.path.join(options.android_sdk_tools, 'adb'),
32 'install', '-r', 37 'install', '-r',
33 options.apk_path] 38 options.apk_path]
34 39
35 build_utils.CheckCallDie(install_cmd) 40 serial_number = android_commands.AndroidCommands().Adb().GetSerialNumber()
41 md5_stamp = '%s.%s.md5' % (options.apk_path, serial_number)
42
43 md5_checker = md5_check.Md5Checker(
44 stamp=md5_stamp, inputs=[options.apk_path], command=install_cmd)
45 if md5_checker.IsStale():
46 build_utils.CheckCallDie(install_cmd)
47 md5_checker.Write()
36 48
37 if options.stamp: 49 if options.stamp:
38 build_utils.Touch(options.stamp) 50 build_utils.Touch(options.stamp)
39 51
40 52
41 if __name__ == '__main__': 53 if __name__ == '__main__':
42 sys.exit(main(sys.argv)) 54 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698