Merge lp:~chipaca/ubuntu-push/fix-1380662-for-rtm into lp:ubuntu-push/krillin-rtm

Proposed by John Lenton on 2015-01-16
Status: Merged
Approved by: John Lenton on 2015-01-19
Approved revision: 137
Merged at revision: 137
Proposed branch: lp:~chipaca/ubuntu-push/fix-1380662-for-rtm
Merge into: lp:ubuntu-push/krillin-rtm
Diff against target: 139 lines (+26/-20)
5 files modified
client/session/session.go (+3/-3)
debian/config.json (+1/-1)
launch_helper/kindpool.go (+3/-2)
launch_helper/legacy/legacy.go (+3/-4)
scripts/click-hook (+16/-10)
To merge this branch: bzr merge lp:~chipaca/ubuntu-push/fix-1380662-for-rtm
Reviewer Review Type Date Requested Status
Guillermo Gonzalez 2015-01-16 Approve on 2015-01-19
Review via email: mp+246754@code.launchpad.net

Commit Message

Cherrypick r342 from automatic/ to fix the click hook wrt legacy apps.

Description of the Change

Cherrypick r342 from automatic/ to fix the click hook wrt legacy apps.

To post a comment you must log in.
Guillermo Gonzalez (verterok) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/session/session.go'
2--- client/session/session.go 2014-10-23 19:30:24 +0000
3+++ client/session/session.go 2015-01-16 17:53:22 +0000
4@@ -430,7 +430,7 @@
5 return err
6 }
7 sess.clearShouldDelay()
8- sess.Log.Debugf("broadcast chan:%v app:%v topLevel:%d payloads:%s",
9+ sess.Log.Infof("broadcast chan:%v app:%v topLevel:%d payloads:%s",
10 bcast.ChanId, bcast.AppId, bcast.TopLevel, bcast.Payloads)
11 if bcast.ChanId == protocol.SystemChannelId {
12 // the system channel id, the only one we care about for now
13@@ -438,7 +438,7 @@
14 sess.BroadcastCh <- sess.decodeBroadcast(bcast)
15 sess.Log.Debugf("sent bcast over")
16 } else {
17- sess.Log.Debugf("what is this weird channel, %#v?", bcast.ChanId)
18+ sess.Log.Errorf("what is this weird channel, %#v?", bcast.ChanId)
19 }
20 return nil
21 }
22@@ -468,7 +468,7 @@
23 if to == nil {
24 continue
25 }
26- sess.Log.Debugf("unicast app:%v msg:%s payload:%s",
27+ sess.Log.Infof("unicast app:%v msg:%s payload:%s",
28 notif.AppId, notif.MsgId, notif.Payload)
29 sess.Log.Debugf("sending ucast over")
30 sess.NotificationsCh <- AddressedNotification{to, notif}
31
32=== modified file 'debian/config.json'
33--- debian/config.json 2014-08-21 10:47:12 +0000
34+++ debian/config.json 2015-01-16 17:53:22 +0000
35@@ -12,7 +12,7 @@
36 "recheck_timeout": "10m",
37 "connectivity_check_url": "http://start.ubuntu.com/connectivity-check.html",
38 "connectivity_check_md5": "4589f42e1546aa47ca181e5d949d310b",
39- "log_level": "debug",
40+ "log_level": "info",
41 "fallback_vibration": {"pattern": [100, 100], "repeat": 2},
42 "fallback_sound": "sounds/ubuntu/notifications/Slick.ogg",
43 "poll_interval": "5m",
44
45=== modified file 'launch_helper/kindpool.go'
46--- launch_helper/kindpool.go 2014-08-20 12:42:51 +0000
47+++ launch_helper/kindpool.go 2015-01-16 17:53:22 +0000
48@@ -294,12 +294,13 @@
49 }
50 payload, err := ioutil.ReadFile(args.FileOut)
51 if err != nil {
52- pool.log.Errorf("unable to read output from helper: %v", err)
53+ pool.log.Errorf("unable to read output from %v helper: %v", args.AppId, err)
54 } else {
55+ pool.log.Infof("%v helper output: %#v", args.AppId, payload)
56 res := &HelperResult{Input: args.Input}
57 err = json.Unmarshal(payload, &res.HelperOutput)
58 if err != nil {
59- pool.log.Debugf("failed to parse HelperOutput from helper output: %v", err)
60+ pool.log.Errorf("failed to parse HelperOutput from %v helper output: %v", args.AppId, err)
61 } else {
62 pool.chOut <- res
63 }
64
65=== modified file 'launch_helper/legacy/legacy.go'
66--- launch_helper/legacy/legacy.go 2014-08-21 18:03:49 +0000
67+++ launch_helper/legacy/legacy.go 2015-01-16 17:53:22 +0000
68@@ -55,7 +55,7 @@
69 err error
70 }
71
72-func (lhl *legacyHelperLauncher) Launch(_, progname, f1, f2 string) (string, error) {
73+func (lhl *legacyHelperLauncher) Launch(appId, progname, f1, f2 string) (string, error) {
74 comm := make(chan msg)
75
76 go func() {
77@@ -78,9 +78,8 @@
78 p_err := cmd.Wait()
79 if p_err != nil {
80 // Helper failed or got killed, log output/errors
81- lhl.log.Errorf("Legacy helper failed: %v", p_err)
82- lhl.log.Errorf("Legacy helper failed. Stdout: %s", stdout)
83- lhl.log.Errorf("Legacy helper failed. Stderr: %s", stderr)
84+ lhl.log.Errorf("Legacy helper failed: appId: %v, helper: %v, pid: %v, error: %v, stdout: %#v, stderr: %#v.",
85+ appId, progname, id, p_err, stdout.String(), stderr.String())
86 }
87 lhl.done(id)
88 }()
89
90=== modified file 'scripts/click-hook'
91--- scripts/click-hook 2014-08-04 15:37:01 +0000
92+++ scripts/click-hook 2015-01-16 17:53:22 +0000
93@@ -1,4 +1,5 @@
94 #!/usr/bin/python3
95+# -*- python -*-
96 """Collect helpers hook data into a single json file"""
97
98 import argparse
99@@ -24,25 +25,30 @@
100
101
102 def cleanup_settings():
103+ settings = Gio.Settings.new('com.ubuntu.notifications.hub')
104+ blacklist = settings.get_value('blacklist').unpack()
105+ if not blacklist:
106+ return
107+
108 clickdb = Click.DB.new()
109 clickdb.read()
110
111- pkgnames = []
112+ pkgnames = set()
113 for package in clickdb.get_packages(False):
114- pkgnames.append(package.get_property('package'))
115+ pkgnames.add(package.get_property('package'))
116
117- settings = Gio.Settings.new('com.ubuntu.notifications.hub')
118 goodapps = GLib.VariantBuilder.new(GLib.VariantType.new("a(ss)"))
119
120- for appname in settings.get_value('blacklist').unpack():
121- if appname[0] in pkgnames:
122+ dirty = False
123+
124+ for appname in blacklist:
125+ if appname[0] not in pkgnames and Gio.DesktopAppInfo.new(appname[1] + ".desktop") is None:
126+ dirty = True
127+ else:
128 goodapps.add_value(tup2variant(appname))
129- elif (appname[0] == appname[1]):
130- appinfo = Gio.DesktopAppInfo.new(appname[0] + ".desktop")
131- if not appinfo is None:
132- goodapps.add_value(tup2variant(appname))
133
134- settings.set_value('blacklist', goodapps.end())
135+ if dirty:
136+ settings.set_value('blacklist', goodapps.end())
137
138
139 def collect_helpers(helpers_data_path, helpers_data_path_tmp, hooks_path):

Subscribers

People subscribed via source and target branches