Merge lp:~chipaca/ubuntu-push/nih into lp:ubuntu-push/automatic

Proposed by John Lenton
Status: Work in progress
Proposed branch: lp:~chipaca/ubuntu-push/nih
Merge into: lp:ubuntu-push/automatic
Diff against target: 192 lines (+132/-12)
6 files modified
.bzrignore (+1/-0)
Makefile (+11/-1)
PACKAGE_DEPS (+9/-0)
README (+17/-11)
client/service/nih.go (+56/-0)
client/service/nih_test.go (+38/-0)
To merge this branch: bzr merge lp:~chipaca/ubuntu-push/nih
Reviewer Review Type Date Requested Status
Samuele Pedroni Approve
Review via email: mp+219843@code.launchpad.net

Commit message

Wrap nih to provide an appid -> dbus object path map.

Description of the change

Wrap nih to provide an appid -> dbus object path map.

To post a comment you must log in.
Revision history for this message
Samuele Pedroni (pedronis) wrote :

70 +development environment. THe Ubuntu packagenames for these are listed

typo: THe

Revision history for this message
Samuele Pedroni (pedronis) :
review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (5.2 KiB)

The attempt to merge lp:~chipaca/ubuntu-push/nih into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.

rm -f -r /mnt/tarmac/cache/ubuntu-push-automatic/go-ws/pkg
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 launchpad.net/~ubuntu-push-hackers/ubuntu-push/go-uuid/uuid
/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>
go install launchpad.net/gocheck launchpad.net/go-dbus/v1 launchpad.net/go-xdg/v0 code.google.com/p/gosqlite/sqlite3 launchpad.net/~ubuntu-push-hackers/ubuntu-push/go-uuid/uuid
go test launchpad.net/ubuntu-push launchpad.net/ubuntu-push/bus launchpad.net/ubuntu-push/bus/connectivity launchpad.net/ubuntu-push/bus/networkmanager launchpad.net/ubuntu-push/bus/notifications launchpad.net/ubuntu-push/bus/systemimage launchpad.net/ubuntu-push/bus/testing launchpad.net/ubuntu-push/bus/urldispatcher launchpad.net/ubuntu-push/client launchpad.net/ubuntu-push/client/gethosts launchpad.net/ubuntu-push/client/service launchpad.net/ubuntu-push/client/session launchpad.net/ubuntu-push/client/session/seenstate launchpad.net/ubuntu-push/config launchpad.net/ubuntu-push/external/murmur3 launchpad.net/ubuntu-push/logger launchpad.net/ubuntu-push/protocol launchpad.net/ubuntu-push/server launchpad.net/ubuntu-push/server/api launchpad.net/ubuntu-push/server/broker launchpad.net/ubuntu-push/server/broker/simple launchpad.net/ubuntu-push/server/broker/testing launchpad.net/ubuntu-push/server/broker/testsuite launchpad.net/ubuntu-push/server/dev launchpad.net/ubuntu-push/server/listener launchpad.net/ubuntu-push/server/session launchpad.net/ubuntu-push/server/store launchpad.net/ubuntu-push/testing launchpad.net/ubuntu-push/testing/condition launchpad.net/ubuntu-push/util launchpad.net/ubuntu-push/whoopsie launchpad.net/ubuntu-push/whoopsie/identifier launchpad.net/ubuntu-push/whoopsie/identifier/testing
? launchpad.net/ubuntu-push [no test files]
ok launchpad.net/ubuntu-push/bus 0.009s
ok launchpad.net/ubuntu-push/bus/connectivity 1.167s
ok launchpad.net/ubuntu-push/bus/networkmanager 0.096s
ok launchpad.net/ubuntu-push/bus/notifications 0.018s
ok launchpad.net/ubuntu-push/bus/systemimage 0.014s
ok launchpad.net/ubuntu-push/bus/testing 0.032s
ok launchpad.net/ubuntu-push/bus/urldispatcher 0.008s
FAIL launchpad.net/ubuntu-push/client [build failed]
ok launchpad.net/ubuntu-push/client/gethosts 0.711s
FAIL launchpad.net/ubuntu-push/client/service [build failed]
ok launchpad.net/ubuntu-push/client/session 0.197s
ok launchpad.net/ubuntu-push/client/session/seenstate 0.178s
ok launchpad.net/ubuntu-push/config 0.035s
ok launchpad.net/ubuntu-push/external/murmur3 0.008s
ok launchpad.net/ubuntu-push/logger 0.009s
ok launchpad.net/ubuntu-push/protocol 0.013s
ok launchpad.net/ubuntu-push/server 0.041s
ok launchpad.net/ubuntu...

Read more...

Unmerged revisions

162. By John Lenton

typo and doc improvement

161. By John Lenton

README/Makefile & PACKAGE_DEPS

160. By John Lenton

nih

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2014-05-08 22:42:35 +0000
+++ .bzrignore 2014-05-16 16:25:28 +0000
@@ -20,3 +20,4 @@
20signing-helper/moc_signing.cpp20signing-helper/moc_signing.cpp
21signing-helper/signing-helper21signing-helper/signing-helper
22signing-helper/signing-helper_automoc.cpp22signing-helper/signing-helper_automoc.cpp
23.has-fetched-deps
2324
=== modified file 'Makefile'
--- Makefile 2014-05-08 22:42:35 +0000
+++ Makefile 2014-05-16 16:25:28 +0000
@@ -15,6 +15,15 @@
1515
16TOTEST = $(shell env GOPATH=$(GOPATH) go list $(PROJECT)/...|grep -v acceptance|grep -v http13client )16TOTEST = $(shell env GOPATH=$(GOPATH) go list $(PROJECT)/...|grep -v acceptance|grep -v http13client )
1717
18fetchdeps: .has-fetched-deps
19
20.has-fetched-deps: PACKAGE_DEPS
21 @touch $@
22 @$(MAKE) --no-print-directory refetchdeps
23
24refetchdeps:
25 sudo apt-get install $$( cat PACKAGE_DEPS )
26
18bootstrap:27bootstrap:
19 $(RM) -r $(GOPATH)/pkg28 $(RM) -r $(GOPATH)/pkg
20 mkdir -p $(GOPATH)/bin29 mkdir -p $(GOPATH)/bin
@@ -78,4 +87,5 @@
7887
79.PHONY: bootstrap check check-race format check-format \88.PHONY: bootstrap check check-race format check-format \
80 acceptance build-client build server-dev run-server-dev \89 acceptance build-client build server-dev run-server-dev \
81 coverage-summary coverage-html protocol-diagrams90 coverage-summary coverage-html protocol-diagrams \
91 fetchdeps refetchdeps
8292
=== added file 'PACKAGE_DEPS'
--- PACKAGE_DEPS 1970-01-01 00:00:00 +0000
+++ PACKAGE_DEPS 2014-05-16 16:25:28 +0000
@@ -0,0 +1,9 @@
1build-essential
2cmake
3libdbus-1-dev
4libgcrypt11-dev
5libglib2.0-dev
6libnih-dbus-dev
7libsqlite3-dev
8libubuntuoneauth-2.0-dev
9libwhoopsie-dev
010
=== modified file 'README'
--- README 2014-04-30 16:44:16 +0000
+++ README 2014-05-16 16:25:28 +0000
@@ -6,17 +6,23 @@
6The code expects to be checked out as launchpad.net/ubuntu-push in a Go6The code expects to be checked out as launchpad.net/ubuntu-push in a Go
7workspace, see "go help gopath".7workspace, see "go help gopath".
88
9To setup Go dependencies, install the following dependencies:9You need a somewhat long list of dependencies, as well as a working Go
1010development environment. The Ubuntu packagenames for these are listed
11 build-essential11in the file PACKAGE_DEPS.
12 libsqlite3-dev12
1313On Ubuntu, if you have sudo, you can have all those installed for you
14and run:14by do doing
1515
16 make bootstrap16 make fetchdeps
1717
18To run tests, install libglib2.0-dev, libgcrypt11-dev, libwhoopsie-dev,18Once you have the packaged dependencies you can get the Go
19and run:19dependencies via
20
21 make bootstrap
22
23and then you're set. Good luck!
24
25To run the tests:
2026
21 make check27 make check
2228
2329
=== added file 'client/service/nih.go'
--- client/service/nih.go 1970-01-01 00:00:00 +0000
+++ client/service/nih.go 2014-05-16 16:25:28 +0000
@@ -0,0 +1,56 @@
1/*
2 Copyright 2013-2014 Canonical Ltd.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License version 3, as published
6 by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranties of
10 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along
14 with this program. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17package service
18
19/*
20#cgo pkg-config: dbus-1 libnih libnih-dbus
21#include <stdlib.h>
22#include <nih/alloc.h>
23#include <libnih-dbus.h>
24
25char *appid2objpath (const char *root, const char *id) {
26 if (!strcmp (root, "")) return NULL;
27 return nih_dbus_path (NULL, root, id, NULL);
28}
29*/
30import "C"
31
32import (
33 "errors"
34 "unsafe"
35
36 "launchpad.net/go-dbus/v1"
37)
38
39var AppId2ObjPathError = errors.New("Empty root, or out of memory")
40
41// AppId2ObjPath uses libnih-dbus to translate an app id to a valid
42// component of an object path, and returns it under the given root.
43func AppId2ObjPath(root string, id string) (dbus.ObjectPath, error) {
44 cid := C.CString(id)
45 defer C.free(unsafe.Pointer(cid))
46 croot := C.CString(root)
47 defer C.free(unsafe.Pointer(croot))
48
49 cop := C.appid2objpath(croot, cid)
50 if cop == nil {
51 return "", AppId2ObjPathError
52 }
53 defer C.nih_free(unsafe.Pointer(cop))
54
55 return dbus.ObjectPath(C.GoString(cop)), nil
56}
057
=== added file 'client/service/nih_test.go'
--- client/service/nih_test.go 1970-01-01 00:00:00 +0000
+++ client/service/nih_test.go 2014-05-16 16:25:28 +0000
@@ -0,0 +1,38 @@
1/*
2 Copyright 2013-2014 Canonical Ltd.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License version 3, as published
6 by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranties of
10 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along
14 with this program. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17package service
18
19import (
20 "launchpad.net/go-dbus/v1"
21 . "launchpad.net/gocheck"
22)
23
24type nihSuite struct{}
25
26var _ = Suite(&nihSuite{})
27
28func (ns *nihSuite) TestA2P(c *C) {
29 op, err := AppId2ObjPath("/a/b", "hello")
30 c.Check(op, Equals, dbus.ObjectPath("/a/b/hello"))
31 c.Check(err, IsNil)
32 op, err = AppId2ObjPath("/a/b", "hello world")
33 c.Check(op, Equals, dbus.ObjectPath("/a/b/hello_20world"))
34 c.Check(err, IsNil)
35 op, err = AppId2ObjPath("", "hello world")
36 c.Check(err, Equals, AppId2ObjPathError)
37 c.Check(op, Equals, dbus.ObjectPath(""))
38}

Subscribers

People subscribed via source and target branches