Merge lp:~townsend/libertine/refresh-libertine-scope into lp:libertine

Proposed by Christopher Townsend
Status: Merged
Approved by: Larry Price
Approved revision: 246
Merged at revision: 246
Proposed branch: lp:~townsend/libertine/refresh-libertine-scope
Merge into: lp:libertine
Diff against target: 80 lines (+22/-1)
3 files modified
debian/control (+2/-1)
python/libertine/utils.py (+12/-0)
tools/libertine-container-manager (+8/-0)
To merge this branch: bzr merge lp:~townsend/libertine/refresh-libertine-scope
Reviewer Review Type Date Requested Status
Larry Price Approve
Libertine CI Bot continuous-integration Approve
Review via email: mp+297472@code.launchpad.net

Commit message

Invalid Libertine Scope results after successfully installing or removing a package.

Description of the change

I tried to use the Python dbus module, but trying to find a simple way to just send a signal is not trivial. I was spending too much time trying to figure that out when the solution proposed here works.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

Should we also send a signal when we create/destroy containers?

Also see inline comments.

review: Needs Information
246. By Christopher Townsend

A few changes based on feedback.

Revision history for this message
Christopher Townsend (townsend) wrote :

> Should we also send a signal when we create/destroy containers?
For destroying, definitely yes since there are probably packages installed and they will get wiped.

For creating, well, there won't be any new packages on a freshly created container, but I guess it won't hurt.

Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

Works great, lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-06-02 18:57:43 +0000
3+++ debian/control 2016-06-15 15:57:52 +0000
4@@ -43,7 +43,8 @@
5
6 Package: libertine-tools
7 Architecture: any
8-Depends: lsb-release,
9+Depends: libglib2.0-bin,
10+ lsb-release,
11 python3-apt,
12 python3-distro-info,
13 python3-libertine,
14
15=== modified file 'python/libertine/utils.py'
16--- python/libertine/utils.py 2016-06-14 20:22:33 +0000
17+++ python/libertine/utils.py 2016-06-15 15:57:52 +0000
18@@ -19,6 +19,7 @@
19 import json
20 import os
21 import psutil
22+import shlex
23 import subprocess
24 import xdg.BaseDirectory as basedir
25
26@@ -150,3 +151,14 @@
27
28 window_manager.terminate()
29 window_manager.wait()
30+
31+
32+def refresh_libertine_scope():
33+ scopes_object_path = "/com/canonical/unity/scopes"
34+ invalidate_signal = "com.canonical.unity.scopes.InvalidateResults"
35+ libertine_scope_id = "libertine-scope.ubuntu_libertine-scope"
36+
37+ gdbus_cmd = ("gdbus emit --session --object-path %s --signal %s %s" %
38+ (scopes_object_path, invalidate_signal, libertine_scope_id))
39+
40+ subprocess.Popen(shlex.split(gdbus_cmd))
41
42=== modified file 'tools/libertine-container-manager'
43--- tools/libertine-container-manager 2016-06-07 18:23:48 +0000
44+++ tools/libertine-container-manager 2016-06-15 15:57:52 +0000
45@@ -401,6 +401,8 @@
46 sys.exit(1)
47 update_container_install_status(args.id, "ready")
48
49+ libertine.utils.refresh_libertine_scope()
50+
51
52 def destroy_container_by_id(id):
53 container = LibertineContainer(id)
54@@ -419,6 +421,8 @@
55
56 destroy_container_by_id(args.id)
57
58+ libertine.utils.refresh_libertine_scope()
59+
60
61 def install_package(args):
62 if args.id and not libertine.utils.container_exists(args.id):
63@@ -454,6 +458,8 @@
64
65 update_package_install_status(args.id, package, "installed")
66
67+ libertine.utils.refresh_libertine_scope()
68+
69
70 def remove_package_by_name(container_id, package_name, verbosity=1, readline=False):
71 fallback_status = get_package_install_status(container_id, package_name)
72@@ -484,6 +490,8 @@
73 if not remove_package_by_name(args.id, args.package, args.verbosity, args.readline):
74 sys.exit(1)
75
76+ libertine.utils.refresh_libertine_scope()
77+
78
79 def search_cache(args):
80 if args.id and not libertine.utils.container_exists(args.id):

Subscribers

People subscribed via source and target branches