Merge lp:~ogra/phablet-tools/phablet-tools-phablet-config-changes into lp:phablet-tools
- phablet-tools-phablet-config-changes
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Manuel de la Peña |
Approved revision: | 304 |
Merged at revision: | 297 |
Proposed branch: | lp:~ogra/phablet-tools/phablet-tools-phablet-config-changes |
Merge into: | lp:phablet-tools |
Diff against target: |
131 lines (+67/-23) 1 file modified
phablet-config (+67/-23) |
To merge this branch: | bzr merge lp:~ogra/phablet-tools/phablet-tools-phablet-config-changes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Manuel de la Peña (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Martin Pitt | Approve | ||
Review via email: mp+231711@code.launchpad.net |
Commit message
add changes to phablet-config autopilot and writable-image functions to work with the new adbd running as phablet (needs latest dbus-property-
Description of the change
add changes to phablet-config autopilot and writable-image functions to work with the new adbd running as phablet (needs latest dbus-property-
PS Jenkins bot (ps-jenkins) wrote : | # |
- 296. By Oliver Grawert
-
fix pep8 issues
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:296
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Martin Pitt (pitti) wrote : | # |
I have some inline code comments which need to be addressed.
However, even with a fixed is_remote_root() this doesn't seem to work with the non-root adb, I still get AppArmor "DENIED" errors.
Martin Pitt (pitti) : | # |
Martin Pitt (pitti) wrote : | # |
Ah, that's because the previous code was synchronous, but the D-BUS call is asynchronous: When the gdbus returns apparmor_parser is still running in the background (for about one minute). So after that there should be a loop that waits for "pidof apparmor_parser" to be empty, perhaps with a timeout of 5 minutes?
- 297. By Oliver Grawert
-
fix the check for remote root in phablet-config
Martin Pitt (pitti) wrote : | # |
Ugly as hell, but I confirmed this to work:
--- phablet-config 2014-08-25 10:47:35 +0000
+++ phablet-config 2014-08-25 11:04:29 +0000
@@ -116,6 +116,10 @@
+ # wait until it is done; it takes a while to start apparmor_parser, so
+ # we need to wait a bit in advance
+ adb.shell('sleep 5; while pidof apparmor_parser; do sleep 5; done',
+ False)
else:
if args.dbus_probe == 'enable':
rfile = '/usr/share/
Martin Pitt (pitti) wrote : | # |
Meh, LP mistreating spaces. http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:297
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 298. By Oliver Grawert
-
add check if aa-clickhook has finished (thanks pitti)
- 299. By Oliver Grawert
-
make adb wait for teh device to come back after "writable reboot" when using the dbus call as well, also wait for teh network to be back
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:299
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 300. By Oliver Grawert
-
fix indendation in phablet-config
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:299
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 301. By Oliver Grawert
-
fix indendation even harder, add some spacing too
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:300
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:301
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 302. By Oliver Grawert
-
add support for package installation when sudo passowrd is supplied on cmdline with phablet-config writable-image
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:302
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 303. By Oliver Grawert
-
fix pep8
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:303
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 304. By Oliver Grawert
-
more pep8 fixes
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:304
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Manuel de la Peña (mandel) : | # |
Preview Diff
1 | === modified file 'phablet-config' |
2 | --- phablet-config 2014-06-19 15:10:15 +0000 |
3 | +++ phablet-config 2014-08-29 08:52:17 +0000 |
4 | @@ -100,25 +100,63 @@ |
5 | sys.exit(1) |
6 | |
7 | |
8 | +def is_remote_root(adb): |
9 | + return adb.shell("id -ru").strip() == "0" |
10 | + |
11 | + |
12 | def _handle_autopilot(adb, args): |
13 | - if args.dbus_probe == 'enable': |
14 | - rfile = '/usr/share/autopilot-touch/apparmor/click.rules' |
15 | - adb.shell('aa-clickhook -f --include=%s' % rfile) |
16 | + if not is_remote_root(adb): |
17 | + dbusarg = 'false' |
18 | + if args.dbus_probe == 'enable': |
19 | + dbusarg = 'true' |
20 | + dbus_call = 'dbus-send --system --print-reply --dest=com.canonical.PropertyService ' \ |
21 | + '/com/canonical/PropertyService com.canonical.PropertyService.SetProperty ' \ |
22 | + 'string:autopilot boolean:%s' % dbusarg |
23 | + adb.shell(dbus_call, False) |
24 | + # wait until it is done; it takes a while to start apparmor_parser, so |
25 | + # we need to wait a bit in advance |
26 | + adb.shell('sleep 5; while pidof apparmor_parser; do sleep 5; done', |
27 | + False) |
28 | else: |
29 | - adb.shell('aa-clickhook -f') |
30 | + if args.dbus_probe == 'enable': |
31 | + rfile = '/usr/share/autopilot-touch/apparmor/click.rules' |
32 | + adb.shell('aa-clickhook -f --include=%s' % rfile) |
33 | + else: |
34 | + adb.shell('aa-clickhook -f') |
35 | + |
36 | + |
37 | +def sudo_shell(adb, sudocmd, cmd): |
38 | + adb.shell('%s %s' % (sudocmd, cmd)) |
39 | |
40 | |
41 | def _handle_writable_image(adb, args): |
42 | - fname = '/userdata/.writable_image' |
43 | - try: |
44 | - adb.shell('test -e %s' % fname, False) |
45 | - except CalledProcessError as e: |
46 | - adb.shell('touch %s' % fname, False) |
47 | - adb.reboot() |
48 | - adb.wait_for_device() |
49 | - adb.wait_for_network() |
50 | - |
51 | - try: |
52 | + if not is_remote_root(adb): |
53 | + dbus_call = 'dbus-send --system --print-reply --dest=com.canonical.PropertyService ' \ |
54 | + '/com/canonical/PropertyService com.canonical.PropertyService.SetProperty ' \ |
55 | + 'string:writable boolean:true' |
56 | + adb.shell(dbus_call, False) |
57 | + else: |
58 | + fname = '/userdata/.writable_image' |
59 | + try: |
60 | + adb.shell('test -e %s' % fname, False) |
61 | + except CalledProcessError as e: |
62 | + adb.shell('touch %s' % fname, False) |
63 | + adb.reboot() |
64 | + |
65 | + adb.wait_for_device() |
66 | + adb.wait_for_network() |
67 | + |
68 | + try: |
69 | + sudocmd = '' |
70 | + tempfile = '' |
71 | + if not is_remote_root(adb): |
72 | + tempfile = adb.shell('mktemp -t sudo_askpass.XXXX').rstrip() |
73 | + |
74 | + adb.shell('/bin/echo -e \\"#!/bin/sh\necho %s \\" > %s ' % |
75 | + (args.sudopassword[0], tempfile), ignore_errors=False) |
76 | + adb.shell("chmod u+x %s" % tempfile) |
77 | + sudocmd = 'SUDO_ASKPASS=%s sudo -A' % tempfile |
78 | + |
79 | if args.package_dir: |
80 | tmp_archive = create_temp_dir() |
81 | for package_dir in args.package_dir: |
82 | @@ -145,27 +183,31 @@ |
83 | pin_file.write(LOCAL_PIN_FILE) |
84 | |
85 | adb.push(tmp_archive, '/tmp/archive') |
86 | - adb.shell('mv /tmp/archive/00localrepo.list ' |
87 | - '/etc/apt/sources.list.d') |
88 | - adb.shell('mv /tmp/archive/local-pin-1100 ' |
89 | - '/etc/apt/preferences.d') |
90 | + sudo_shell(adb, sudocmd, 'mv /tmp/archive/00localrepo.list ' |
91 | + '/etc/apt/sources.list.d') |
92 | + sudo_shell(adb. sudocmd, 'mv /tmp/archive/local-pin-1100 ' |
93 | + '/etc/apt/preferences.d') |
94 | |
95 | if args.ppa: |
96 | for ppa in args.ppa: |
97 | - adb.shell('add-apt-repository -y %s' % ppa, False) |
98 | + sudo_shell(adb, sudocmd, 'add-apt-repository -y %s' % ppa) |
99 | |
100 | if args.package_dir or args.ppa: |
101 | - adb.shell('apt-get update -qq') |
102 | + sudo_shell(adb, sudocmd, 'apt-get update -qq') |
103 | |
104 | if args.package: |
105 | package = ' '.join(args.package) |
106 | - adb.shell('apt-get install -yq --force-yes %s' % package, False) |
107 | + sudo_shell(adb, sudocmd, |
108 | + 'apt-get install -yq --force-yes %s' % package) |
109 | |
110 | if args.package_dir: |
111 | # Remove the local archive |
112 | - adb.shell('rm /etc/apt/sources.list.d/00localrepo.list') |
113 | - adb.shell('rm /etc/apt/preferences.d/local-pin-1100') |
114 | + sudo_shell(adb, sudocmd, |
115 | + 'rm /etc/apt/sources.list.d/00localrepo.list') |
116 | + sudo_shell(adb, sudocmd, |
117 | + 'rm /etc/apt/preferences.d/local-pin-1100') |
118 | adb.shell('rm -rf /tmp/archive') |
119 | + adb.shell('rm -rf %s' % tempfile) |
120 | |
121 | except CalledProcessError as e: |
122 | print(e) |
123 | @@ -243,6 +285,8 @@ |
124 | repository. Can be repeated.''') |
125 | dm.add_argument('-p', '--package', action='append', |
126 | help='Package to install. Can be repeated.') |
127 | + dm.add_argument('-s', '--sudopassword', action='append', |
128 | + help='Password to use for sudo on the device.') |
129 | dm.set_defaults(func=_handle_writable_image) |
130 | |
131 | ei = sub.add_parser('edges-intro', help='Enable/disable the edges intro.') |
FAILED: Continuous integration, rev:295 jenkins. qa.ubuntu. com/job/ phablet- tools-ci/ 359/ jenkins. qa.ubuntu. com/job/ phablet- tools-utopic- amd64-ci/ 40/console jenkins. qa.ubuntu. com/job/ phablet- tools-utopic- armhf-ci/ 40/console jenkins. qa.ubuntu. com/job/ phablet- tools-utopic- i386-ci/ 40/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/phablet- tools-ci/ 359/rebuild
http://