Merge lp:~sergiusens/phablet-tools/android into lp:phablet-tools

Proposed by Sergio Schvezov
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 179
Merged at revision: 181
Proposed branch: lp:~sergiusens/phablet-tools/android
Merge into: lp:phablet-tools
Diff against target: 135 lines (+25/-56)
4 files modified
phabletutils/device.py (+1/-1)
phabletutils/downloads.py (+21/-0)
phabletutils/environment.py (+0/-53)
phabletutils/projects.py (+3/-2)
To merge this branch: bzr merge lp:~sergiusens/phablet-tools/android
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+183532@code.launchpad.net

Commit message

Removing dead code, moving ubuntu_stamp retrieval and minor fixes to flashing plain android.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

141 - adb.reboot(bootloader=True)

You shouldn't remove this line, otherwise flash will fail when using -b as it'll stop waiting for the device to respond (fastboot).

review: Needs Fixing
lp:~sergiusens/phablet-tools/android updated
179. By Sergio Schvezov

Adding back reboot bootloader command for bootstrapping.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phabletutils/device.py'
2--- phabletutils/device.py 2013-08-13 02:15:17 +0000
3+++ phabletutils/device.py 2013-09-05 14:35:54 +0000
4@@ -92,7 +92,7 @@
5
6 def chown(self, user, path):
7 '''Performs a chmod on target device.'''
8- cmd = 'shell chown -R %s %s' % (user, path)
9+ cmd = 'shell chown -R %s:%s %s' % (user, user, path)
10 call(self._cmd % cmd)
11
12 def getprop(self, android_property):
13
14=== modified file 'phabletutils/downloads.py'
15--- phabletutils/downloads.py 2013-08-14 02:37:08 +0000
16+++ phabletutils/downloads.py 2013-09-05 14:35:54 +0000
17@@ -134,3 +134,24 @@
18 return None
19 else:
20 return content_request.content
21+
22+
23+def get_ubuntu_stamp(uri):
24+ '''Downloads the jenkins build id from stamp file'''
25+ try:
26+ ubuntu_stamp = requests.get('%s/quantal-ubuntu_stamp' % uri)
27+ if ubuntu_stamp.status_code != 200:
28+ ubuntu_stamp = requests.get('%s/ubuntu_stamp' % uri)
29+ if ubuntu_stamp.status_code != 200:
30+ log.error('Latest build detection not supported... bailing')
31+ exit(1)
32+ # Make list and get rid of empties
33+ build_data = filter(lambda x: x.startswith('JENKINS_BUILD='),
34+ ubuntu_stamp.content.split('\n'))
35+ jenkins_build_id = build_data[0].split('=')[1]
36+ except (requests.HTTPError, requests.Timeout, requests.ConnectionError):
37+ log.error('Could not download build data from jenkins... bailing')
38+ exit(1)
39+ except IndexError:
40+ raise EnvironmentError('Jenkins data format has changed, incompatible')
41+ return jenkins_build_id
42
43=== modified file 'phabletutils/environment.py'
44--- phabletutils/environment.py 2013-09-04 01:14:52 +0000
45+++ phabletutils/environment.py 2013-09-05 14:35:54 +0000
46@@ -19,7 +19,6 @@
47 import hashlib
48 import logging
49 import os.path
50-import requests
51
52 from phabletutils.device import AndroidBridge
53 from phabletutils import cdimage
54@@ -34,27 +33,6 @@
55 log = logging.getLogger()
56
57
58-def get_ubuntu_stamp(uri):
59- '''Downloads the jenkins build id from stamp file'''
60- try:
61- ubuntu_stamp = requests.get('%s/quantal-ubuntu_stamp' % uri)
62- if ubuntu_stamp.status_code != 200:
63- ubuntu_stamp = requests.get('%s/ubuntu_stamp' % uri)
64- if ubuntu_stamp.status_code != 200:
65- log.error('Latest build detection not supported... bailing')
66- exit(1)
67- # Make list and get rid of empties
68- build_data = filter(lambda x: x.startswith('JENKINS_BUILD='),
69- ubuntu_stamp.content.split('\n'))
70- jenkins_build_id = build_data[0].split('=')[1]
71- except (requests.HTTPError, requests.Timeout, requests.ConnectionError):
72- log.error('Could not download build data from jenkins... bailing')
73- exit(1)
74- except IndexError:
75- raise EnvironmentError('Jenkins data format has changed, incompatible')
76- return jenkins_build_id
77-
78-
79 def detect_device(serial, device=None):
80 '''If no argument passed determine them from the connected device.'''
81 # Check CyanogenMod property
82@@ -72,37 +50,6 @@
83 return device
84
85
86-#def setup_revision1(device, uri, download_dir, settings):
87-# if not uri:
88-# uri = settings.download_uri
89-# if not download_dir:
90-# build = get_ubuntu_stamp(uri)
91-# download_dir = get_full_path(
92-# os.path.join(settings.download_dir, build))
93-# setup_download_directory(download_dir)
94-# else:
95-# uri = None
96-# system = settings.device_file_img % device
97-# boot = settings.boot_file_img % (device,)
98-# hash_dict = {entry: load_hash(uri, '%s.md5sum' % entry, download_dir)
99-# for entry in (system, boot)}
100-# if uri:
101-# system_uri = '%s/%s' % (uri, system),
102-# boot_uri = '%s/%s' % (uri, boot),
103-# else:
104-# system_uri = None
105-# boot_uri = None
106-# system_file = resources.File(file_path=os.path.join(download_dir, system),
107-# file_uri=system_uri,
108-# file_hash=hashes[system],
109-# file_hash_func=hashlib.md5)
110-# boot_file = resources.File(file_path=os.path.join(download_dir, boot),
111-# file_uri=boot_uri,
112-# file_hash=hashes[boot],
113-# file_hash_func=hashlib.md5)
114-# return projects.Android(boot=boot_file, system=system_file)
115-
116-
117 def setup_cdimage_files(project_name, uri, download_dir, series,
118 device, legacy=False):
119 downloads.setup_download_directory(download_dir)
120
121=== modified file 'phabletutils/projects.py'
122--- phabletutils/projects.py 2013-09-04 12:56:38 +0000
123+++ phabletutils/projects.py 2013-09-05 14:35:54 +0000
124@@ -128,9 +128,10 @@
125 super(Android, self).__init__(boot=boot, system=system)
126
127 def install(self, adb, fastboot):
128+ adb.reboot(bootloader=True)
129 log.warning('Device needs to be unlocked for the following to work')
130- fastboot.flash('system', gunzip(self.system))
131- fastboot.flash('boot', self.boot)
132+ fastboot.flash('system', gunzip(self._system.path))
133+ fastboot.flash('boot', self._boot.path)
134 log.info('Installation will complete soon and reboot into Android')
135 fastboot.reboot()
136

Subscribers

People subscribed via source and target branches