Merge lp:~townsend/libertine/0.99.11-release into lp:libertine/trunk
- 0.99.11-release
- Merge into trunk
Proposed by
Christopher Townsend
Status: | Merged |
---|---|
Approved by: | Stephen M. Webb |
Approved revision: | 118 |
Merged at revision: | 118 |
Proposed branch: | lp:~townsend/libertine/0.99.11-release |
Merge into: | lp:libertine/trunk |
Diff against target: |
735 lines (+354/-15) 19 files modified
data/CMakeLists.txt (+1/-1) data/libertine-xmir.conf (+8/-0) data/libertine.desktop (+3/-3) data/puritine-click.conf (+3/-1) debian/changelog (+16/-0) debian/libertine-tools.install (+2/-0) libertine/ContainerConfig.cpp (+27/-0) libertine/ContainerConfig.h (+4/-0) libertine/ContainerConfigList.cpp (+22/-0) libertine/ContainerConfigList.h (+6/-0) libertine/ContainerManager.cpp (+49/-0) libertine/ContainerManager.h (+17/-1) libertine/qml/ConfigureContainer.qml (+69/-0) libertine/qml/HomeView.qml (+4/-2) python/libertine/Libertine.py (+21/-3) python/libertine/LxcContainer.py (+6/-1) tools/CMakeLists.txt (+1/-1) tools/libertine-container-manager (+76/-2) tools/libertine-xmir (+19/-0) |
To merge this branch: | bzr merge lp:~townsend/libertine/0.99.11-release |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stephen M. Webb (community) | Approve | ||
Review via email: mp+287847@code.launchpad.net |
Commit message
* Add a way to call Xmir with different options than what is hardcoded in ubuntu-app-launch. (LP: #1542028)
* Use '-title @' Xmir option to set proper XMir window titles.
* Add ability to enable or disable i386 multiarch support in a Libertine container. (LP: #1518812)
* libertine-demo: do not remove the ContainersConfig file if there are still containers.
* remove the unnecessary quotes from the .desktop file.
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/CMakeLists.txt' |
2 | --- data/CMakeLists.txt 2015-11-30 15:37:30 +0000 |
3 | +++ data/CMakeLists.txt 2016-03-02 20:24:53 +0000 |
4 | @@ -4,7 +4,7 @@ |
5 | DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) |
6 | install(FILES libertine_64.png libertine-lxc.conf |
7 | DESTINATION ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}) |
8 | -install(FILES puritine-click.conf libertine-lxc-manager.conf |
9 | +install(FILES puritine-click.conf libertine-lxc-manager.conf libertine-xmir.conf |
10 | DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/sessions) |
11 | install(FILES puritine-15.04.1.framework |
12 | DESTINATION ${CMAKE_INSTALL_DATADIR}/click/frameworks) |
13 | |
14 | === added file 'data/libertine-xmir.conf' |
15 | --- data/libertine-xmir.conf 1970-01-01 00:00:00 +0000 |
16 | +++ data/libertine-xmir.conf 2016-03-02 20:24:53 +0000 |
17 | @@ -0,0 +1,8 @@ |
18 | +description "Set global environment variable to tell u-a-l where to look to start Xmir" |
19 | +author "Christopher Townsend <christopher.townsend@canonical.com>" |
20 | + |
21 | +start on started unity8 |
22 | + |
23 | +pre-start script |
24 | + initctl set-env --global UBUNTU_APP_LAUNCH_XMIR_PATH="/usr/bin/libertine-xmir" |
25 | +end script |
26 | |
27 | === modified file 'data/libertine.desktop' |
28 | --- data/libertine.desktop 2015-08-04 19:32:16 +0000 |
29 | +++ data/libertine.desktop 2016-03-02 20:24:53 +0000 |
30 | @@ -1,11 +1,11 @@ |
31 | [Desktop Entry] |
32 | Version=1.0 |
33 | -Name="Libertine" |
34 | -Comment="Legacy Application Sandbox" |
35 | +Name=Libertine |
36 | +Comment=Legacy Application Sandbox |
37 | Exec=libertine |
38 | Terminal=false |
39 | Type=Application |
40 | Icon=/usr/share/libertine/libertine_64.png |
41 | Categories= |
42 | -GenericName="Application Sandbox" |
43 | +GenericName=Application Sandbox |
44 | X-Ubuntu-Touch=true |
45 | |
46 | === modified file 'data/puritine-click.conf' |
47 | --- data/puritine-click.conf 2016-01-19 16:51:14 +0000 |
48 | +++ data/puritine-click.conf 2016-03-02 20:24:53 +0000 |
49 | @@ -26,7 +26,9 @@ |
50 | fi |
51 | else |
52 | rm -rf $HOME/.cache/libertine-container/$CONTAINER_NAME |
53 | - rm -rf $HOME/.local/share/libertine |
54 | + if [ $(libertine-container-manager list | grep -v ${CONTAINER_NAME} | wc -l) -eq 0 ]; then |
55 | + rm -rf $HOME/.local/share/libertine |
56 | + fi |
57 | rm -rf $HOME/.local/share/libertine-container/user-data/$CONTAINER_NAME/.config/ |
58 | fi |
59 | end script |
60 | |
61 | === modified file 'debian/changelog' |
62 | --- debian/changelog 2016-02-08 17:09:07 +0000 |
63 | +++ debian/changelog 2016-03-02 20:24:53 +0000 |
64 | @@ -1,3 +1,19 @@ |
65 | +libertine (0.99.11-0ubuntu1) UNRELEASED; urgency=medium |
66 | + |
67 | + [ Chris Townsend ] |
68 | + * Add a way to call Xmir with different options than what is hardcoded in |
69 | + ubuntu-app-launch. (LP: #1542028) |
70 | + * Use '-title @' Xmir option to set proper XMir window titles. |
71 | + * Add ability to enable or disable i386 multiarch support in a Libertine |
72 | + container. (LP: #1518812) |
73 | + |
74 | + [ Stephen M. Webb ] |
75 | + * libertine-demo: do not remove the ContainersConfig file if there are still |
76 | + containers. |
77 | + * remove the unnecessary quotes from the .desktop file. |
78 | + |
79 | + -- Chris Townsend <christopher.townsend@canonical.com> Wed, 02 Mar 2016 15:06:52 -0500 |
80 | + |
81 | libertine (0.99.10+16.04.20160208.1-0ubuntu1) xenial; urgency=medium |
82 | |
83 | [ Chris Townsend ] |
84 | |
85 | === modified file 'debian/libertine-tools.install' |
86 | --- debian/libertine-tools.install 2015-11-24 18:20:52 +0000 |
87 | +++ debian/libertine-tools.install 2016-03-02 20:24:53 +0000 |
88 | @@ -2,6 +2,8 @@ |
89 | usr/bin/libertine-session-bridge |
90 | usr/bin/libertine-container-manager |
91 | usr/bin/libertine-lxc-manager |
92 | +usr/bin/libertine-xmir |
93 | usr/share/man |
94 | usr/share/libertine/libertine-lxc.conf |
95 | usr/share/upstart/sessions/libertine-lxc-manager.conf |
96 | +usr/share/upstart/sessions/libertine-xmir.conf |
97 | |
98 | === modified file 'libertine/ContainerConfig.cpp' |
99 | --- libertine/ContainerConfig.cpp 2016-01-21 21:42:28 +0000 |
100 | +++ libertine/ContainerConfig.cpp 2016-03-02 20:24:53 +0000 |
101 | @@ -121,6 +121,27 @@ |
102 | return distro_series; |
103 | } |
104 | |
105 | + QString |
106 | + extract_multiarch_support_from_json(QJsonObject const& json_object) |
107 | + { |
108 | + QString multiarch_support("disabled"); |
109 | + QJsonValue value = json_object["multiarch"]; |
110 | + if (value != QJsonValue::Undefined) |
111 | + { |
112 | + QJsonValue::Type value_type = value.type(); |
113 | + if (value_type == QJsonValue::String) |
114 | + { |
115 | + QString s = value.toString(); |
116 | + if (s.length() > 0) |
117 | + { |
118 | + multiarch_support = s; |
119 | + } |
120 | + } |
121 | + } |
122 | + |
123 | + return multiarch_support; |
124 | + } |
125 | + |
126 | const static struct { QString string; ContainerConfig::InstallStatus enumeration; } install_status_names[] = |
127 | { |
128 | { QObject::tr("new"), ContainerConfig::InstallStatus::New }, |
129 | @@ -292,6 +313,7 @@ |
130 | , container_name_(extract_container_name_from_json(json_object, container_id_)) |
131 | , container_type_(extract_container_type_from_json(json_object, container_id_)) |
132 | , distro_series_(extract_distro_series_from_json(json_object, container_id_)) |
133 | +, multiarch_support_(extract_multiarch_support_from_json(json_object)) |
134 | , install_status_(extract_install_status_from_json(json_object)) |
135 | , container_apps_(extract_container_apps_from_json(json_object)) |
136 | { } |
137 | @@ -331,6 +353,11 @@ |
138 | |
139 | |
140 | QString const& ContainerConfig:: |
141 | +multiarch_support() const |
142 | +{ return multiarch_support_; } |
143 | + |
144 | + |
145 | +QString const& ContainerConfig:: |
146 | install_status() const |
147 | { return install_status_names[(int)install_status_].string; } |
148 | |
149 | |
150 | === modified file 'libertine/ContainerConfig.h' |
151 | --- libertine/ContainerConfig.h 2016-01-21 21:42:28 +0000 |
152 | +++ libertine/ContainerConfig.h 2016-03-02 20:24:53 +0000 |
153 | @@ -96,6 +96,9 @@ |
154 | distro_series() const; |
155 | |
156 | QString const& |
157 | + multiarch_support() const; |
158 | + |
159 | + QString const& |
160 | install_status() const; |
161 | |
162 | void |
163 | @@ -116,6 +119,7 @@ |
164 | QString container_name_; |
165 | QString container_type_; |
166 | QString distro_series_; |
167 | + QString multiarch_support_; |
168 | InstallStatus install_status_; |
169 | QList<ContainerApps*> container_apps_; |
170 | }; |
171 | |
172 | === modified file 'libertine/ContainerConfigList.cpp' |
173 | --- libertine/ContainerConfigList.cpp 2016-01-22 17:15:58 +0000 |
174 | +++ libertine/ContainerConfigList.cpp 2016-03-02 20:24:53 +0000 |
175 | @@ -32,6 +32,7 @@ |
176 | #include <QtCore/QRegExp> |
177 | #include <QtCore/QSettings> |
178 | #include <QtCore/QString> |
179 | +#include <QtCore/QSysInfo> |
180 | |
181 | #include <sys/file.h> |
182 | |
183 | @@ -237,6 +238,20 @@ |
184 | |
185 | |
186 | QString ContainerConfigList:: |
187 | +getContainerMultiarchSupport(QString const& container_id) |
188 | +{ |
189 | + for (auto const& config: configs_) |
190 | + { |
191 | + if (config->container_id() == container_id) |
192 | + { |
193 | + return config->multiarch_support(); |
194 | + } |
195 | + } |
196 | + return nullptr; |
197 | +} |
198 | + |
199 | + |
200 | +QString ContainerConfigList:: |
201 | getContainerStatus(QString const& container_id) |
202 | { |
203 | for (auto const& config: configs_) |
204 | @@ -251,6 +266,13 @@ |
205 | |
206 | |
207 | QString ContainerConfigList:: |
208 | +getHostArchitecture() |
209 | +{ |
210 | + return QSysInfo::currentCpuArchitecture(); |
211 | +} |
212 | + |
213 | + |
214 | +QString ContainerConfigList:: |
215 | getHostDistroCodename() |
216 | { |
217 | QSettings distro_info("/etc/lsb-release", QSettings::NativeFormat); |
218 | |
219 | === modified file 'libertine/ContainerConfigList.h' |
220 | --- libertine/ContainerConfigList.h 2016-01-22 17:15:58 +0000 |
221 | +++ libertine/ContainerConfigList.h 2016-03-02 20:24:53 +0000 |
222 | @@ -119,11 +119,17 @@ |
223 | getContainerDistro(QString const& container_id); |
224 | |
225 | Q_INVOKABLE QString |
226 | + getContainerMultiarchSupport(QString const& container_id); |
227 | + |
228 | + Q_INVOKABLE QString |
229 | getContainerName(QString const& container_id); |
230 | |
231 | Q_INVOKABLE QString |
232 | getContainerStatus(QString const& container_id); |
233 | |
234 | + Q_INVOKABLE QString |
235 | + getHostArchitecture(); |
236 | + |
237 | void |
238 | reloadConfigs(); |
239 | |
240 | |
241 | === modified file 'libertine/ContainerManager.cpp' |
242 | --- libertine/ContainerManager.cpp 2016-01-22 17:15:58 +0000 |
243 | +++ libertine/ContainerManager.cpp 2016-03-02 20:24:53 +0000 |
244 | @@ -52,6 +52,18 @@ |
245 | |
246 | |
247 | ContainerManagerWorker:: |
248 | +ContainerManagerWorker(ContainerAction container_action, |
249 | + QString const& container_id, |
250 | + QString const& container_type, |
251 | + QStringList data_list) |
252 | +: container_action_(container_action) |
253 | +, container_id_(container_id) |
254 | +, container_type_(container_type) |
255 | +, data_list_(data_list) |
256 | +{ } |
257 | + |
258 | + |
259 | +ContainerManagerWorker:: |
260 | ~ContainerManagerWorker() |
261 | { } |
262 | |
263 | @@ -134,6 +146,18 @@ |
264 | } |
265 | |
266 | |
267 | +QStringList ContainerManagerWorker:: |
268 | +data_list() |
269 | +{ return data_list_; } |
270 | + |
271 | + |
272 | +void ContainerManagerWorker:: |
273 | +data_list(QStringList data_list) |
274 | +{ |
275 | + data_list_ = data_list; |
276 | +} |
277 | + |
278 | + |
279 | void ContainerManagerWorker:: |
280 | run() |
281 | { |
282 | @@ -167,6 +191,10 @@ |
283 | runCommand(data_); |
284 | break; |
285 | |
286 | + case ContainerAction::Configure: |
287 | + configureContainer(data_list_); |
288 | + break; |
289 | + |
290 | default: |
291 | break; |
292 | } |
293 | @@ -362,3 +390,24 @@ |
294 | emit finishedCommand(QString(command_output)); |
295 | quit(); |
296 | } |
297 | + |
298 | + |
299 | +void ContainerManagerWorker:: |
300 | +configureContainer(QStringList configure_command) |
301 | +{ |
302 | + QProcess libertine_cli_tool; |
303 | + QString exec_line = libertine_container_manager_tool; |
304 | + QStringList args; |
305 | + |
306 | + args << "configure" << "-i" << container_id_ << configure_command.at(0) << configure_command.mid(1); |
307 | + |
308 | + libertine_cli_tool.start(exec_line, args); |
309 | + |
310 | + if (!libertine_cli_tool.waitForStarted()) |
311 | + quit(); |
312 | + |
313 | + libertine_cli_tool.waitForFinished(-1); |
314 | + |
315 | + emit finished(); |
316 | + quit(); |
317 | +} |
318 | |
319 | === modified file 'libertine/ContainerManager.h' |
320 | --- libertine/ContainerManager.h 2016-01-22 17:15:58 +0000 |
321 | +++ libertine/ContainerManager.h 2016-03-02 20:24:53 +0000 |
322 | @@ -21,6 +21,7 @@ |
323 | |
324 | #include <QtCore/QObject> |
325 | #include <QtCore/QString> |
326 | +#include <QtCore/QStringList> |
327 | #include <QtCore/QThread> |
328 | |
329 | class ContainerManagerWorker |
330 | @@ -34,6 +35,7 @@ |
331 | Q_PROPERTY(QString containerDistro READ container_distro WRITE container_distro NOTIFY containerDistroChanged) |
332 | Q_PROPERTY(QString containerName READ container_name WRITE container_name NOTIFY containerNameChanged) |
333 | Q_PROPERTY(QString data READ data WRITE data NOTIFY dataChanged) |
334 | + Q_PROPERTY(QStringList data_list READ data_list WRITE data_list NOTIFY dataListChanged) |
335 | |
336 | public: |
337 | static const QString libertine_container_manager_tool; |
338 | @@ -47,7 +49,8 @@ |
339 | Remove, |
340 | Search, |
341 | Update, |
342 | - Exec |
343 | + Exec, |
344 | + Configure |
345 | }; |
346 | |
347 | public: |
348 | @@ -59,6 +62,10 @@ |
349 | QString const& container_id, |
350 | QString const& container_type, |
351 | QString const& data); |
352 | + ContainerManagerWorker(ContainerAction container_action, |
353 | + QString const& container_id, |
354 | + QString const& container_type, |
355 | + QStringList data_list); |
356 | ~ContainerManagerWorker(); |
357 | |
358 | ContainerAction |
359 | @@ -97,6 +104,12 @@ |
360 | void |
361 | data(QString const& data); |
362 | |
363 | + QStringList |
364 | + data_list(); |
365 | + |
366 | + void |
367 | + data_list(QStringList data_list); |
368 | + |
369 | protected: |
370 | void run() Q_DECL_OVERRIDE; |
371 | |
372 | @@ -108,6 +121,7 @@ |
373 | void searchPackageCache(QString const& search_string); |
374 | void updateContainer(); |
375 | void runCommand(QString const& command_line); |
376 | + void configureContainer(QStringList configure_command); |
377 | |
378 | private: |
379 | ContainerAction container_action_; |
380 | @@ -116,6 +130,7 @@ |
381 | QString container_distro_; |
382 | QString container_name_; |
383 | QString data_; |
384 | + QStringList data_list_; |
385 | |
386 | signals: |
387 | void containerActionChanged(); |
388 | @@ -124,6 +139,7 @@ |
389 | void containerDistroChanged(); |
390 | void containerNameChanged(); |
391 | void dataChanged(); |
392 | + void dataListChanged(); |
393 | void finished(); |
394 | void finishedDestroy(QString const& container_id); |
395 | void finishedInstall(bool result, QString const& error_msg); |
396 | |
397 | === added file 'libertine/qml/ConfigureContainer.qml' |
398 | --- libertine/qml/ConfigureContainer.qml 1970-01-01 00:00:00 +0000 |
399 | +++ libertine/qml/ConfigureContainer.qml 2016-03-02 20:24:53 +0000 |
400 | @@ -0,0 +1,69 @@ |
401 | +/** |
402 | + * @file configureContainer.qml |
403 | + * @brief Libertine configure container view |
404 | + */ |
405 | +/* |
406 | + * Copyright 2016 Canonical Ltd |
407 | + * |
408 | + * Libertine is free software: you can redistribute it and/or modify it under |
409 | + * the terms of the GNU General Public License, version 3, as published by the |
410 | + * Free Software Foundation. |
411 | + * |
412 | + * Libertine is distributed in the hope that it will be useful, but WITHOUT ANY |
413 | + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
414 | + * A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
415 | + * |
416 | + * You should have received a copy of the GNU General Public License |
417 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
418 | + */ |
419 | +import Libertine 1.0 |
420 | +import QtQuick 2.4 |
421 | +import Ubuntu.Components 1.2 |
422 | + |
423 | + |
424 | +Page { |
425 | + id: configureView |
426 | + title: i18n.tr("Configure ") + mainView.currentContainer |
427 | + |
428 | + Item { |
429 | + visible: containerConfigList.getHostArchitecture() == 'x86_64' ? true : false |
430 | + CheckBox { |
431 | + id: multiarchCheckBox |
432 | + anchors { |
433 | + left: parent.left |
434 | + top: parent.top |
435 | + leftMargin: configureView.leftMargin |
436 | + } |
437 | + checked: containerConfigList.getContainerMultiarchSupport(mainView.currentContainer) == 'enabled' ? true : false |
438 | + onClicked: { |
439 | + var comp = Qt.createComponent("ContainerManager.qml") |
440 | + if (multiarchCheckBox.checked) { |
441 | + var worker = comp.createObject(mainView, {"containerAction": ContainerManagerWorker.Configure, |
442 | + "containerId": mainView.currentContainer, |
443 | + "containerType": containerConfigList.getContainerType(mainView.currentContainer), |
444 | + "data_list": ["--multiarch", "enable"]}) |
445 | + worker.start() |
446 | + } |
447 | + else { |
448 | + var worker = comp.createObject(mainView, {"containerAction": ContainerManagerWorker.Configure, |
449 | + "containerId": mainView.currentContainer, |
450 | + "containerType": containerConfigList.getContainerType(mainView.currentContainer), |
451 | + "data_list": ["--multiarch", "disable"]}) |
452 | + worker.start() |
453 | + } |
454 | + } |
455 | + } |
456 | + Label { |
457 | + anchors { |
458 | + left: multiarchCheckBox.right |
459 | + right: parent.right |
460 | + top: parent.bottom |
461 | + verticalCenter: parent.verticalCenter |
462 | + leftMargin: units.gu(2) |
463 | + rightMargin: configureView.rightMargin |
464 | + } |
465 | + text: i18n.tr("i386 multiarch support") |
466 | + } |
467 | + |
468 | + } |
469 | +} |
470 | |
471 | === modified file 'libertine/qml/HomeView.qml' |
472 | --- libertine/qml/HomeView.qml 2016-01-20 17:34:19 +0000 |
473 | +++ libertine/qml/HomeView.qml 2016-03-02 20:24:53 +0000 |
474 | @@ -43,8 +43,10 @@ |
475 | ActionSelectionPopover { |
476 | actions: ActionList { |
477 | Action { |
478 | - text: "App Sources" |
479 | - onTriggered: print(text) |
480 | + text: "Configure Container" |
481 | + onTriggered: { |
482 | + pageStack.push(Qt.resolvedUrl("ConfigureContainer.qml")) |
483 | + } |
484 | } |
485 | Action { |
486 | text: "Update Container" |
487 | |
488 | === modified file 'python/libertine/Libertine.py' |
489 | --- python/libertine/Libertine.py 2016-01-22 15:19:08 +0000 |
490 | +++ python/libertine/Libertine.py 2016-03-02 20:24:53 +0000 |
491 | @@ -69,7 +69,7 @@ |
492 | self.container_id = container_id |
493 | self.root_path = libertine.utils.get_libertine_container_rootfs_path(self.container_id) |
494 | |
495 | - def create_libertine_container(self, password=None, verbosity=1): |
496 | + def create_libertine_container(self, password=None, multiarch=False, verbosity=1): |
497 | pass |
498 | |
499 | def destroy_libertine_container(self, verbosity=1): |
500 | @@ -124,6 +124,20 @@ |
501 | return self.run_in_container(apt_command_prefix(verbosity) + |
502 | extra_apt_args + " install '" + package_name + "'") == 0 |
503 | |
504 | + def configure_command(self, command, *args, verbosity=1): |
505 | + """ |
506 | + Configures the container based on what the command is. |
507 | + |
508 | + :param command: The configuration command to run. |
509 | + :param *args: List of arguments used for the given configuration command |
510 | + """ |
511 | + if command == 'multiarch': |
512 | + if args[0] == 'enable': |
513 | + self.run_in_container("dpkg --add-architecture i386") |
514 | + else: |
515 | + self.run_in_container(apt_command_prefix(verbosity) + "purge \".*:i386\"") |
516 | + self.run_in_container("dpkg --remove-architecture i386") |
517 | + |
518 | def get_container_distro(self, container_id): |
519 | """ |
520 | Retrieves the distro code name for a given container ID. |
521 | @@ -230,11 +244,11 @@ |
522 | """ |
523 | self.container.destroy_libertine_container() |
524 | |
525 | - def create_libertine_container(self, password=None, verbosity=1): |
526 | + def create_libertine_container(self, password=None, multiarch=False, verbosity=1): |
527 | """ |
528 | Creates the container. |
529 | """ |
530 | - self.container.create_libertine_container(password, verbosity) |
531 | + self.container.create_libertine_container(password, multiarch, verbosity) |
532 | |
533 | def update_libertine_container(self, verbosity=1): |
534 | """ |
535 | @@ -310,3 +324,7 @@ |
536 | """ |
537 | with ContainerRunning(self.container): |
538 | self.container.run_in_container(exec_line) |
539 | + |
540 | + def configure_command(self, command, *args): |
541 | + with ContainerRunning(self.container): |
542 | + self.container.configure_command(command, *args) |
543 | |
544 | === modified file 'python/libertine/LxcContainer.py' |
545 | --- python/libertine/LxcContainer.py 2016-02-04 14:11:45 +0000 |
546 | +++ python/libertine/LxcContainer.py 2016-03-02 20:24:53 +0000 |
547 | @@ -128,7 +128,7 @@ |
548 | self.container.stop() |
549 | self.container.destroy() |
550 | |
551 | - def create_libertine_container(self, password=None, verbosity=1): |
552 | + def create_libertine_container(self, password=None, multiarch=False, verbosity=1): |
553 | if password is None: |
554 | return |
555 | |
556 | @@ -180,6 +180,11 @@ |
557 | self.run_in_container("useradd -u {} -p {} -G sudo {}".format( |
558 | str(user_id), crypt.crypt(password), str(username))) |
559 | |
560 | + if multiarch and architecture == 'amd64': |
561 | + if verbosity == 1: |
562 | + print("Adding i386 multiarch support...") |
563 | + self.run_in_container("dpkg --add-architecture i386") |
564 | + |
565 | if verbosity == 1: |
566 | print("Updating the contents of the container after creation...") |
567 | self.update_packages(verbosity) |
568 | |
569 | === modified file 'tools/CMakeLists.txt' |
570 | --- tools/CMakeLists.txt 2015-12-22 15:48:32 +0000 |
571 | +++ tools/CMakeLists.txt 2016-03-02 20:24:53 +0000 |
572 | @@ -1,4 +1,4 @@ |
573 | -install(PROGRAMS libertine-container-manager libertine-launch libertine-session-bridge libertine-lxc-manager |
574 | +install(PROGRAMS libertine-container-manager libertine-launch libertine-session-bridge libertine-lxc-manager libertine-xmir |
575 | DESTINATION ${CMAKE_INSTALL_BINDIR}) |
576 | install(FILES libertine-launch.1 libertine-container-manager.1 |
577 | DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 |
578 | |
579 | === modified file 'tools/libertine-container-manager' |
580 | --- tools/libertine-container-manager 2016-01-29 17:42:37 +0000 |
581 | +++ tools/libertine-container-manager 2016-03-02 20:24:53 +0000 |
582 | @@ -102,6 +102,31 @@ |
583 | break |
584 | |
585 | |
586 | +def update_container_multiarch_support(container_id, multiarch): |
587 | + container_list = read_container_config_file() |
588 | + |
589 | + if multiarch == 'enabled' and libertine.utils.get_host_architecture() == 'i386': |
590 | + multiarch = 'disabled' |
591 | + |
592 | + for container in container_list['containerList']: |
593 | + if container['id'] == container_id: |
594 | + container['multiarch'] = multiarch |
595 | + |
596 | + write_container_config_file(container_list) |
597 | + break |
598 | + |
599 | + |
600 | +def get_container_multiarch_support(container_id): |
601 | + container_list = read_container_config_file() |
602 | + |
603 | + for container in container_list['containerList']: |
604 | + if container['id'] == container_id: |
605 | + if not 'multiarch' in container: |
606 | + return 'disabled' |
607 | + else: |
608 | + return container['multiarch'] |
609 | + |
610 | + |
611 | def add_new_container(id, name, type, distro): |
612 | if not os.path.exists(libertine.utils.get_libertine_database_dir_path()): |
613 | os.makedirs(libertine.utils.get_libertine_database_dir_path()) |
614 | @@ -237,10 +262,15 @@ |
615 | password = sys.stdin.readline().rstrip() |
616 | |
617 | add_new_container(args.id, args.name, args.type, args.distro) |
618 | + |
619 | + multiarch = 'disabled' |
620 | + if args.multiarch: |
621 | + multiarch = 'enabled' |
622 | + update_container_multiarch_support(args.id, multiarch) |
623 | |
624 | container = LibertineContainer(args.id) |
625 | update_container_install_status(args.id, "installing") |
626 | - container.create_libertine_container(password, args.verbosity) |
627 | + container.create_libertine_container(password, args.multiarch, args.verbosity) |
628 | update_container_install_status(args.id, "ready") |
629 | |
630 | |
631 | @@ -352,6 +382,29 @@ |
632 | container.exec_command(args.command) |
633 | |
634 | |
635 | +def configure(args): |
636 | + if args.id and not libertine.utils.container_exists(args.id): |
637 | + print("Container id \'%s\' does not exist." % args.id, file=sys.stderr) |
638 | + sys.exit(1) |
639 | + elif not args.id: |
640 | + args.id = get_default_container_id() |
641 | + |
642 | + container = LibertineContainer(args.id) |
643 | + |
644 | + if args.multiarch and libertine.utils.get_host_architecture() == 'amd64': |
645 | + multiarch = 'disabled' |
646 | + if args.multiarch == 'enable': |
647 | + multiarch = 'enabled' |
648 | + |
649 | + current_multiarch = get_container_multiarch_support(args.id) |
650 | + if current_multiarch == multiarch: |
651 | + print("i386 multiarch support is already %s" % multiarch) |
652 | + sys.exit(0) |
653 | + |
654 | + container.configure_command('multiarch', args.multiarch) |
655 | + update_container_multiarch_support(args.id, multiarch) |
656 | + |
657 | + |
658 | if __name__ == '__main__': |
659 | parser = argparse.ArgumentParser(description="Legacy X application support for Unity 8") |
660 | parser.add_argument('-q', '--quiet', |
661 | @@ -383,6 +436,10 @@ |
662 | '--force', action='store_true', |
663 | help=("Force the installation of the given valid Ubuntu distro even if " |
664 | "it is no longer supported.")) |
665 | + parser_create.add_argument( |
666 | + '-m', '--multiarch', action='store_true', |
667 | + help=("Add i386 support to amd64 Libertine containers. This option has " |
668 | + "no effect when the Libertine container is i386.")) |
669 | parser_create.set_defaults(func=create) |
670 | |
671 | # Handle the destroy command and its options |
672 | @@ -448,6 +505,7 @@ |
673 | help=("List all Libertine containers.")) |
674 | parser_list.set_defaults(func=list) |
675 | |
676 | + # Handle the list-apps command and its options |
677 | parser_list_apps = subparsers.add_parser( |
678 | 'list-apps', |
679 | help=("List available app launchers in a container.")) |
680 | @@ -460,6 +518,7 @@ |
681 | help=("use JSON output format.")) |
682 | parser_list_apps.set_defaults(func=list_apps) |
683 | |
684 | + # Handle the execute command and it's options |
685 | parser_exec = subparsers.add_parser( |
686 | 'exec', |
687 | help=("Run an arbitrary command in the specified Libertine container.")) |
688 | @@ -471,7 +530,22 @@ |
689 | help=("The command to run in the specified container.")) |
690 | parser_exec.set_defaults(func=exec) |
691 | |
692 | -# Actually parse the args |
693 | + # Handle the configure command and it's options |
694 | + parser_configure = subparsers.add_parser( |
695 | + 'configure', |
696 | + help=("Configure various options in the specified Libertine container.")) |
697 | + parser_configure.add_argument( |
698 | + '-i', '--id', |
699 | + help=("Container identifier. Default container is used if omitted.")) |
700 | + parser_configure.add_argument( |
701 | + '-m', '--multiarch', |
702 | + choices=['enable', 'disable'], |
703 | + help=("Enables or disables i386 multiarch support for amd64 Libertine " |
704 | + "containers. This option has no effect when the Libertine " |
705 | + "container is i386.")) |
706 | + parser_configure.set_defaults(func=configure) |
707 | + |
708 | + # Actually parse the args |
709 | args = parser.parse_args() |
710 | if args.verbosity is None: |
711 | args.verbosity = 1 |
712 | |
713 | === added file 'tools/libertine-xmir' |
714 | --- tools/libertine-xmir 1970-01-01 00:00:00 +0000 |
715 | +++ tools/libertine-xmir 2016-03-02 20:24:53 +0000 |
716 | @@ -0,0 +1,19 @@ |
717 | +#!/bin/sh |
718 | +# Copyright (C) 2016 Canonical Ltd. |
719 | +# Author: Christopher Townsend <christopher.townsend@canonical.com> |
720 | + |
721 | +# This program is free software: you can redistribute it and/or modify |
722 | +# it under the terms of the GNU General Public License as published by |
723 | +# the Free Software Foundation; version 3 of the License. |
724 | +# |
725 | +# This program is distributed in the hope that it will be useful, |
726 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
727 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
728 | +# GNU General Public License for more details. |
729 | +# |
730 | +# You should have received a copy of the GNU General Public License |
731 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
732 | + |
733 | + |
734 | +# Add and/or remove Xmir options here |
735 | +exec Xmir -title @ $@ |
Sane.