Merge lp:~chipaca/ubuntu-system-settings/push-helper into lp:ubuntu-system-settings

Proposed by John Lenton on 2014-08-05
Status: Merged
Approved by: Iain Lane on 2014-08-11
Approved revision: 826
Merged at revision: 883
Proposed branch: lp:~chipaca/ubuntu-system-settings/push-helper
Merge into: lp:ubuntu-system-settings
Diff against target: 202 lines (+113/-4)
6 files modified
CMakeLists.txt (+2/-0)
debian/control (+4/-1)
debian/ubuntu-system-settings.install (+1/-0)
po/CMakeLists.txt (+15/-1)
push-helper/software-updates-helper.py (+89/-0)
tests/test_code.py.in (+2/-2)
To merge this branch: bzr merge lp:~chipaca/ubuntu-system-settings/push-helper
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2014-08-12
Iain Lane 2014-08-05 Approve on 2014-08-11
Review via email: mp+229571@code.launchpad.net

Commit message

Bring the system settings push helper over from ubuntu-push.

Description of the change

Bring the system settings push helper over from ubuntu-push.

To post a comment you must log in.
820. By John Lenton on 2014-08-05

expanded the comments a bit

Iain Lane (laney) wrote :

Inline.

review: Needs Fixing
Iain Lane (laney) :
Iain Lane (laney) :
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:819
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1142/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3020
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2396
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/334
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/334
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/334/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/334
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3067
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4263
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4263/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10978
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1984
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2663
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2663/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1142/rebuild

review: Needs Fixing (continuous-integration)
821. By John Lenton on 2014-08-05

not Conflicts, but Breaks and Replaces.

822. By John Lenton on 2014-08-05

move helper into its own dir, include in pyflakes and pep8, modify helper to pass pyflakes and pep8

823. By John Lenton on 2014-08-05

use cmake to install the helper, not debian/rules.

824. By John Lenton on 2014-08-05

add a pot-py target to po/

825. By John Lenton on 2014-08-05

get rid of now spurious define in rules

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:820
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1144/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3022
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2398/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/336
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/336
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/336/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/336
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3068
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4265
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4265/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10981
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1985/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2665
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2665/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1144/rebuild

review: Needs Fixing (continuous-integration)
826. By John Lenton on 2014-08-05

merged trunk

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:825
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1148/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3028
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2403
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/340
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/340
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/340/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/340
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3074
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4271
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4271/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/10992
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1989
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2670
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2670/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1148/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:826
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1150/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3036
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2410/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/342
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/342
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/342/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/342
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3079
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4279
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4279/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11002
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/1994/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2677
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2677/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1150/rebuild

review: Needs Fixing (continuous-integration)
Iain Lane (laney) wrote :

Looks nice now, thanks

