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
=== modified file 'phabletutils/device.py'
--- phabletutils/device.py 2013-08-13 02:15:17 +0000
+++ phabletutils/device.py 2013-09-05 14:35:54 +0000
@@ -92,7 +92,7 @@
9292
93 def chown(self, user, path):93 def chown(self, user, path):
94 '''Performs a chmod on target device.'''94 '''Performs a chmod on target device.'''
95 cmd = 'shell chown -R %s %s' % (user, path)95 cmd = 'shell chown -R %s:%s %s' % (user, user, path)
96 call(self._cmd % cmd)96 call(self._cmd % cmd)
9797
98 def getprop(self, android_property):98 def getprop(self, android_property):
9999
=== modified file 'phabletutils/downloads.py'
--- phabletutils/downloads.py 2013-08-14 02:37:08 +0000
+++ phabletutils/downloads.py 2013-09-05 14:35:54 +0000
@@ -134,3 +134,24 @@
134 return None134 return None
135 else:135 else:
136 return content_request.content136 return content_request.content
137
138
139def get_ubuntu_stamp(uri):
140 '''Downloads the jenkins build id from stamp file'''
141 try:
142 ubuntu_stamp = requests.get('%s/quantal-ubuntu_stamp' % uri)
143 if ubuntu_stamp.status_code != 200:
144 ubuntu_stamp = requests.get('%s/ubuntu_stamp' % uri)
145 if ubuntu_stamp.status_code != 200:
146 log.error('Latest build detection not supported... bailing')
147 exit(1)
148 # Make list and get rid of empties
149 build_data = filter(lambda x: x.startswith('JENKINS_BUILD='),
150 ubuntu_stamp.content.split('\n'))
151 jenkins_build_id = build_data[0].split('=')[1]
152 except (requests.HTTPError, requests.Timeout, requests.ConnectionError):
153 log.error('Could not download build data from jenkins... bailing')
154 exit(1)
155 except IndexError:
156 raise EnvironmentError('Jenkins data format has changed, incompatible')
157 return jenkins_build_id
137158
=== modified file 'phabletutils/environment.py'
--- phabletutils/environment.py 2013-09-04 01:14:52 +0000
+++ phabletutils/environment.py 2013-09-05 14:35:54 +0000
@@ -19,7 +19,6 @@
19import hashlib19import hashlib
20import logging20import logging
21import os.path21import os.path
22import requests
2322
24from phabletutils.device import AndroidBridge23from phabletutils.device import AndroidBridge
25from phabletutils import cdimage24from phabletutils import cdimage
@@ -34,27 +33,6 @@
34log = logging.getLogger()33log = logging.getLogger()
3534
3635
37def get_ubuntu_stamp(uri):
38 '''Downloads the jenkins build id from stamp file'''
39 try:
40 ubuntu_stamp = requests.get('%s/quantal-ubuntu_stamp' % uri)
41 if ubuntu_stamp.status_code != 200:
42 ubuntu_stamp = requests.get('%s/ubuntu_stamp' % uri)
43 if ubuntu_stamp.status_code != 200:
44 log.error('Latest build detection not supported... bailing')
45 exit(1)
46 # Make list and get rid of empties
47 build_data = filter(lambda x: x.startswith('JENKINS_BUILD='),
48 ubuntu_stamp.content.split('\n'))
49 jenkins_build_id = build_data[0].split('=')[1]
50 except (requests.HTTPError, requests.Timeout, requests.ConnectionError):
51 log.error('Could not download build data from jenkins... bailing')
52 exit(1)
53 except IndexError:
54 raise EnvironmentError('Jenkins data format has changed, incompatible')
55 return jenkins_build_id
56
57
58def detect_device(serial, device=None):36def detect_device(serial, device=None):
59 '''If no argument passed determine them from the connected device.'''37 '''If no argument passed determine them from the connected device.'''
60 # Check CyanogenMod property38 # Check CyanogenMod property
@@ -72,37 +50,6 @@
72 return device50 return device
7351
7452
75#def setup_revision1(device, uri, download_dir, settings):
76# if not uri:
77# uri = settings.download_uri
78# if not download_dir:
79# build = get_ubuntu_stamp(uri)
80# download_dir = get_full_path(
81# os.path.join(settings.download_dir, build))
82# setup_download_directory(download_dir)
83# else:
84# uri = None
85# system = settings.device_file_img % device
86# boot = settings.boot_file_img % (device,)
87# hash_dict = {entry: load_hash(uri, '%s.md5sum' % entry, download_dir)
88# for entry in (system, boot)}
89# if uri:
90# system_uri = '%s/%s' % (uri, system),
91# boot_uri = '%s/%s' % (uri, boot),
92# else:
93# system_uri = None
94# boot_uri = None
95# system_file = resources.File(file_path=os.path.join(download_dir, system),
96# file_uri=system_uri,
97# file_hash=hashes[system],
98# file_hash_func=hashlib.md5)
99# boot_file = resources.File(file_path=os.path.join(download_dir, boot),
100# file_uri=boot_uri,
101# file_hash=hashes[boot],
102# file_hash_func=hashlib.md5)
103# return projects.Android(boot=boot_file, system=system_file)
104
105
106def setup_cdimage_files(project_name, uri, download_dir, series,53def setup_cdimage_files(project_name, uri, download_dir, series,
107 device, legacy=False):54 device, legacy=False):
108 downloads.setup_download_directory(download_dir)55 downloads.setup_download_directory(download_dir)
10956
=== modified file 'phabletutils/projects.py'
--- phabletutils/projects.py 2013-09-04 12:56:38 +0000
+++ phabletutils/projects.py 2013-09-05 14:35:54 +0000
@@ -128,9 +128,10 @@
128 super(Android, self).__init__(boot=boot, system=system)128 super(Android, self).__init__(boot=boot, system=system)
129129
130 def install(self, adb, fastboot):130 def install(self, adb, fastboot):
131 adb.reboot(bootloader=True)
131 log.warning('Device needs to be unlocked for the following to work')132 log.warning('Device needs to be unlocked for the following to work')
132 fastboot.flash('system', gunzip(self.system))133 fastboot.flash('system', gunzip(self._system.path))
133 fastboot.flash('boot', self.boot)134 fastboot.flash('boot', self._boot.path)
134 log.info('Installation will complete soon and reboot into Android')135 log.info('Installation will complete soon and reboot into Android')
135 fastboot.reboot()136 fastboot.reboot()
136137

Subscribers

People subscribed via source and target branches