Merge lp:~azzar1/unity/unity-active-plugins--safety-check into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4158
Proposed branch: lp:~azzar1/unity/unity-active-plugins--safety-check
Merge into: lp:unity
Diff against target: 204 lines (+120/-2)
9 files modified
CMakeLists.txt (+6/-0)
debian/control (+1/-0)
debian/libunity-core-6.0-9.install (+1/-1)
debian/unity-services.install (+1/-1)
debian/unity.install (+1/-0)
plugins/unityshell/unityshell.xml.in (+2/-0)
tools/CMakeLists.txt (+22/-0)
tools/unity_active_plugins_safety_check.cpp (+83/-0)
unity7.conf.in (+3/-0)
To merge this branch: bzr merge lp:~azzar1/unity/unity-active-plugins--safety-check
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+300368@code.launchpad.net

Commit message

Add tools to enforce unityshell plugin for the current profile and add "move" and "resize" plugins as requirements.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Remember to include this into the debian/unity.install file.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Done. I also moved unity7.conf outside debian dir in order to properly generate the correct paths.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks for the change, but there's still something to fix inside the unity.install file

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Fine

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

After this we've this issue on install:

Preparing to unpack .../unity_7.5.0+16.10.20160726.2-0ubuntu1_amd64.deb ...
Unpacking unity (7.5.0+16.10.20160726.2-0ubuntu1) over (7.5.0+16.10.20160715-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/unity_7.5.0+16.10.20160726.2-0ubuntu1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/upstart/sessions/unity7.conf', which is also in package unity-services 7.5.0+16.10.20160726.2-0ubuntu1
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/unity_7.5.0+16.10.20160726.2-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

So, please apply this too: http://pastebin.ubuntu.com/21005082/

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I still get some issues when upgrading... I think we need to set the debian breaks/replaces properly in core file or, we keep the unity7.conf in the libunity-core-6.0-9.install as it used to be...

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-05-15 02:22:05 +0000
3+++ CMakeLists.txt 2016-07-26 16:45:52 +0000
4@@ -425,3 +425,9 @@
5 ADDITIONAL_MAKE_CLEAN_FILES api-doc)
6
7 endif (DOXYGEN_FOUND STREQUAL "YES")
8+
9+#
10+# Upstart
11+#
12+configure_file(unity7.conf.in ${CMAKE_CURRENT_BINARY_DIR}/unity7.conf)
13+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity7.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/sessions)
14
15=== modified file 'debian/control'
16--- debian/control 2016-03-21 15:38:17 +0000
17+++ debian/control 2016-07-26 16:45:52 +0000
18@@ -18,6 +18,7 @@
19 libbamf3-dev (>= 0.5.3~bzr0),
20 libboost-dev,
21 libcairo2-dev,
22+ libcompizconfig0-dev,
23 libdbus-1-dev,
24 libdbusmenu-glib-dev (>= 0.3.91),
25 libdee-dev (>= 1.2.6),
26
27=== modified file 'debian/libunity-core-6.0-9.install'
28--- debian/libunity-core-6.0-9.install 2016-02-09 01:26:22 +0000
29+++ debian/libunity-core-6.0-9.install 2016-07-26 16:45:52 +0000
30@@ -3,7 +3,7 @@
31 usr/share/ccsm
32 usr/share/gnome-control-center/
33 usr/share/unity
34+usr/share/upstart/sessions/unity7.conf
35 debian/unity-crashdb.conf etc/apport/crashdb.conf.d/
36 debian/source_unity.py usr/share/apport/package-hooks
37-debian/unity7.conf usr/share/upstart/sessions
38 tools/convert-files/* usr/lib/compiz/migration/
39
40=== modified file 'debian/unity-services.install'
41--- debian/unity-services.install 2016-02-09 01:26:22 +0000
42+++ debian/unity-services.install 2016-07-26 16:45:52 +0000
43@@ -1,3 +1,3 @@
44 usr/lib/*/unity/*service
45-usr/share/upstart
46+usr/share/upstart/sessions/unity-panel-service*.conf
47 usr/share/man/*/unity-panel-service.1
48
49=== modified file 'debian/unity.install'
50--- debian/unity.install 2016-02-09 01:26:22 +0000
51+++ debian/unity.install 2016-07-26 16:45:52 +0000
52@@ -1,6 +1,7 @@
53 etc/pam.d
54 usr/bin
55 usr/lib/*/compiz/libunity*.so
56+usr/lib/*/unity/unity-active-plugins-safety-check
57 usr/share/man/*/unity.1
58 usr/share/compiz
59 usr/share/locale
60
61=== modified file 'plugins/unityshell/unityshell.xml.in'
62--- plugins/unityshell/unityshell.xml.in 2016-04-05 13:23:27 +0000
63+++ plugins/unityshell/unityshell.xml.in 2016-07-26 16:45:52 +0000
64@@ -39,6 +39,8 @@
65 <plugin>compiztoolbox</plugin>
66 <plugin>scale</plugin>
67 <plugin>expo</plugin>
68+ <plugin>move</plugin>
69+ <plugin>resize</plugin>
70 </requirement>
71 <conflict>
72 <plugin>decor</plugin>
73
74=== modified file 'tools/CMakeLists.txt'
75--- tools/CMakeLists.txt 2016-02-09 01:26:22 +0000
76+++ tools/CMakeLists.txt 2016-07-26 16:45:52 +0000
77@@ -6,3 +6,25 @@
78 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/unity.cmake ${CMAKE_BINARY_DIR}/bin/unity)
79 install(FILES ${CMAKE_BINARY_DIR}/bin/unity PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
80 GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_BINDIR})
81+
82+#
83+# unity-active-plugins-safety-check
84+#
85+pkg_check_modules(UAPSC_DEPS REQUIRED libcompizconfig)
86+
87+set(CFLAGS
88+ ${UAPSC_DEPS_CFLAGS}
89+ ${UAPSC_DEPS_CFLAGS_OTHER}
90+ )
91+
92+string (REPLACE ";" " " CFLAGS "${CFLAGS}")
93+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CFLAGS}")
94+
95+set(LIBS ${UAPSC_DEPS_LIBRARIES})
96+
97+set(LIB_PATHS ${UAPSC_DEPS_LIBRARY_DIRS})
98+link_directories(${LIB_PATHS})
99+
100+add_executable(unity-active-plugins-safety-check unity_active_plugins_safety_check.cpp)
101+target_link_libraries(unity-active-plugins-safety-check ${LIBS})
102+install(TARGETS unity-active-plugins-safety-check DESTINATION ${CMAKE_INSTALL_LIBDIR}/unity/)
103
104=== added file 'tools/unity_active_plugins_safety_check.cpp'
105--- tools/unity_active_plugins_safety_check.cpp 1970-01-01 00:00:00 +0000
106+++ tools/unity_active_plugins_safety_check.cpp 2016-07-26 16:45:52 +0000
107@@ -0,0 +1,83 @@
108+/*
109+ * Copyright (C) 2016 Canonical Ltd
110+ *
111+ * This program is free software: you can redistribute it and/or modify
112+ * it under the terms of the GNU General Public License version 3 as
113+ * published by the Free Software Foundation.
114+ *
115+ * This program is distributed in the hope that it will be useful,
116+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
117+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
118+ * GNU General Public License for more details.
119+ *
120+ * You should have received a copy of the GNU General Public License
121+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
122+ *
123+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
124+ */
125+
126+#include <ccs.h>
127+#include <gio/gio.h>
128+
129+#include <iostream>
130+#include <string>
131+
132+extern const CCSInterfaceTable ccsDefaultInterfaceTable;
133+
134+void PluginSetActiveWithDeps(CCSContext* context, std::string const& plugin_name)
135+{
136+ if (plugin_name.empty())
137+ return;
138+
139+ auto plugin = ccsFindPlugin(context, plugin_name.c_str());
140+
141+ if (!plugin)
142+ return;
143+
144+ auto reqs = ccsPluginGetRequiresPlugins(plugin);
145+ for (auto req = reqs; req; req = req->next)
146+ {
147+ if (req->data && req->data->value)
148+ {
149+ std::string name = req->data->value;
150+ PluginSetActiveWithDeps(context, name.c_str());
151+ }
152+ }
153+
154+ if (!ccsPluginIsActive(context, plugin_name.c_str())) {
155+ std::cout << "Setting plugin '" << plugin_name << "' to active" << std::endl;
156+ ccsPluginSetActive(plugin, true);
157+ }
158+
159+ auto conflicts = ccsPluginGetConflictPlugins(plugin);
160+ for (auto con = conflicts; con; con = con->next)
161+ {
162+ if (con->data && con->data->value)
163+ {
164+ std::string name = con->data->value;
165+ auto plugin = ccsFindPlugin(context, name.c_str());
166+
167+ if (ccsPluginIsActive(context, name.c_str()))
168+ {
169+ std::cout << "Setting plugin '" << name << "' to non-active" << std::endl;
170+ ccsPluginSetActive(plugin, false);
171+ }
172+ }
173+ }
174+}
175+
176+int main()
177+{
178+ auto context = ccsContextNew (0, &ccsDefaultInterfaceTable);
179+
180+ if (!context)
181+ return -1;
182+
183+ PluginSetActiveWithDeps(context, "unityshell");
184+
185+ ccsWriteChangedSettings(context);
186+ g_settings_sync();
187+ ccsFreeContext(context);
188+
189+ return 0;
190+}
191
192=== renamed file 'debian/unity7.conf' => 'unity7.conf.in'
193--- debian/unity7.conf 2016-07-05 01:26:04 +0000
194+++ unity7.conf.in 2016-07-26 16:45:52 +0000
195@@ -21,6 +21,9 @@
196
197 echo "Using compiz profile '$compiz_profile'"
198 initctl set-env -g COMPIZ_CONFIG_PROFILE="$compiz_profile"
199+ export COMPIZ_CONFIG_PROFILE="$compiz_profile"
200+
201+ ${CMAKE_INSTALL_FULL_LIBDIR}/unity/unity-active-plugins-safety-check
202 end script
203
204 respawn