Merge lp:~doanac/utah/remove-FLIPPED into lp:utah

Proposed by Andy Doan
Status: Merged
Merged at revision: 963
Proposed branch: lp:~doanac/utah/remove-FLIPPED
Merge into: lp:utah
Diff against target: 137 lines (+11/-37)
2 files modified
examples/run_utah_phablet.py (+1/-13)
utah/provisioning/touch.py (+10/-24)
To merge this branch: bzr merge lp:~doanac/utah/remove-FLIPPED
Reviewer Review Type Date Requested Status
Paul Larson Approve
Review via email: mp+172892@code.launchpad.net

Description of the change

removes the FLIPPED logic as this has now become the default method in touch images

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/run_utah_phablet.py'
2--- examples/run_utah_phablet.py 2013-07-02 20:32:20 +0000
3+++ examples/run_utah_phablet.py 2013-07-03 19:59:27 +0000
4@@ -19,7 +19,6 @@
5 from __future__ import print_function
6
7 import argparse
8-import datetime
9 import os
10 import socket
11 import subprocess
12@@ -33,7 +32,6 @@
13 from utah import template
14
15 CLIENT_PROBES_DIR = '/tmp/utah-probes'
16-FLIPPED = os.environ.get('FLIPPED', False)
17
18
19 def phablet_tools_errors(f):
20@@ -56,8 +54,6 @@
21 cmd.extend(['-r', args.revision])
22 if args.uri:
23 cmd.extend(['-u', args.uri])
24- if FLIPPED:
25- cmd.extend(['--flipped'])
26 if args.device:
27 cmd.extend(['-d', args.device])
28
29@@ -69,14 +65,6 @@
30 device.adb_root()
31 device.wait_for_device()
32 print()
33- if not FLIPPED:
34- # make the utah-client and jenkins job happy by printing and setting
35- # a build-date for this
36- d = device.run_android('getprop ro.build.date.utc').strip()
37- d = datetime.date.fromtimestamp(int(d)).strftime('%Y%m%d')
38- print('= setting build_id to {}'.format(d))
39- d = '({})'.format(d)
40- device.create_file_ubuntu('/var/log/installer/media-info', d)
41
42
43 @phablet_tools_errors
44@@ -324,7 +312,7 @@
45 if args.env:
46 args.utah_cmd = '{} {}'.format(args.env, args.utah_cmd)
47
48- if not args.skip_install and device.flipped() and not args.device:
49+ if not args.skip_install and not args.device and not device.detect_type():
50 print('ERROR: --device option required for provisioning')
51 sys.exit(1)
52
53
54=== modified file 'utah/provisioning/touch.py'
55--- utah/provisioning/touch.py 2013-07-01 21:58:02 +0000
56+++ utah/provisioning/touch.py 2013-07-03 19:59:27 +0000
57@@ -17,7 +17,6 @@
58
59 import atexit
60 import contextlib
61-import os
62 import sys
63 import subprocess
64 import tempfile
65@@ -26,8 +25,6 @@
66
67 import utah.process as process
68
69-FLIPPED = os.environ.get('FLIPPED', False)
70-
71
72 class ADBShellError(Exception):
73
74@@ -108,9 +105,6 @@
75 :rtype: string
76
77 """
78- if not FLIPPED:
79- path = 'PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin'
80- cmd = 'chroot /data/ubuntu /usr/bin/env -i {} {}'.format(path, cmd)
81 return self._adb_shell(cmd)
82
83 def run_android(self, cmd, stream=True):
84@@ -120,26 +114,20 @@
85 :rtype: string
86
87 """
88- if FLIPPED:
89- cmd = 'android-chroot {}'.format(cmd)
90+ cmd = 'android-chroot {}'.format(cmd)
91 return self._adb_shell(cmd, stream)
92
93- def flipped(self):
94- """determine whether or not Ubuntu is the primary os."""
95- try:
96- self._adb_shell('which android-chroot', stream=False)
97- except ADBShellError:
98- return False
99- return True
100-
101- def _ubuntu_path(self, path):
102- if FLIPPED:
103- return path
104- return '/data/ubuntu{}'.format(path)
105+ def detect_type(self):
106+ """determine the device type."""
107+ device = self._adb_shell('getprop ro.cm.device', stream=False).strip()
108+ # Check Android property
109+ if not device:
110+ device = self._adb_shell(
111+ 'getprop ro.product.device', stream=False).strip()
112+ return device
113
114 def create_file_ubuntu(self, pathname, contents, mode=None):
115 """Create a file in the ubuntu file system."""
116- pathname = self._ubuntu_path(pathname)
117 with tempfile.NamedTemporaryFile() as f:
118 f.write(contents)
119 f.flush()
120@@ -149,7 +137,6 @@
121
122 def get_file_ubuntu(self, tgt_file, dst_dir):
123 """Copy a file from the ubuntu file system to host directory."""
124- tgt_file = self._ubuntu_path(tgt_file)
125 self._adb_operation(['pull', tgt_file, dst_dir])
126
127 @contextlib.contextmanager
128@@ -158,8 +145,7 @@
129 cmd = ['adb']
130 if self._serial:
131 cmd.extend(['-s', self._serial])
132- cmd.extend(
133- ['shell', 'tail', '-f', self._ubuntu_path('/var/log/syslog')])
134+ cmd.extend(['shell', 'tail', '-f', '/var/log/syslog'])
135 p = subprocess.Popen(cmd)
136 atexit.register(p.terminate) # incase _chrooted ends in an error
137 try:

Subscribers

People subscribed via source and target branches

to all changes: