Merge lp:~chipaca/ubuntu-system-settings/push-helper into lp:ubuntu-system-settings
- push-helper
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Iain Lane |
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Iain Lane | Approve | ||
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.
- 820. By John Lenton
-
expanded the comments a bit
Iain Lane (laney) : | # |
Iain Lane (laney) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:819
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 821. By John Lenton
-
not Conflicts, but Breaks and Replaces.
- 822. By John Lenton
-
move helper into its own dir, include in pyflakes and pep8, modify helper to pass pyflakes and pep8
- 823. By John Lenton
-
use cmake to install the helper, not debian/rules.
- 824. By John Lenton
-
add a pot-py target to po/
- 825. By John Lenton
-
get rid of now spurious define in rules
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:820
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 826. By John Lenton
-
merged trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:825
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:826
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Iain Lane (laney) wrote : | # |
Looks nice now, thanks
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:826
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
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 | 58 | set(PLUGIN_QML_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_QML_DIR_BASE}") | 58 | set(PLUGIN_QML_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_QML_DIR_BASE}") |
6 | 59 | set(PLUGIN_PRIVATE_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${PLUGIN_PRIVATE_MODULE_DIR_BASE}") | 59 | set(PLUGIN_PRIVATE_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${PLUGIN_PRIVATE_MODULE_DIR_BASE}") |
7 | 60 | set(SETTINGS_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_MANIFEST_DIR_BASE}") | 60 | set(SETTINGS_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_MANIFEST_DIR_BASE}") |
8 | 61 | set(PUSH_HELPER_DIR "lib/ubuntu-push-client/legacy-helpers") | ||
9 | 61 | 62 | ||
10 | 62 | SET(CMAKE_INSTALL_RPATH "${PLUGIN_MODULE_DIR}") | 63 | SET(CMAKE_INSTALL_RPATH "${PLUGIN_MODULE_DIR}") |
11 | 63 | 64 | ||
12 | @@ -75,6 +76,7 @@ | |||
13 | 75 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ubuntu-system-settings.desktop DESTINATION share/applications) | 76 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ubuntu-system-settings.desktop DESTINATION share/applications) |
14 | 76 | install(FILES ubuntu-system-settings.url-dispatcher DESTINATION share/url-dispatcher/urls) | 77 | install(FILES ubuntu-system-settings.url-dispatcher DESTINATION share/url-dispatcher/urls) |
15 | 77 | install(FILES screenshot.png DESTINATION ${SETTINGS_SHARE_DIR}) | 78 | install(FILES screenshot.png DESTINATION ${SETTINGS_SHARE_DIR}) |
16 | 79 | install(PROGRAMS push-helper/software-updates-helper.py DESTINATION ${PUSH_HELPER_DIR} RENAME ubuntu-system-settings) | ||
17 | 78 | 80 | ||
18 | 79 | if(cmake_build_type_lower MATCHES coverage) | 81 | if(cmake_build_type_lower MATCHES coverage) |
19 | 80 | ENABLE_COVERAGE_REPORT(TARGETS system-settings FILTER /usr/include ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*) | 82 | ENABLE_COVERAGE_REPORT(TARGETS system-settings FILTER /usr/include ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*) |
20 | 81 | 83 | ||
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 | 72 | click, | 72 | click, |
26 | 73 | ubuntu-keyboard-data (>= 0.99.trunk.phablet2+13.10.20131001), | 73 | ubuntu-keyboard-data (>= 0.99.trunk.phablet2+13.10.20131001), |
27 | 74 | urfkill, | 74 | urfkill, |
29 | 75 | # for the session-migration script | 75 | # for the session-migration script (python3 itself also for the push helper) |
30 | 76 | python3, | 76 | python3, |
31 | 77 | python3-gi, | 77 | python3-gi, |
32 | 78 | python3-dbus, | 78 | python3-dbus, |
33 | @@ -81,6 +81,9 @@ | |||
34 | 81 | ubuntu-system-settings-online-accounts, | 81 | ubuntu-system-settings-online-accounts, |
35 | 82 | ubuntu-touch-sounds, | 82 | ubuntu-touch-sounds, |
36 | 83 | Conflicts: ubuntu-system-settings-example | 83 | Conflicts: ubuntu-system-settings-example |
37 | 84 | # ubuntu-push-client shipped the system settings push helper until 0.60: | ||
38 | 85 | Breaks: ubuntu-push-client (<<0.61), | ||
39 | 86 | Replaces: ubuntu-push-client (<<0.61), | ||
40 | 84 | Description: System Settings application for Ubuntu Touch | 87 | Description: System Settings application for Ubuntu Touch |
41 | 85 | This package contains the System Settings application used on the | 88 | This package contains the System Settings application used on the |
42 | 86 | Ubuntu Touch images, it's designed for phones, tablets and convergent | 89 | Ubuntu Touch images, it's designed for phones, tablets and convergent |
43 | 87 | 90 | ||
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 | 5 | usr/share/locale | 5 | usr/share/locale |
49 | 6 | usr/share/ubuntu/settings/system | 6 | usr/share/ubuntu/settings/system |
50 | 7 | usr/share/url-dispatcher | 7 | usr/share/url-dispatcher |
51 | 8 | usr/lib/ubuntu-push-client/legacy-helpers | ||
52 | 8 | 9 | ||
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 | 6 | "${CMAKE_SOURCE_DIR}/wizard/qml/*/*.qml") | 6 | "${CMAKE_SOURCE_DIR}/wizard/qml/*/*.qml") |
58 | 7 | file(GLOB SETTINGSFILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" | 7 | file(GLOB SETTINGSFILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" |
59 | 8 | "${CMAKE_SOURCE_DIR}/plugins/*/*.settings") | 8 | "${CMAKE_SOURCE_DIR}/plugins/*/*.settings") |
60 | 9 | file(GLOB PYFILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" | ||
61 | 10 | "${CMAKE_SOURCE_DIR}/push-helper/*.py") | ||
62 | 9 | 11 | ||
63 | 10 | add_custom_command(OUTPUT settings.js | 12 | add_custom_command(OUTPUT settings.js |
64 | 11 | COMMAND ./extractsettingsinfo ${SETTINGSFILES} -o ${CMAKE_CURRENT_BINARY_DIR}/settings.js | 13 | COMMAND ./extractsettingsinfo ${SETTINGSFILES} -o ${CMAKE_CURRENT_BINARY_DIR}/settings.js |
65 | @@ -41,7 +43,19 @@ | |||
66 | 41 | DEPENDS pot-qml ${CPPFILES} | 43 | DEPENDS pot-qml ${CPPFILES} |
67 | 42 | ) | 44 | ) |
68 | 43 | 45 | ||
70 | 44 | add_custom_target(pot DEPENDS pot-qml pot-cpp) | 46 | add_custom_target(pot-py |
71 | 47 | COMMAND ${XGETTEXT_BIN} -o ubuntu-system-settings.pot | ||
72 | 48 | --join-existing | ||
73 | 49 | --copyright=\"Canonical Ltd.\" | ||
74 | 50 | --package-name ubuntu-system-settings | ||
75 | 51 | --add-comments=TRANSLATORS | ||
76 | 52 | --keyword=_ | ||
77 | 53 | ${PYFILES} | ||
78 | 54 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
79 | 55 | DEPENDS ${PYFILES} | ||
80 | 56 | ) | ||
81 | 57 | |||
82 | 58 | add_custom_target(pot DEPENDS pot-qml pot-cpp pot-py) | ||
83 | 45 | 59 | ||
84 | 46 | 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") | 60 | 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 | 47 | foreach(i ${languages}) | 61 | foreach(i ${languages}) |
86 | 48 | 62 | ||
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 | 1 | #!/usr/bin/python3 | ||
93 | 2 | # -*- coding: utf-8 -*- | ||
94 | 3 | # | ||
95 | 4 | # Software Updates Push Notifications helper. | ||
96 | 5 | # | ||
97 | 6 | # This helper is called with one of three things: | ||
98 | 7 | # a) regular push messages about updated click packages¹ | ||
99 | 8 | # b) broadcast messages about system updates | ||
100 | 9 | # c) notifications you send yourself over dbus to actually notify the user that | ||
101 | 10 | # an update is ready to install². | ||
102 | 11 | # | ||
103 | 12 | # Figuring out which of those is the case is also this helper's job. | ||
104 | 13 | # | ||
105 | 14 | # notes: | ||
106 | 15 | # 1. nobody is sending those at the time of writing. | ||
107 | 16 | # 2. yes, this is rather convoluted. Most push helpers don't have to deal with | ||
108 | 17 | # this stuff. | ||
109 | 18 | |||
110 | 19 | import json | ||
111 | 20 | import sys | ||
112 | 21 | import time | ||
113 | 22 | import gettext | ||
114 | 23 | |||
115 | 24 | if len(sys.argv) != 3: | ||
116 | 25 | print("File in and out expected via argv", file=sys.stderr) | ||
117 | 26 | sys.exit(1) | ||
118 | 27 | |||
119 | 28 | f1, f2 = sys.argv[1:3] | ||
120 | 29 | _ = gettext.translation("ubuntu-system-settings").gettext | ||
121 | 30 | |||
122 | 31 | # here you should look at the input (the contents of the file whose | ||
123 | 32 | # name is in f1, which are guaranteed to be json). If it's a broadcast | ||
124 | 33 | # it will be the most recent we've received, and will have passed a | ||
125 | 34 | # minimum amount of sanity checking, but you can probably do more. As | ||
126 | 35 | # per the design on https://wiki.ubuntu.com/SoftwareUpdates#Prompting | ||
127 | 36 | # if things are set to auto-download you should go download them (in a | ||
128 | 37 | # child process -- this helper process itself has 4 more seconds to | ||
129 | 38 | # live). | ||
130 | 39 | # | ||
131 | 40 | # the broadcast payload will be a single json object looking like | ||
132 | 41 | # { image-channel/device-model": [build-number, channel-alias]} | ||
133 | 42 | # | ||
134 | 43 | # e.g., | ||
135 | 44 | # | ||
136 | 45 | # {"ubuntu-touch/utopic-proposed/hammerhead":[265,""]} | ||
137 | 46 | # | ||
138 | 47 | # | ||
139 | 48 | # When the click server starts sending notifications of packages a user can | ||
140 | 49 | # update, you should probably describe that payload here. What to do with it | ||
141 | 50 | # is described in some detail in the wiki page above. | ||
142 | 51 | # | ||
143 | 52 | # | ||
144 | 53 | # Once you've downloaded things and need to actually notify the user, you'd | ||
145 | 54 | # send a notification as below, over dbus to Post. That's the third payload | ||
146 | 55 | # this script will be called with; for that case you'd just pass the payload | ||
147 | 56 | # through. | ||
148 | 57 | # | ||
149 | 58 | # For cases when you don't want to notify the user (yet), the correct | ||
150 | 59 | # output (to be written to a file whose name is f2) is “{}”, i.e. an | ||
151 | 60 | # empty json object. | ||
152 | 61 | # | ||
153 | 62 | # For now, this script assumes everything that comes in is a valid | ||
154 | 63 | # broadcast notification, and notifies the user directly: | ||
155 | 64 | |||
156 | 65 | |||
157 | 66 | icon = "/usr/share/ubuntu/settings/system/icons/settings-system-update.svg" | ||
158 | 67 | obj = { | ||
159 | 68 | "notification": { | ||
160 | 69 | "emblem-counter": { | ||
161 | 70 | "count": 1, | ||
162 | 71 | "visible": True, | ||
163 | 72 | }, | ||
164 | 73 | "vibrate": { | ||
165 | 74 | "pattern": [50, 150], | ||
166 | 75 | "repeat": 3, | ||
167 | 76 | }, | ||
168 | 77 | "card": { | ||
169 | 78 | "summary": _("There's an updated system image."), | ||
170 | 79 | "body": _("Tap to open the system updater."), | ||
171 | 80 | "actions": ["settings:///system/system-update"], | ||
172 | 81 | "icon": icon, | ||
173 | 82 | "timestamp": int(time.time()), | ||
174 | 83 | "persist": True, | ||
175 | 84 | "popup": True, | ||
176 | 85 | }, | ||
177 | 86 | }, | ||
178 | 87 | } | ||
179 | 88 | |||
180 | 89 | json.dump(obj, open(f2, "w")) | ||
181 | 0 | 90 | ||
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 | 23 | ) | 23 | ) |
187 | 24 | def test_pyflakes(self): | 24 | def test_pyflakes(self): |
188 | 25 | pyflakes = subprocess.Popen( | 25 | pyflakes = subprocess.Popen( |
190 | 26 | ['pyflakes3', '@CMAKE_CURRENT_SOURCE_DIR@'], | 26 | ['pyflakes3', '@CMAKE_CURRENT_SOURCE_DIR@', '@CMAKE_CURRENT_SOURCE_DIR@/../push-helper/'], |
191 | 27 | stdout=subprocess.PIPE, universal_newlines=True | 27 | stdout=subprocess.PIPE, universal_newlines=True |
192 | 28 | ) | 28 | ) |
193 | 29 | (out, err) = pyflakes.communicate() | 29 | (out, err) = pyflakes.communicate() |
194 | @@ -34,7 +34,7 @@ | |||
195 | 34 | ) | 34 | ) |
196 | 35 | def test_pep8(self): | 35 | def test_pep8(self): |
197 | 36 | pep8 = subprocess.Popen( | 36 | pep8 = subprocess.Popen( |
199 | 37 | ['pep8', '@CMAKE_CURRENT_SOURCE_DIR@'], | 37 | ['pep8', '@CMAKE_CURRENT_SOURCE_DIR@', '@CMAKE_CURRENT_SOURCE_DIR@/../push-helper/'], |
200 | 38 | stdout=subprocess.PIPE, universal_newlines=True | 38 | stdout=subprocess.PIPE, universal_newlines=True |
201 | 39 | ) | 39 | ) |
202 | 40 | (out, err) = pep8.communicate() | 40 | (out, err) = pep8.communicate() |
Inline.