review: Approve
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:826
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1201/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3345
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2617
    FAILURE: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/394/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/390
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/390/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/393
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3281
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4591
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4591/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11276
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2120
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2891
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/2891/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1201/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-07-31 13:43:09 +0000
3+++ CMakeLists.txt 2014-08-05 11:50:55 +0000
4@@ -58,6 +58,7 @@
5 set(PLUGIN_QML_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_QML_DIR_BASE}")
6 set(PLUGIN_PRIVATE_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${PLUGIN_PRIVATE_MODULE_DIR_BASE}")
7 set(SETTINGS_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_MANIFEST_DIR_BASE}")
8+set(PUSH_HELPER_DIR "lib/ubuntu-push-client/legacy-helpers")
9
10 SET(CMAKE_INSTALL_RPATH "${PLUGIN_MODULE_DIR}")
11
12@@ -75,6 +76,7 @@
13 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ubuntu-system-settings.desktop DESTINATION share/applications)
14 install(FILES ubuntu-system-settings.url-dispatcher DESTINATION share/url-dispatcher/urls)
15 install(FILES screenshot.png DESTINATION ${SETTINGS_SHARE_DIR})
16+install(PROGRAMS push-helper/software-updates-helper.py DESTINATION ${PUSH_HELPER_DIR} RENAME ubuntu-system-settings)
17
18 if(cmake_build_type_lower MATCHES coverage)
19 ENABLE_COVERAGE_REPORT(TARGETS system-settings FILTER /usr/include ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*)
20
21=== modified file 'debian/control'
22--- debian/control 2014-08-01 17:10:25 +0000
23+++ debian/control 2014-08-05 11:50:55 +0000
24@@ -72,7 +72,7 @@
25 click,
26 ubuntu-keyboard-data (>= 0.99.trunk.phablet2+13.10.20131001),
27 urfkill,
28-# for the session-migration script
29+# for the session-migration script (python3 itself also for the push helper)
30 python3,
31 python3-gi,
32 python3-dbus,
33@@ -81,6 +81,9 @@
34 ubuntu-system-settings-online-accounts,
35 ubuntu-touch-sounds,
36 Conflicts: ubuntu-system-settings-example
37+# ubuntu-push-client shipped the system settings push helper until 0.60:
38+Breaks: ubuntu-push-client (<<0.61),
39+Replaces: ubuntu-push-client (<<0.61),
40 Description: System Settings application for Ubuntu Touch
41 This package contains the System Settings application used on the
42 Ubuntu Touch images, it's designed for phones, tablets and convergent
43
44=== modified file 'debian/ubuntu-system-settings.install'
45--- debian/ubuntu-system-settings.install 2014-07-17 16:25:10 +0000
46+++ debian/ubuntu-system-settings.install 2014-08-05 11:50:55 +0000
47@@ -5,3 +5,4 @@
48 usr/share/locale
49 usr/share/ubuntu/settings/system
50 usr/share/url-dispatcher
51+usr/lib/ubuntu-push-client/legacy-helpers
52
53=== modified file 'po/CMakeLists.txt'
54--- po/CMakeLists.txt 2013-12-31 19:30:03 +0000
55+++ po/CMakeLists.txt 2014-08-05 11:50:55 +0000
56@@ -6,6 +6,8 @@
57 "${CMAKE_SOURCE_DIR}/wizard/qml/*/*.qml")
58 file(GLOB SETTINGSFILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
59 "${CMAKE_SOURCE_DIR}/plugins/*/*.settings")
60+file(GLOB PYFILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
61+ "${CMAKE_SOURCE_DIR}/push-helper/*.py")
62
63 add_custom_command(OUTPUT settings.js
64 COMMAND ./extractsettingsinfo ${SETTINGSFILES} -o ${CMAKE_CURRENT_BINARY_DIR}/settings.js
65@@ -41,7 +43,19 @@
66 DEPENDS pot-qml ${CPPFILES}
67 )
68
69-add_custom_target(pot DEPENDS pot-qml pot-cpp)
70+add_custom_target(pot-py
71+ COMMAND ${XGETTEXT_BIN} -o ubuntu-system-settings.pot
72+ --join-existing
73+ --copyright=\"Canonical Ltd.\"
74+ --package-name ubuntu-system-settings
75+ --add-comments=TRANSLATORS
76+ --keyword=_
77+ ${PYFILES}
78+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
79+ DEPENDS ${PYFILES}
80+)
81+
82+add_custom_target(pot DEPENDS pot-qml pot-cpp pot-py)
83
84 set(languages "ar;ast;be;bg;bs;ca;cs;de;el;en_AU;en_GB;eo;es;fa;fi;fr;gl;gu;he;hi;hr;hu;id;it;km;ko;lo;lv;ms;my;nb;pl;pt_BR;pt;ru;shn;sl;sv;tr;ug;uk;xh;zh_CN;zh_HK;zh_TW")
85 foreach(i ${languages})
86
87=== added directory 'push-helper'
88=== added file 'push-helper/software-updates-helper.py'
89--- push-helper/software-updates-helper.py 1970-01-01 00:00:00 +0000
90+++ push-helper/software-updates-helper.py 2014-08-05 11:50:55 +0000
91@@ -0,0 +1,89 @@
92+#!/usr/bin/python3
93+# -*- coding: utf-8 -*-
94+#
95+# Software Updates Push Notifications helper.
96+#
97+# This helper is called with one of three things:
98+# a) regular push messages about updated click packages¹
99+# b) broadcast messages about system updates
100+# c) notifications you send yourself over dbus to actually notify the user that
101+# an update is ready to install².
102+#
103+# Figuring out which of those is the case is also this helper's job.
104+#
105+# notes:
106+# 1. nobody is sending those at the time of writing.
107+# 2. yes, this is rather convoluted. Most push helpers don't have to deal with
108+# this stuff.
109+
110+import json
111+import sys
112+import time
113+import gettext
114+
115+if len(sys.argv) != 3:
116+ print("File in and out expected via argv", file=sys.stderr)
117+ sys.exit(1)
118+
119+f1, f2 = sys.argv[1:3]
120+_ = gettext.translation("ubuntu-system-settings").gettext
121+
122+# here you should look at the input (the contents of the file whose
123+# name is in f1, which are guaranteed to be json). If it's a broadcast
124+# it will be the most recent we've received, and will have passed a
125+# minimum amount of sanity checking, but you can probably do more. As
126+# per the design on https://wiki.ubuntu.com/SoftwareUpdates#Prompting
127+# if things are set to auto-download you should go download them (in a
128+# child process -- this helper process itself has 4 more seconds to
129+# live).
130+#
131+# the broadcast payload will be a single json object looking like
132+# { image-channel/device-model": [build-number, channel-alias]}
133+#
134+# e.g.,
135+#
136+# {"ubuntu-touch/utopic-proposed/hammerhead":[265,""]}
137+#
138+#
139+# When the click server starts sending notifications of packages a user can
140+# update, you should probably describe that payload here. What to do with it
141+# is described in some detail in the wiki page above.
142+#
143+#
144+# Once you've downloaded things and need to actually notify the user, you'd
145+# send a notification as below, over dbus to Post. That's the third payload
146+# this script will be called with; for that case you'd just pass the payload
147+# through.
148+#
149+# For cases when you don't want to notify the user (yet), the correct
150+# output (to be written to a file whose name is f2) is “{}”, i.e. an
151+# empty json object.
152+#
153+# For now, this script assumes everything that comes in is a valid
154+# broadcast notification, and notifies the user directly:
155+
156+
157+icon = "/usr/share/ubuntu/settings/system/icons/settings-system-update.svg"
158+obj = {
159+ "notification": {
160+ "emblem-counter": {
161+ "count": 1,
162+ "visible": True,
163+ },
164+ "vibrate": {
165+ "pattern": [50, 150],
166+ "repeat": 3,
167+ },
168+ "card": {
169+ "summary": _("There's an updated system image."),
170+ "body": _("Tap to open the system updater."),
171+ "actions": ["settings:///system/system-update"],
172+ "icon": icon,
173+ "timestamp": int(time.time()),
174+ "persist": True,
175+ "popup": True,
176+ },
177+ },
178+}
179+
180+json.dump(obj, open(f2, "w"))
181
182=== modified file 'tests/test_code.py.in'
183--- tests/test_code.py.in 2014-07-17 17:03:17 +0000
184+++ tests/test_code.py.in 2014-08-05 11:50:55 +0000
185@@ -23,7 +23,7 @@
186 )
187 def test_pyflakes(self):
188 pyflakes = subprocess.Popen(
189- ['pyflakes3', '@CMAKE_CURRENT_SOURCE_DIR@'],
190+ ['pyflakes3', '@CMAKE_CURRENT_SOURCE_DIR@', '@CMAKE_CURRENT_SOURCE_DIR@/../push-helper/'],
191 stdout=subprocess.PIPE, universal_newlines=True
192 )
193 (out, err) = pyflakes.communicate()
194@@ -34,7 +34,7 @@
195 )
196 def test_pep8(self):
197 pep8 = subprocess.Popen(
198- ['pep8', '@CMAKE_CURRENT_SOURCE_DIR@'],
199+ ['pep8', '@CMAKE_CURRENT_SOURCE_DIR@', '@CMAKE_CURRENT_SOURCE_DIR@/../push-helper/'],
200 stdout=subprocess.PIPE, universal_newlines=True
201 )
202 (out, err) = pep8.communicate()

Subscribers

People subscribed via source and target branches