Merge lp:~ted/unity8/no-home-applications into lp:unity8

Proposed by Ted Gould
Status: Work in progress
Proposed branch: lp:~ted/unity8/no-home-applications
Merge into: lp:unity8
Prerequisite: lp:~ted/unity8/username-from-uid
Diff against target: 86 lines (+21/-6)
7 files modified
data/unity8-filewatcher.conf (+3/-4)
debian/control (+2/-1)
debian/rules (+1/-1)
debian/unity8.click-hook (+4/-0)
debian/unity8.install (+1/-0)
tools/CMakeLists.txt (+2/-0)
tools/unity8-launcher-refresh (+8/-0)
To merge this branch: bzr merge lp:~ted/unity8/no-home-applications
Reviewer Review Type Date Requested Status
Michael Terry Needs Information
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+291305@code.launchpad.net

Commit message

Use a Click hook instead of a file watch to detect installed applications

Description of the change

Currently a file watch is being used, which has a hard coded home directory in it. We can avoid that hard coded directory and the file watch by using a Click hook to send the signal. Abstracted the signal into a shell script so that both can call the same script.

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2329
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1023/
Executed test runs:
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/580
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/580
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/580/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1371
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1341
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1341
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1341
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1341/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1341
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1341/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1023/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

I like this, but a couple comments:

- The old code looked in ~/.local/share/applications, but this now looks just in .cache/unity8/click-desktops. (A) I don't have that directory on my phone, who makes that? and (B) the old location covered more than just clicks. Though I guess that would be sufficient for the Touch use case.

- The script's dbus check could more nicely look like:

set -a

if [ -z "$DBUS_SESSION_BUS_ADDRESS" -a -n "$XDG_RUNTIME_DIR" ] ; then
 . "$XDG_RUNTIME_DIR/dbus-session"
fi

review: Needs Information
Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2016-04-26 at 12:10 +0000, Michael Terry wrote:
> - The old code looked in ~/.local/share/applications, but this now
> looks just in .cache/unity8/click-desktops.
To be clear, it doesn't "look in", it gets called when that directory
is updated. The actual existence of the directory isn't important to
this. So the person calling it is click itself, there is no file watch.
> (A) I don't have that directory on my phone, who makes that? and
Click will make the directory when the hook runs. If you build a deb
and install it on your device you'll have to log in and out to make it
appear. But for anyone updating with images it should be when the
update.
> (B) the old location covered more than just clicks. Though I guess
> that would be sufficient for the Touch use case.
Yes, that's what I was targeting, but if there are use-cases for the
home directory we can talk about it.
> - The script's dbus check could more nicely look like:
>
> set -a
>
> if [ -z "$DBUS_SESSION_BUS_ADDRESS" -a -n "$XDG_RUNTIME_DIR" ] ; then
> . "$XDG_RUNTIME_DIR/dbus-session"
> fi
>

I'm not sure if the click user hooks always end up with XDG_RUNTIME_DIR
set. They're basically run through Python code that changes user in
cases of sideloading. It seems if XDG_RUNTIME_DIR is set, it is likely
that the dbus variables are set.

Revision history for this message
Michael Terry (mterry) wrote :

>> (A) I don't have that directory on my phone, who makes that? and
> Click will make the directory when the hook runs. If you build a deb
> and install it on your device you'll have to log in and out to make it
> appear. But for anyone updating with images it should be when the
> update.

Does the directory not stay around? I was testing on a phone with installed clicks and that directory didn't exist.

Or are you saying that the click makes the directory, puts a desktop file in it, runs this hook, then deletes the directory?

Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in data/unity8-filewatcher.conf
1 conflicts encountered.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Conflict not merged for over a month, putting back to Work In Progress to clear the queue

Unmerged revisions

2329. By Ted Gould

Update to trunk and g_get_user_name()

2328. By Ted Gould

Handle not having the session bus environment variable set

2327. By Ted Gould

Grabbing syscall branch

2326. By Ted Gould

