Merge lp:~townsend/libertine/drop-click-support into lp:libertine

Proposed by Christopher Townsend
Status: Merged
Approved by: Larry Price
Approved revision: 347
Merge reported by: Larry Price
Merged at revision: not available
Proposed branch: lp:~townsend/libertine/drop-click-support
Merge into: lp:libertine
Diff against target: 255 lines (+2/-198)
7 files modified
data/CMakeLists.txt (+0/-4)
data/python3-libertine-chroot.click-hook.in (+0/-4)
debian/control (+1/-2)
debian/python3-libertine-chroot.install (+0/-1)
debian/rules (+1/-1)
tools/CMakeLists.txt (+0/-3)
tools/update-puritine-containers (+0/-183)
To merge this branch: bzr merge lp:~townsend/libertine/drop-click-support
Reviewer Review Type Date Requested Status
Larry Price Approve
Libertine CI Bot continuous-integration Approve
Review via email: mp+312599@code.launchpad.net

Commit message

Drop support for the Puritine click package as that is Vivid only and a Vivid Libertine branch exists.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:347
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/257/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/527
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=default/419
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/419
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/419
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=vivid+overlay,testname=default/419
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/419
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/419
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/537
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/520
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/520/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/520
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/520/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/520
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/520/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/520
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/520/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/520
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/520/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/520
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/520/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/257/rebuild

