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
=== modified file 'debian/control'
--- debian/control 2016-06-02 18:57:43 +0000
+++ debian/control 2016-06-15 15:57:52 +0000
@@ -43,7 +43,8 @@
4343
44Package: libertine-tools44Package: libertine-tools
45Architecture: any45Architecture: any
46Depends: lsb-release,46Depends: libglib2.0-bin,
47 lsb-release,
47 python3-apt,48 python3-apt,
48 python3-distro-info,49 python3-distro-info,
49 python3-libertine,50 python3-libertine,
5051
=== modified file 'python/libertine/utils.py'
--- python/libertine/utils.py 2016-06-14 20:22:33 +0000
+++ python/libertine/utils.py 2016-06-15 15:57:52 +0000
@@ -19,6 +19,7 @@
19import json19import json
20import os20import os
21import psutil21import psutil
22import shlex
22import subprocess23import subprocess
23import xdg.BaseDirectory as basedir24import xdg.BaseDirectory as basedir
2425
@@ -150,3 +151,14 @@
150151
151 window_manager.terminate()152 window_manager.terminate()
152 window_manager.wait()153 window_manager.wait()
154
155
156def refresh_libertine_scope():
157 scopes_object_path = "/com/canonical/unity/scopes"
158 invalidate_signal = "com.canonical.unity.scopes.InvalidateResults"
159 libertine_scope_id = "libertine-scope.ubuntu_libertine-scope"
160
161 gdbus_cmd = ("gdbus emit --session --object-path %s --signal %s %s" %
162 (scopes_object_path, invalidate_signal, libertine_scope_id))
163
164 subprocess.Popen(shlex.split(gdbus_cmd))
153165
=== modified file 'tools/libertine-container-manager'
--- tools/libertine-container-manager 2016-06-07 18:23:48 +0000
+++ tools/libertine-container-manager 2016-06-15 15:57:52 +0000
@@ -401,6 +401,8 @@
401 sys.exit(1)401 sys.exit(1)
402 update_container_install_status(args.id, "ready")402 update_container_install_status(args.id, "ready")
403403
404 libertine.utils.refresh_libertine_scope()
405
404406
405def destroy_container_by_id(id):407def destroy_container_by_id(id):
406 container = LibertineContainer(id)408 container = LibertineContainer(id)
@@ -419,6 +421,8 @@
419421
420 destroy_container_by_id(args.id)422 destroy_container_by_id(args.id)
421423
424 libertine.utils.refresh_libertine_scope()
425
422426
423def install_package(args):427def install_package(args):
424 if args.id and not libertine.utils.container_exists(args.id):428 if args.id and not libertine.utils.container_exists(args.id):
@@ -454,6 +458,8 @@
454458
455 update_package_install_status(args.id, package, "installed")459 update_package_install_status(args.id, package, "installed")
456460
461 libertine.utils.refresh_libertine_scope()
462
457463
458def remove_package_by_name(container_id, package_name, verbosity=1, readline=False):464def remove_package_by_name(container_id, package_name, verbosity=1, readline=False):
459 fallback_status = get_package_install_status(container_id, package_name)465 fallback_status = get_package_install_status(container_id, package_name)
@@ -484,6 +490,8 @@
484 if not remove_package_by_name(args.id, args.package, args.verbosity, args.readline):490 if not remove_package_by_name(args.id, args.package, args.verbosity, args.readline):
485 sys.exit(1)491 sys.exit(1)
486492
493 libertine.utils.refresh_libertine_scope()
494
487495
488def search_cache(args):496def search_cache(args):
489 if args.id and not libertine.utils.container_exists(args.id):497 if args.id and not libertine.utils.container_exists(args.id):

Subscribers

People subscribed via source and target branches