Remove dependence on a specific home directory by using a click hook for refresh

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/unity8-filewatcher.conf'
2--- data/unity8-filewatcher.conf 2014-08-22 11:19:51 +0000
3+++ data/unity8-filewatcher.conf 2016-04-19 20:58:36 +0000
4@@ -1,8 +1,7 @@
5-description "File system watcher for unity8"
6+description "System application watcher for unity8 for Deb-based systems"
7 author "Michael Zanetti <michael.zanetti@canonical.com>"
8
9-# Workaround for bug 1360208. ~ and * in one expression doesn't work currently
10-start on (file FILE=/home/phablet/.local/share/applications/*.desktop) or (file FILE=/usr/share/applications/*.desktop)
11+start on (file FILE=/usr/share/applications/*.desktop)
12
13-exec dbus-send --type=method_call --dest=com.canonical.Unity.Launcher /com/canonical/Unity/Launcher com.canonical.Unity.Launcher.Refresh
14+exec unity8-launcher-refresh
15
16
17=== modified file 'debian/control'
18--- debian/control 2016-03-30 22:34:41 +0000
19+++ debian/control 2016-04-19 20:58:36 +0000
20@@ -2,7 +2,8 @@
21 Section: x11
22 Priority: optional
23 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
24-Build-Depends: cmake,
25+Build-Depends: click-dev,
26+ cmake,
27 dbus-test-runner,
28 debhelper (>= 9),
29 doxyqml,
30
31=== modified file 'debian/rules'
32--- debian/rules 2016-01-18 18:18:50 +0000
33+++ debian/rules 2016-04-19 20:58:36 +0000
34@@ -9,7 +9,7 @@
35 export NO_PNG_PKG_MANGLE=1
36
37 %:
38- dh $@ --parallel --fail-missing --with python3
39+ dh $@ --parallel --fail-missing --with python3,click
40
41 override_dh_auto_configure:
42 # Debian defines CMAKE_INSTALL_LOCALSTATEDIR as /usr/var, which is wrong.
43
44=== added file 'debian/unity8.click-hook'
45--- debian/unity8.click-hook 1970-01-01 00:00:00 +0000
46+++ debian/unity8.click-hook 2016-04-19 20:58:36 +0000
47@@ -0,0 +1,4 @@
48+Pattern: ${home}/.cache/unity8/click-desktops/${short-id}.desktop
49+Exec: unity8-launcher-refresh
50+User-Level: yes
51+Hook-Name: desktop
52
53=== modified file 'debian/unity8.install'
54--- debian/unity8.install 2015-11-20 13:04:46 +0000
55+++ debian/unity8.install 2016-04-19 20:58:36 +0000
56@@ -4,6 +4,7 @@
57 data/unity8.conf usr/share/upstart/sessions/
58 usr/bin/unity8
59 usr/bin/unity8-dash
60+usr/bin/unity8-launcher-refresh
61 usr/share/applications/unity8-dash.desktop
62 usr/share/applications/unity8.desktop
63 usr/share/unity8/Greeter
64
65=== modified file 'tools/CMakeLists.txt'
66--- tools/CMakeLists.txt 2015-07-01 10:48:40 +0000
67+++ tools/CMakeLists.txt 2016-04-19 20:58:36 +0000
68@@ -12,3 +12,5 @@
69 )
70
71 install(FILES unlock-device DESTINATION ${SHELL_APP_DIR})
72+
73+install(PROGRAMS unity8-launcher-refresh DESTINATION ${CMAKE_INSTALL_BINDIR})
74
75=== added file 'tools/unity8-launcher-refresh'
76--- tools/unity8-launcher-refresh 1970-01-01 00:00:00 +0000
77+++ tools/unity8-launcher-refresh 2016-04-19 20:58:36 +0000
78@@ -0,0 +1,8 @@
79+#!/bin/sh
80+
81+if [ -z $DBUS_SESSION_BUS_ADDRESS ] ; then
82+ UID=`id -u`
83+ export `cat /run/user/${UID}/dbus-session`
84+fi
85+
86+exec dbus-send --type=method_call --dest=com.canonical.Unity.Launcher /com/canonical/Unity/Launcher com.canonical.Unity.Launcher.Refresh

Subscribers

People subscribed via source and target branches