review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 2016-11-01 20:10:58 +0000
+++ data/CMakeLists.txt 2016-12-06 20:55:22 +0000
@@ -10,7 +10,3 @@
10 DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/sudoers.d)10 DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/sudoers.d)
11install(FILES com.canonical.libertine.LxcManager.service com.canonical.libertine.ContainerManager.service11install(FILES com.canonical.libertine.LxcManager.service com.canonical.libertine.ContainerManager.service
12 DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services)12 DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services)
13
14configure_file("python3-libertine-chroot.click-hook.in"
15 "${CMAKE_SOURCE_DIR}/debian/python3-libertine-chroot.click-hook"
16 @ONLY)
1713
=== removed file 'data/python3-libertine-chroot.click-hook.in'
--- data/python3-libertine-chroot.click-hook.in 2016-09-06 12:36:47 +0000
+++ data/python3-libertine-chroot.click-hook.in 1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
1Pattern: ${home}/.cache/libertine/puritine/${id}
2Exec: @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libertine/update-puritine-containers
3User-Level: yes
4Hook-Name: puritine
50
=== modified file 'debian/control'
--- debian/control 2016-11-22 17:47:05 +0000
+++ debian/control 2016-12-06 20:55:22 +0000
@@ -2,8 +2,7 @@
2Section: utils2Section: utils
3Priority: extra3Priority: extra
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5Build-Depends: click-dev,5Build-Depends: cmake,
6 cmake,
7 cmake-extras,6 cmake-extras,
8 debhelper (>= 9),7 debhelper (>= 9),
9 dh-translations,8 dh-translations,
109
=== modified file 'debian/python3-libertine-chroot.install'
--- debian/python3-libertine-chroot.install 2016-10-07 21:09:41 +0000
+++ debian/python3-libertine-chroot.install 2016-12-06 20:55:22 +0000
@@ -1,2 +1,1 @@
1usr/lib/*/libertine/update-puritine-containers
2usr/lib/python*/*/libertine/ChrootContainer.py1usr/lib/python*/*/libertine/ChrootContainer.py
32
=== modified file 'debian/rules'
--- debian/rules 2016-12-05 15:32:46 +0000
+++ debian/rules 2016-12-06 20:55:22 +0000
@@ -1,7 +1,7 @@
1#!/usr/bin/make -f1#!/usr/bin/make -f
22
3%:3%:
4 dh $@ --with python3,gir,click4 dh $@ --with python3,gir
55
6override_dh_auto_test:6override_dh_auto_test:
7 dbus-run-session -- dh_auto_test7 dbus-run-session -- dh_auto_test
88
=== modified file 'tools/CMakeLists.txt'
--- tools/CMakeLists.txt 2016-10-28 19:39:13 +0000
+++ tools/CMakeLists.txt 2016-12-06 20:55:22 +0000
@@ -3,8 +3,5 @@
3install(FILES libertine-launch.1 libertine-container-manager.1 libertine-lxc-manager.1 libertine-xmir.13install(FILES libertine-launch.1 libertine-container-manager.1 libertine-lxc-manager.1 libertine-xmir.1
4 DESTINATION ${CMAKE_INSTALL_MANDIR}/man14 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
5 COMPONENT doc)5 COMPONENT doc)
6install(PROGRAMS update-puritine-containers
7 DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libertine)
8
9install(FILES completions/libertine-container-manager6install(FILES completions/libertine-container-manager
10 DESTINATION ${DESTDIR}/usr/share/bash-completion/completions/)7 DESTINATION ${DESTDIR}/usr/share/bash-completion/completions/)
118
=== removed file 'tools/update-puritine-containers'
--- tools/update-puritine-containers 2016-10-25 15:24:08 +0000
+++ tools/update-puritine-containers 1970-01-01 00:00:00 +0000
@@ -1,183 +0,0 @@
1#!/usr/bin/python3
2# -*- coding: utf-8 -*-
3
4# Copyright (C) 2016 Canonical Ltd.
5# Author: Christopher Townsend <christopher.townsend@canonical.com>
6
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; version 3 of the License.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19import json
20import libertine.utils
21import os
22import shlex
23import shutil
24import subprocess
25
26from gi.repository import GLib, Gio
27
28puritine_hook_dir = os.path.join(os.environ['HOME'], '.cache', 'libertine', 'puritine')
29puritine_symlink_farm_file = os.path.join(puritine_hook_dir, 'PuritineSymlinkFarm.json')
30puritine_click_config_file = os.path.join('libertine-config', 'libertine', 'ContainersConfig.json')
31
32
33def symlink_farm_entries_count():
34 if (puritine_symlink_farm_list and
35 puritine_symlink_farm_list['customContainers']):
36 return len(puritine_symlink_farm_list['customContainers'])
37
38 return 0
39
40
41def puritine_symlink_exists(symlink):
42 for file in os.listdir(puritine_hook_dir):
43 if file == symlink:
44 return True
45
46 return False
47
48
49def get_symlink_name(puritine_symlink_farm_list, container_id):
50 if puritine_symlink_farm_list:
51 for container in puritine_symlink_farm_list['customContainers']:
52 if container['id'] == container_id:
53 return (puritine_symlink_farm_list['customContainers'].index(container), container['symlinkName'])
54
55 return (0, None)
56
57
58def find_removed_puritine_symlinks(puritine_symlink_farm_list):
59 for container in puritine_symlink_farm_list['customContainers']:
60 if puritine_symlink_exists(container['symlinkName']):
61 continue
62 else:
63 manager_cmd = "libertine-container-manager destroy -i " + container['id']
64 cmd = shlex.split(manager_cmd)
65 subprocess.Popen(cmd).wait()
66 puritine_symlink_farm_list['customContainers'].remove(container)
67
68 return puritine_symlink_farm_list
69
70
71def find_new_or_updated_puritine_symlinks(puritine_symlink_farm_list):
72 symlinks = os.listdir(puritine_hook_dir)
73
74 for symlink in symlinks:
75 puritine_click_path = os.path.join(puritine_hook_dir, symlink)
76 if not os.path.islink(puritine_click_path):
77 continue
78
79 config_file_path = os.path.join(puritine_click_path, puritine_click_config_file)
80
81 with open(config_file_path, 'r') as fd:
82 container_list = json.load(fd)
83
84 container_id = container_list['containerList'][0]['id']
85
86 (index, symlink_name) = get_symlink_name(puritine_symlink_farm_list, container_id)
87
88 if symlink_name:
89 # Package exists and symlink name is the same- no update
90 if symlink_name == symlink:
91 continue
92 else:
93 puritine_symlink_farm_list['customContainers'][index]['symlinkName'] = symlink
94 else:
95 symlink_obj = {'symlinkName': symlink, 'id': container_id}
96 if 'customContainers' not in puritine_symlink_farm_list:
97 puritine_symlink_farm_list['customContainers'] = [symlink_obj]
98 else:
99 puritine_symlink_farm_list['customContainers'].append(symlink_obj)
100
101 puritine_click_rootfs_path = os.path.join(puritine_click_path, 'libertine-data', 'libertine-container',
102 container_id, 'rootfs')
103
104 libertine_containers_path = libertine.utils.get_libertine_containers_dir_path()
105 puritine_container_path = os.path.join(libertine_containers_path, container_id)
106 puritine_container_rootfs_path = os.path.join(puritine_container_path, 'rootfs')
107
108 if not os.path.exists(puritine_container_path):
109 os.makedirs(puritine_container_path)
110 else:
111 os.remove(puritine_container_rootfs_path)
112
113 # Link to the click packages container
114 os.symlink(puritine_click_rootfs_path, puritine_container_rootfs_path)
115
116 # Copy any user data that does not exist
117 libertine_user_data_path = libertine.utils.get_libertine_container_userdata_dir_path(container_id)
118 if not os.path.exists(libertine_user_data_path):
119 puritine_click_user_data_path = os.path.join(puritine_click_path, 'libertine-config', 'libertine-container',
120 'user-data', container_id)
121 shutil.copytree(puritine_click_user_data_path, libertine_user_data_path)
122
123 # Update the main ContainerConfig.json
124 manager_cmd = "libertine-container-manager merge-configs -f " + config_file_path
125 cmd = shlex.split(manager_cmd)
126 subprocess.Popen(cmd).wait()
127
128 return puritine_symlink_farm_list
129
130
131def favorite_libertine_scope():
132 libertine_scope_value = 'scope://libertine-scope.ubuntu_libertine-scope'
133 click_scope_value = 'scope://clickscope'
134 schema = 'com.canonical.Unity.Dash'
135 schema_key = 'favorite-scopes'
136
137 settings = Gio.Settings.new(schema)
138
139 favorites = settings.get_value(schema_key)
140
141 array = favorites.dup_strv()
142
143 if not libertine_scope_value in array:
144 array.insert(array.index(click_scope_value) + 1, libertine_scope_value)
145 new_favorites = GLib.Variant.new_strv(array)
146 settings.set_value(schema_key, new_favorites)
147 del new_favorites
148
149 del array
150 del favorites
151 del settings
152
153
154if __name__ == '__main__':
155 puritine_symlink_farm_list = {}
156 update_libertine_scope = libertine.utils.set_session_dbus_env_var()
157
158 if not os.path.exists(puritine_hook_dir):
159 os.makedirs(puritine_hook_dir)
160
161 if (os.path.exists(puritine_symlink_farm_file) and
162 os.path.getsize(puritine_symlink_farm_file) != 0):
163 with open(puritine_symlink_farm_file, 'r') as fd:
164 puritine_symlink_farm_list = json.load(fd)
165
166 count_at_start = symlink_farm_entries_count()
167
168 puritine_symlink_farm_list = find_new_or_updated_puritine_symlinks(puritine_symlink_farm_list)
169
170 if puritine_symlink_farm_list:
171 puritine_symlink_farm_list = find_removed_puritine_symlinks(puritine_symlink_farm_list)
172
173 count_at_finish = symlink_farm_entries_count()
174
175 with open(puritine_symlink_farm_file, 'w') as fd:
176 json.dump(puritine_symlink_farm_list, fd, sort_keys=True, indent=4)
177 fd.write('\n')
178
179 if count_at_start == 0 and count_at_finish > 0 and update_libertine_scope:
180 favorite_libertine_scope()
181
182 if update_libertine_scope:
183 libertine.utils.refresh_libertine_scope()

Subscribers

People subscribed via source and target branches