Merge lp:~chipaca/ubuntu-push/auth-packaging into lp:ubuntu-push/automatic
- auth-packaging
- Merge into automatic
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Samuele Pedroni | ||||
Approved revision: | 126 | ||||
Merged at revision: | 123 | ||||
Proposed branch: | lp:~chipaca/ubuntu-push/auth-packaging | ||||
Merge into: | lp:ubuntu-push/automatic | ||||
Diff against target: |
435 lines (+191/-18) 13 files modified
Makefile (+3/-0) README (+11/-2) client/client.go (+21/-2) client/client_test.go (+17/-2) client/session/session.go (+7/-4) client/session/session_test.go (+7/-4) debian/changelog (+22/-3) debian/control (+4/-0) debian/rules (+4/-1) dependencies.tsv (+2/-0) ubuntu-push-client.go (+4/-0) util/auth.go (+36/-0) util/auth_test.go (+53/-0) |
||||
To merge this branch: | bzr merge lp:~chipaca/ubuntu-push/auth-packaging | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Diogo Baeder (community) | Approve | ||
Review via email: mp+215868@code.launchpad.net |
Commit message
Packaging for the auth branch.
Description of the change
Packaging for the auth branch.
Includes the auth branch.
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~chipaca/ubuntu-push/auth-packaging into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.
mkdir -p /mnt/tarmac/
mkdir -p /mnt/tarmac/
go get -u launchpad.
go get -d -u launchpad.
/mnt/tarmac/
"/mnt/tarmac/
"/mnt/tarmac/
"/mnt/tarmac/
go install launchpad.
# gopkg.in/qml.v0
../../gopkg.
make: *** [bootstrap] Error 2
Preview Diff
1 | === modified file 'Makefile' | |||
2 | --- Makefile 2014-03-31 17:58:54 +0000 | |||
3 | +++ Makefile 2014-04-15 14:48:44 +0000 | |||
4 | @@ -11,10 +11,13 @@ | |||
5 | 11 | GODEPS += launchpad.net/go-dbus/v1 | 11 | GODEPS += launchpad.net/go-dbus/v1 |
6 | 12 | GODEPS += launchpad.net/go-xdg/v0 | 12 | GODEPS += launchpad.net/go-xdg/v0 |
7 | 13 | GODEPS += code.google.com/p/gosqlite/sqlite3 | 13 | GODEPS += code.google.com/p/gosqlite/sqlite3 |
8 | 14 | GODEPS += gopkg.in/qml.v0 | ||
9 | 15 | GODEPS += gopkg.in/niemeyer/uoneauth.v1 | ||
10 | 14 | 16 | ||
11 | 15 | TOTEST = $(shell env GOPATH=$(GOPATH) go list $(PROJECT)/...|grep -v acceptance|grep -v http13client ) | 17 | TOTEST = $(shell env GOPATH=$(GOPATH) go list $(PROJECT)/...|grep -v acceptance|grep -v http13client ) |
12 | 16 | 18 | ||
13 | 17 | bootstrap: | 19 | bootstrap: |
14 | 20 | $(RM) -r $(GOPATH)/pkg | ||
15 | 18 | mkdir -p $(GOPATH)/bin | 21 | mkdir -p $(GOPATH)/bin |
16 | 19 | mkdir -p $(GOPATH)/pkg | 22 | mkdir -p $(GOPATH)/pkg |
17 | 20 | go get -u launchpad.net/godeps | 23 | go get -u launchpad.net/godeps |
18 | 21 | 24 | ||
19 | === modified file 'README' | |||
20 | --- README 2014-03-31 17:58:54 +0000 | |||
21 | +++ README 2014-04-15 14:48:44 +0000 | |||
22 | @@ -6,11 +6,20 @@ | |||
23 | 6 | The code expects to be checked out as launchpad.net/ubuntu-push in a Go | 6 | The code expects to be checked out as launchpad.net/ubuntu-push in a Go |
24 | 7 | workspace, see "go help gopath". | 7 | workspace, see "go help gopath". |
25 | 8 | 8 | ||
27 | 9 | To setup Go dependencies, install libsqlite3-dev and run: | 9 | To setup Go dependencies, install the following libraries: |
28 | 10 | |||
29 | 11 | libsqlite3-dev | ||
30 | 12 | qtbase5-private-dev | ||
31 | 13 | qtdeclarative5-dev | ||
32 | 14 | libqt5opengl5-dev | ||
33 | 15 | libubuntuoneauth-2.0-dev | ||
34 | 16 | |||
35 | 17 | and run: | ||
36 | 10 | 18 | ||
37 | 11 | make bootstrap | 19 | make bootstrap |
38 | 12 | 20 | ||
40 | 13 | To run tests, install libgcrypt11-dev and libwhoopsie-dev and run: | 21 | To run tests, install libgcrypt11-dev, libwhoopsie-dev, and |
41 | 22 | libubuntuoneauth-2.0-dev and run: | ||
42 | 14 | 23 | ||
43 | 15 | make check | 24 | make check |
44 | 16 | 25 | ||
45 | 17 | 26 | ||
46 | === modified file 'client/client.go' | |||
47 | --- client/client.go 2014-04-11 19:09:11 +0000 | |||
48 | +++ client/client.go 2014-04-15 14:48:44 +0000 | |||
49 | @@ -26,6 +26,7 @@ | |||
50 | 26 | "os" | 26 | "os" |
51 | 27 | "strings" | 27 | "strings" |
52 | 28 | 28 | ||
53 | 29 | "gopkg.in/qml.v0" | ||
54 | 29 | "launchpad.net/go-dbus/v1" | 30 | "launchpad.net/go-dbus/v1" |
55 | 30 | 31 | ||
56 | 31 | "launchpad.net/ubuntu-push/bus" | 32 | "launchpad.net/ubuntu-push/bus" |
57 | @@ -42,6 +43,11 @@ | |||
58 | 42 | "launchpad.net/ubuntu-push/whoopsie/identifier" | 43 | "launchpad.net/ubuntu-push/whoopsie/identifier" |
59 | 43 | ) | 44 | ) |
60 | 44 | 45 | ||
61 | 46 | var ( | ||
62 | 47 | getAuthorization = util.GetAuthorization | ||
63 | 48 | shouldGetAuth = false | ||
64 | 49 | ) | ||
65 | 50 | |||
66 | 45 | // ClientConfig holds the client configuration | 51 | // ClientConfig holds the client configuration |
67 | 46 | type ClientConfig struct { | 52 | type ClientConfig struct { |
68 | 47 | connectivity.ConnectivityConfig // q.v. | 53 | connectivity.ConnectivityConfig // q.v. |
69 | @@ -79,6 +85,7 @@ | |||
70 | 79 | actionsCh <-chan notifications.RawActionReply | 85 | actionsCh <-chan notifications.RawActionReply |
71 | 80 | session *session.ClientSession | 86 | session *session.ClientSession |
72 | 81 | sessionConnectedCh chan uint32 | 87 | sessionConnectedCh chan uint32 |
73 | 88 | auth string | ||
74 | 82 | } | 89 | } |
75 | 83 | 90 | ||
76 | 84 | var ACTION_ID_SNOWFLAKE = "::ubuntu-push-client::" | 91 | var ACTION_ID_SNOWFLAKE = "::ubuntu-push-client::" |
77 | @@ -111,6 +118,17 @@ | |||
78 | 111 | 118 | ||
79 | 112 | // later, we'll be specifying more logging options in the config file | 119 | // later, we'll be specifying more logging options in the config file |
80 | 113 | client.log = logger.NewSimpleLogger(os.Stderr, client.config.LogLevel.Level()) | 120 | client.log = logger.NewSimpleLogger(os.Stderr, client.config.LogLevel.Level()) |
81 | 121 | qml.SetLogger(client.log) | ||
82 | 122 | |||
83 | 123 | // grab the authorization string from the accounts | ||
84 | 124 | // TODO: remove this condition when we have a way to deal with failing authorizations | ||
85 | 125 | if shouldGetAuth { | ||
86 | 126 | auth, err := getAuthorization() | ||
87 | 127 | if err != nil { | ||
88 | 128 | return fmt.Errorf("unable to get the authorization token from the account: %v", err) | ||
89 | 129 | } | ||
90 | 130 | client.auth = auth | ||
91 | 131 | } | ||
92 | 114 | 132 | ||
93 | 115 | // overridden for testing | 133 | // overridden for testing |
94 | 116 | client.idder = identifier.New() | 134 | client.idder = identifier.New() |
95 | @@ -144,8 +162,9 @@ | |||
96 | 144 | ExchangeTimeout: client.config.ExchangeTimeout.TimeDuration(), | 162 | ExchangeTimeout: client.config.ExchangeTimeout.TimeDuration(), |
97 | 145 | HostsCachingExpiryTime: client.config.HostsCachingExpiryTime.TimeDuration(), | 163 | HostsCachingExpiryTime: client.config.HostsCachingExpiryTime.TimeDuration(), |
98 | 146 | ExpectAllRepairedTime: client.config.ExpectAllRepairedTime.TimeDuration(), | 164 | ExpectAllRepairedTime: client.config.ExpectAllRepairedTime.TimeDuration(), |
101 | 147 | PEM: client.pem, | 165 | PEM: client.pem, |
102 | 148 | Info: info, | 166 | Info: info, |
103 | 167 | Authorization: client.auth, | ||
104 | 149 | } | 168 | } |
105 | 150 | } | 169 | } |
106 | 151 | 170 | ||
107 | 152 | 171 | ||
108 | === modified file 'client/client_test.go' | |||
109 | --- client/client_test.go 2014-04-11 19:07:27 +0000 | |||
110 | +++ client/client_test.go 2014-04-15 14:48:44 +0000 | |||
111 | @@ -85,11 +85,17 @@ | |||
112 | 85 | config.IgnoreParsedFlags = true // because configure() uses <flags> | 85 | config.IgnoreParsedFlags = true // because configure() uses <flags> |
113 | 86 | cs.timeouts = util.SwapTimeouts([]time.Duration{0}) | 86 | cs.timeouts = util.SwapTimeouts([]time.Duration{0}) |
114 | 87 | cs.leveldbPath = "" | 87 | cs.leveldbPath = "" |
115 | 88 | getAuthorization = func() (string, error) { | ||
116 | 89 | return "some auth", nil | ||
117 | 90 | } | ||
118 | 91 | shouldGetAuth = true | ||
119 | 88 | } | 92 | } |
120 | 89 | 93 | ||
121 | 90 | func (cs *clientSuite) TearDownSuite(c *C) { | 94 | func (cs *clientSuite) TearDownSuite(c *C) { |
122 | 91 | util.SwapTimeouts(cs.timeouts) | 95 | util.SwapTimeouts(cs.timeouts) |
123 | 92 | cs.timeouts = nil | 96 | cs.timeouts = nil |
124 | 97 | getAuthorization = util.GetAuthorization | ||
125 | 98 | shouldGetAuth = false | ||
126 | 93 | } | 99 | } |
127 | 94 | 100 | ||
128 | 95 | func (cs *clientSuite) writeTestConfig(overrides map[string]interface{}) { | 101 | func (cs *clientSuite) writeTestConfig(overrides map[string]interface{}) { |
129 | @@ -200,6 +206,14 @@ | |||
130 | 200 | c.Assert(cli.connCh, NotNil) | 206 | c.Assert(cli.connCh, NotNil) |
131 | 201 | } | 207 | } |
132 | 202 | 208 | ||
133 | 209 | func (cs *clientSuite) TestConfigureSetsUpAuth(c *C) { | ||
134 | 210 | cli := NewPushClient(cs.configPath, cs.leveldbPath) | ||
135 | 211 | c.Check(cli.auth, Equals, "") | ||
136 | 212 | err := cli.configure() | ||
137 | 213 | c.Assert(err, IsNil) | ||
138 | 214 | c.Assert(cli.auth, Equals, "some auth") | ||
139 | 215 | } | ||
140 | 216 | |||
141 | 203 | func (cs *clientSuite) TestConfigureBailsOnBadFilename(c *C) { | 217 | func (cs *clientSuite) TestConfigureBailsOnBadFilename(c *C) { |
142 | 204 | cli := NewPushClient("/does/not/exist", cs.leveldbPath) | 218 | cli := NewPushClient("/does/not/exist", cs.leveldbPath) |
143 | 205 | err := cli.configure() | 219 | err := cli.configure() |
144 | @@ -265,8 +279,9 @@ | |||
145 | 265 | ExchangeTimeout: 10 * time.Millisecond, | 279 | ExchangeTimeout: 10 * time.Millisecond, |
146 | 266 | HostsCachingExpiryTime: 1 * time.Hour, | 280 | HostsCachingExpiryTime: 1 * time.Hour, |
147 | 267 | ExpectAllRepairedTime: 30 * time.Minute, | 281 | ExpectAllRepairedTime: 30 * time.Minute, |
150 | 268 | PEM: cli.pem, | 282 | PEM: cli.pem, |
151 | 269 | Info: info, | 283 | Info: info, |
152 | 284 | Authorization: "some auth", | ||
153 | 270 | } | 285 | } |
154 | 271 | // sanity check that we are looking at all fields | 286 | // sanity check that we are looking at all fields |
155 | 272 | vExpected := reflect.ValueOf(expected) | 287 | vExpected := reflect.ValueOf(expected) |
156 | 273 | 288 | ||
157 | === modified file 'client/session/session.go' | |||
158 | --- client/session/session.go 2014-04-04 13:55:00 +0000 | |||
159 | +++ client/session/session.go 2014-04-15 14:48:44 +0000 | |||
160 | @@ -84,6 +84,7 @@ | |||
161 | 84 | ExpectAllRepairedTime time.Duration | 84 | ExpectAllRepairedTime time.Duration |
162 | 85 | PEM []byte | 85 | PEM []byte |
163 | 86 | Info map[string]interface{} | 86 | Info map[string]interface{} |
164 | 87 | Authorization string | ||
165 | 87 | } | 88 | } |
166 | 88 | 89 | ||
167 | 89 | // ClientSession holds a client<->server session and its configuration. | 90 | // ClientSession holds a client<->server session and its configuration. |
168 | @@ -115,6 +116,8 @@ | |||
169 | 115 | stateP *uint32 | 116 | stateP *uint32 |
170 | 116 | ErrCh chan error | 117 | ErrCh chan error |
171 | 117 | MsgCh chan *Notification | 118 | MsgCh chan *Notification |
172 | 119 | // authorization | ||
173 | 120 | auth string | ||
174 | 118 | } | 121 | } |
175 | 119 | 122 | ||
176 | 120 | func NewSession(serverAddrSpec string, conf ClientSessionConfig, | 123 | func NewSession(serverAddrSpec string, conf ClientSessionConfig, |
177 | @@ -142,6 +145,7 @@ | |||
178 | 142 | TLS: &tls.Config{InsecureSkipVerify: true}, // XXX | 145 | TLS: &tls.Config{InsecureSkipVerify: true}, // XXX |
179 | 143 | stateP: &state, | 146 | stateP: &state, |
180 | 144 | timeSince: time.Since, | 147 | timeSince: time.Since, |
181 | 148 | auth: conf.Authorization, | ||
182 | 145 | } | 149 | } |
183 | 146 | if sess.PEM != nil { | 150 | if sess.PEM != nil { |
184 | 147 | cp := x509.NewCertPool() | 151 | cp := x509.NewCertPool() |
185 | @@ -409,10 +413,9 @@ | |||
186 | 409 | return err | 413 | return err |
187 | 410 | } | 414 | } |
188 | 411 | err = proto.WriteMessage(protocol.ConnectMsg{ | 415 | err = proto.WriteMessage(protocol.ConnectMsg{ |
193 | 412 | Type: "connect", | 416 | Type: "connect", |
194 | 413 | DeviceId: sess.DeviceId, | 417 | DeviceId: sess.DeviceId, |
195 | 414 | // xxx get the SSO Authorization string from the phone | 418 | Authorization: sess.auth, |
192 | 415 | Authorization: "", | ||
196 | 416 | Levels: levels, | 419 | Levels: levels, |
197 | 417 | Info: sess.Info, | 420 | Info: sess.Info, |
198 | 418 | }) | 421 | }) |
199 | 419 | 422 | ||
200 | === modified file 'client/session/session_test.go' | |||
201 | --- client/session/session_test.go 2014-04-04 13:55:00 +0000 | |||
202 | +++ client/session/session_test.go 2014-04-15 14:48:44 +0000 | |||
203 | @@ -852,9 +852,10 @@ | |||
204 | 852 | 852 | ||
205 | 853 | c.Check(takeNext(downCh), Equals, "deadline 0") | 853 | c.Check(takeNext(downCh), Equals, "deadline 0") |
206 | 854 | c.Check(takeNext(downCh), DeepEquals, protocol.ConnectMsg{ | 854 | c.Check(takeNext(downCh), DeepEquals, protocol.ConnectMsg{ |
210 | 855 | Type: "connect", | 855 | Type: "connect", |
211 | 856 | DeviceId: sess.DeviceId, | 856 | DeviceId: sess.DeviceId, |
212 | 857 | Levels: map[string]int64{}, | 857 | Levels: map[string]int64{}, |
213 | 858 | Authorization: "", | ||
214 | 858 | }) | 859 | }) |
215 | 859 | upCh <- errors.New("Overflow error in /dev/null") | 860 | upCh <- errors.New("Overflow error in /dev/null") |
216 | 860 | err = <-errCh | 861 | err = <-errCh |
217 | @@ -940,7 +941,8 @@ | |||
218 | 940 | "bar": "baz", | 941 | "bar": "baz", |
219 | 941 | } | 942 | } |
220 | 942 | conf := ClientSessionConfig{ | 943 | conf := ClientSessionConfig{ |
222 | 943 | Info: info, | 944 | Info: info, |
223 | 945 | Authorization: "some auth", | ||
224 | 944 | } | 946 | } |
225 | 945 | sess, err := NewSession("", conf, "wah", cs.lvls, cs.log) | 947 | sess, err := NewSession("", conf, "wah", cs.lvls, cs.log) |
226 | 946 | c.Assert(err, IsNil) | 948 | c.Assert(err, IsNil) |
227 | @@ -959,6 +961,7 @@ | |||
228 | 959 | msg, ok := takeNext(downCh).(protocol.ConnectMsg) | 961 | msg, ok := takeNext(downCh).(protocol.ConnectMsg) |
229 | 960 | c.Check(ok, Equals, true) | 962 | c.Check(ok, Equals, true) |
230 | 961 | c.Check(msg.DeviceId, Equals, "wah") | 963 | c.Check(msg.DeviceId, Equals, "wah") |
231 | 964 | c.Check(msg.Authorization, Equals, "some auth") | ||
232 | 962 | c.Check(msg.Info, DeepEquals, info) | 965 | c.Check(msg.Info, DeepEquals, info) |
233 | 963 | upCh <- nil // no error | 966 | upCh <- nil // no error |
234 | 964 | upCh <- protocol.ConnAckMsg{ | 967 | upCh <- protocol.ConnAckMsg{ |
235 | 965 | 968 | ||
236 | === modified file 'debian/changelog' | |||
237 | --- debian/changelog 2014-04-11 10:20:27 +0000 | |||
238 | +++ debian/changelog 2014-04-15 14:48:44 +0000 | |||
239 | @@ -1,8 +1,27 @@ | |||
242 | 1 | ubuntu-push (0.2-0ubuntu1) UNRELEASED; urgency=medium | 1 | ubuntu-push (0.21-0.ubuntu1) UNRELEASED; urgency=medium |
243 | 2 | 2 | ||
244 | 3 | * New upstream release: first auth bits, and Qt dependency. | ||
245 | 4 | |||
246 | 5 | -- John Lenton <john.lenton@canonical.com> Tue, 15 Apr 2014 14:04:35 +0100 | ||
247 | 6 | |||
248 | 7 | ubuntu-push (0.2+14.04.20140411-0ubuntu1) trusty; urgency=medium | ||
249 | 8 | |||
250 | 9 | [ John Lenton ] | ||
251 | 3 | * New upstream release. | 10 | * New upstream release. |
252 | 4 | 11 | ||
254 | 5 | -- John Lenton <john.lenton@canonical.com> Fri, 11 Apr 2014 11:19:42 +0100 | 12 | [ Richard Huddie ] |
255 | 13 | * added basic autopilot framework | ||
256 | 14 | * configparser and http post updates | ||
257 | 15 | * removed tests folder | ||
258 | 16 | |||
259 | 17 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 11 Apr 2014 18:31:57 +0000 | ||
260 | 18 | |||
261 | 19 | ubuntu-push (0.1+14.04.20140404-0ubuntu1) trusty; urgency=low | ||
262 | 20 | |||
263 | 21 | [ Tarmac ] | ||
264 | 22 | * Merge automatic into trunk. | ||
265 | 23 | |||
266 | 24 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 04 Apr 2014 14:52:06 +0000 | ||
267 | 6 | 25 | ||
268 | 7 | ubuntu-push (0.1+14.04.20140327-0ubuntu1) trusty; urgency=medium | 26 | ubuntu-push (0.1+14.04.20140327-0ubuntu1) trusty; urgency=medium |
269 | 8 | 27 | ||
270 | 9 | 28 | ||
271 | === modified file 'debian/control' | |||
272 | --- debian/control 2014-03-25 16:26:20 +0000 | |||
273 | +++ debian/control 2014-04-15 14:48:44 +0000 | |||
274 | @@ -14,6 +14,10 @@ | |||
275 | 14 | libgcrypt11-dev, | 14 | libgcrypt11-dev, |
276 | 15 | libglib2.0-dev (>= 2.31.6), | 15 | libglib2.0-dev (>= 2.31.6), |
277 | 16 | libwhoopsie-dev, | 16 | libwhoopsie-dev, |
278 | 17 | qtbase5-private-dev, | ||
279 | 18 | qtdeclarative5-dev, | ||
280 | 19 | libqt5opengl5-dev, | ||
281 | 20 | libubuntuoneauth-2.0-dev, | ||
282 | 17 | Standards-Version: 3.9.5 | 21 | Standards-Version: 3.9.5 |
283 | 18 | Homepage: http://launchpad.net/ubuntu-push | 22 | Homepage: http://launchpad.net/ubuntu-push |
284 | 19 | Vcs-Bzr: lp:ubuntu-push | 23 | Vcs-Bzr: lp:ubuntu-push |
285 | 20 | 24 | ||
286 | === modified file 'debian/rules' | |||
287 | --- debian/rules 2014-03-24 12:22:55 +0000 | |||
288 | +++ debian/rules 2014-04-15 14:48:44 +0000 | |||
289 | @@ -2,9 +2,12 @@ | |||
290 | 2 | # -*- makefile -*- | 2 | # -*- makefile -*- |
291 | 3 | 3 | ||
292 | 4 | export DH_GOPKG := launchpad.net/ubuntu-push | 4 | export DH_GOPKG := launchpad.net/ubuntu-push |
293 | 5 | export DEB_BUILD_OPTIONS := nostrip | ||
294 | 6 | export UBUNTU_PUSH_TEST_RESOURCES_ROOT := $(CURDIR) | 5 | export UBUNTU_PUSH_TEST_RESOURCES_ROOT := $(CURDIR) |
295 | 7 | 6 | ||
296 | 7 | override_dh_auto_build: | ||
297 | 8 | cd $$( find ./ -type d -regex '\./[^/]*/src/launchpad.net' -printf "%h\n" | head -n1) && tar xvzf ../../externals.tgz | ||
298 | 9 | dh_auto_build --buildsystem=golang | ||
299 | 10 | |||
300 | 8 | override_dh_install: | 11 | override_dh_install: |
301 | 9 | dh_install -Xusr/bin/cmd -Xusr/bin/dev --fail-missing | 12 | dh_install -Xusr/bin/cmd -Xusr/bin/dev --fail-missing |
302 | 10 | 13 | ||
303 | 11 | 14 | ||
304 | === modified file 'dependencies.tsv' | |||
305 | --- dependencies.tsv 2014-03-12 13:23:26 +0000 | |||
306 | +++ dependencies.tsv 2014-04-15 14:48:44 +0000 | |||
307 | @@ -2,3 +2,5 @@ | |||
308 | 2 | launchpad.net/go-dbus/v1 bzr james@jamesh.id.au-20140206110213-pbzcr6ucaz3rqmnw 125 | 2 | launchpad.net/go-dbus/v1 bzr james@jamesh.id.au-20140206110213-pbzcr6ucaz3rqmnw 125 |
309 | 3 | launchpad.net/go-xdg/v0 bzr john.lenton@canonical.com-20140208094800-gubd5md7cro3mtxa 10 | 3 | launchpad.net/go-xdg/v0 bzr john.lenton@canonical.com-20140208094800-gubd5md7cro3mtxa 10 |
310 | 4 | launchpad.net/gocheck bzr gustavo@niemeyer.net-20140127131816-zshobk1qqme626xw 86 | 4 | launchpad.net/gocheck bzr gustavo@niemeyer.net-20140127131816-zshobk1qqme626xw 86 |
311 | 5 | gopkg.in/qml.v0 git master 8adbc8c2bf2da9f609df366683ad0f47a89c3d49 | ||
312 | 6 | gopkg.in/niemeyer/uoneauth.v1 git v1 0758ba882a143ad2862dbcac85a7ca145750b640 | ||
313 | 5 | 7 | ||
314 | === added file 'externals.tgz' | |||
315 | 6 | Binary files externals.tgz 1970-01-01 00:00:00 +0000 and externals.tgz 2014-04-15 14:48:44 +0000 differ | 8 | Binary files externals.tgz 1970-01-01 00:00:00 +0000 and externals.tgz 2014-04-15 14:48:44 +0000 differ |
316 | === modified file 'ubuntu-push-client.go' | |||
317 | --- ubuntu-push-client.go 2014-04-15 11:27:38 +0000 | |||
318 | +++ ubuntu-push-client.go 2014-04-15 14:48:44 +0000 | |||
319 | @@ -19,6 +19,7 @@ | |||
320 | 19 | import ( | 19 | import ( |
321 | 20 | "log" | 20 | "log" |
322 | 21 | 21 | ||
323 | 22 | "gopkg.in/qml.v0" | ||
324 | 22 | "launchpad.net/go-dbus/v1" | 23 | "launchpad.net/go-dbus/v1" |
325 | 23 | "launchpad.net/go-xdg/v0" | 24 | "launchpad.net/go-xdg/v0" |
326 | 24 | 25 | ||
327 | @@ -58,6 +59,9 @@ | |||
328 | 58 | if err != nil { | 59 | if err != nil { |
329 | 59 | log.Fatalf("unable to open the levels database: %v", err) | 60 | log.Fatalf("unable to open the levels database: %v", err) |
330 | 60 | } | 61 | } |
331 | 62 | |||
332 | 63 | qml.Init(nil) | ||
333 | 64 | |||
334 | 61 | cli := client.NewPushClient(cfgFname, lvlFname) | 65 | cli := client.NewPushClient(cfgFname, lvlFname) |
335 | 62 | err = cli.Start() | 66 | err = cli.Start() |
336 | 63 | if err != nil { | 67 | if err != nil { |
337 | 64 | 68 | ||
338 | === added file 'util/auth.go' | |||
339 | --- util/auth.go 1970-01-01 00:00:00 +0000 | |||
340 | +++ util/auth.go 2014-04-15 14:48:44 +0000 | |||
341 | @@ -0,0 +1,36 @@ | |||
342 | 1 | /* | ||
343 | 2 | Copyright 2013-2014 Canonical Ltd. | ||
344 | 3 | |||
345 | 4 | This program is free software: you can redistribute it and/or modify it | ||
346 | 5 | under the terms of the GNU General Public License version 3, as published | ||
347 | 6 | by the Free Software Foundation. | ||
348 | 7 | |||
349 | 8 | This program is distributed in the hope that it will be useful, but | ||
350 | 9 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
351 | 10 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
352 | 11 | PURPOSE. See the GNU General Public License for more details. | ||
353 | 12 | |||
354 | 13 | You should have received a copy of the GNU General Public License along | ||
355 | 14 | with this program. If not, see <http://www.gnu.org/licenses/>. | ||
356 | 15 | */ | ||
357 | 16 | |||
358 | 17 | package util | ||
359 | 18 | |||
360 | 19 | import ( | ||
361 | 20 | "gopkg.in/niemeyer/uoneauth.v1" | ||
362 | 21 | "gopkg.in/qml.v0" | ||
363 | 22 | ) | ||
364 | 23 | |||
365 | 24 | func GetAuthorization() (string, error) { | ||
366 | 25 | engine := qml.NewEngine() | ||
367 | 26 | defer engine.Destroy() | ||
368 | 27 | authService := uoneauth.NewService(engine) | ||
369 | 28 | var auth string | ||
370 | 29 | token, err := authService.Token() | ||
371 | 30 | if err != nil { | ||
372 | 31 | return "", err | ||
373 | 32 | } else { | ||
374 | 33 | auth = token.HeaderSignature("POST", "https://push.ubuntu.com") | ||
375 | 34 | } | ||
376 | 35 | return auth, nil | ||
377 | 36 | } | ||
378 | 0 | 37 | ||
379 | === added file 'util/auth_test.go' | |||
380 | --- util/auth_test.go 1970-01-01 00:00:00 +0000 | |||
381 | +++ util/auth_test.go 2014-04-15 14:48:44 +0000 | |||
382 | @@ -0,0 +1,53 @@ | |||
383 | 1 | /* | ||
384 | 2 | Copyright 2013-2014 Canonical Ltd. | ||
385 | 3 | |||
386 | 4 | This program is free software: you can redistribute it and/or modify it | ||
387 | 5 | under the terms of the GNU General Public License version 3, as published | ||
388 | 6 | by the Free Software Foundation. | ||
389 | 7 | |||
390 | 8 | This program is distributed in the hope that it will be useful, but | ||
391 | 9 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
392 | 10 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
393 | 11 | PURPOSE. See the GNU General Public License for more details. | ||
394 | 12 | |||
395 | 13 | You should have received a copy of the GNU General Public License along | ||
396 | 14 | with this program. If not, see <http://www.gnu.org/licenses/>. | ||
397 | 15 | */ | ||
398 | 16 | |||
399 | 17 | package util | ||
400 | 18 | |||
401 | 19 | import ( | ||
402 | 20 | "os" | ||
403 | 21 | |||
404 | 22 | "gopkg.in/qml.v0" | ||
405 | 23 | |||
406 | 24 | . "launchpad.net/gocheck" | ||
407 | 25 | ) | ||
408 | 26 | |||
409 | 27 | type authSuite struct{} | ||
410 | 28 | |||
411 | 29 | var _ = Suite(&authSuite{}) | ||
412 | 30 | |||
413 | 31 | func (s *authSuite) SetUpSuite(c *C) { | ||
414 | 32 | if os.Getenv("PUSH_AUTH_TEST") == "1" { | ||
415 | 33 | qml.Init(nil) | ||
416 | 34 | } | ||
417 | 35 | } | ||
418 | 36 | |||
419 | 37 | func (s *authSuite) SetUpTest(c *C) { | ||
420 | 38 | qml.SetLogger(c) | ||
421 | 39 | } | ||
422 | 40 | |||
423 | 41 | func (s *authSuite) TestGetAuth(c *C) { | ||
424 | 42 | /* | ||
425 | 43 | * This test is only useful when the PUSH_AUTH_TEST environment | ||
426 | 44 | * variable is set to "1" - in which case the runner should have | ||
427 | 45 | * a Ubuntu One account setup via system-settings. | ||
428 | 46 | */ | ||
429 | 47 | if os.Getenv("PUSH_AUTH_TEST") != "1" { | ||
430 | 48 | c.Skip("PUSH_AUTH_TEST not set to '1'") | ||
431 | 49 | } | ||
432 | 50 | auth, err := GetAuthorization() | ||
433 | 51 | c.Assert(err, IsNil) | ||
434 | 52 | c.Assert(auth, Matches, "OAuth .*oauth_consumer_key=.*") | ||
435 | 53 | } |
Looks good to me.