Merge lp:~chipaca/ubuntu-push/auth-packaging into lp:ubuntu-push/automatic

Proposed by John Lenton
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
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.

To post a comment you must log in.
Revision history for this message
Diogo Baeder (diogobaeder) wrote :

Looks good to me.

review: Approve
Revision history for this message
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/cache/ubuntu-push-automatic/go-ws/bin
mkdir -p /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/pkg
go get -u launchpad.net/godeps
go get -d -u launchpad.net/gocheck launchpad.net/go-dbus/v1 launchpad.net/go-xdg/v0 code.google.com/p/gosqlite/sqlite3 gopkg.in/qml.v0 gopkg.in/niemeyer/uoneauth.v1
/mnt/tarmac/cache/ubuntu-push-automatic/go-ws/bin/godeps -u dependencies.tsv
"/mnt/tarmac/cache/ubuntu-push-automatic/go-ws/src/launchpad.net/gocheck" now at <email address hidden>
"/mnt/tarmac/cache/ubuntu-push-automatic/go-ws/src/gopkg.in/qml.v0" now at master
"/mnt/tarmac/cache/ubuntu-push-automatic/go-ws/src/gopkg.in/niemeyer/uoneauth.v1" now at v1
go install launchpad.net/gocheck launchpad.net/go-dbus/v1 launchpad.net/go-xdg/v0 code.google.com/p/gosqlite/sqlite3 gopkg.in/qml.v0 gopkg.in/niemeyer/uoneauth.v1

# gopkg.in/qml.v0
../../gopkg.in/qml.v0/bridge.go:16: import /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/pkg/linux_amd64/gopkg.in/qml.v0/tref.a: object is [linux amd64 go1.2 X:none] expected [linux amd64 go1.2.1 X:none]
make: *** [bootstrap] Error 2

Preview Diff

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

Subscribers

People subscribed via source and target branches