Merge lp:~therve/landscape-client/on-demand-install-script into lp:~landscape/landscape-client/trunk

Proposed by Thomas Herve
Status: Merged
Approved by: Alberto Donato
Approved revision: 492
Merged at revision: 490
Proposed branch: lp:~therve/landscape-client/on-demand-install-script
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 208 lines (+101/-26)
7 files modified
applications/landscape-client-settings.desktop (+1/-1)
debian/control (+14/-0)
debian/landscape-client-ui-install.install (+3/-0)
debian/landscape-client-ui.install (+0/-2)
debian/rules (+17/-17)
scripts/landscape-client-ui-install (+62/-0)
setup.py (+4/-6)
To merge this branch: bzr merge lp:~therve/landscape-client/on-demand-install-script
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
Free Ekanayaka (community) Approve
Review via email: mp+96787@code.launchpad.net

Description of the change

The branch defines a new script and a package installing it. The icon and the desktop file also move to that package.

To post a comment you must log in.
491. By Thomas Herve

Use a whitelist of packages

Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Looks good! +1

[1]

+ return False

What do we need this for?

[2]

 ifneq (,$(filter $(dist_release),precise))
  # We want landscape-client-ui only from precise onward
 dh_extra_flags = -plandscape-common -plandscape-client -plandscape-client-ui -plandscape-client-install-ui
 else
 dh_extra_flags = -plandscape-common -plandscape-client
 endif

You can save some duplication by writing:

dh_extra_flags = -plandscape-common -plandscape-client
ifneq (,$(filter $(dist_release),precise))
 # We want landscape-client-ui only from precise onward
 dh_extra_flags = $(dh_extra_flags) -plandscape-client-ui -plandscape-client-install-ui
endif

review: Approve
492. By Thomas Herve

Cleanup dh_extra_flags definiton

Revision history for this message
Alberto Donato (ack) wrote :

Looks good! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'applications/landscape-client-settings.desktop'
2--- applications/landscape-client-settings.desktop 2012-01-19 14:06:45 +0000
3+++ applications/landscape-client-settings.desktop 2012-03-09 17:06:22 +0000
4@@ -1,7 +1,7 @@
5 [Desktop Entry]
6 Name=Management Service
7 Comment=Management Service Preferences
8-Exec=landscape-client-settings-ui
9+Exec=landscape-client-ui-install
10 Icon=preferences-management-service
11 Terminal=False
12 Type=Application
13
14=== modified file 'debian/control'
15--- debian/control 2012-03-09 10:47:49 +0000
16+++ debian/control 2012-03-09 17:06:22 +0000
17@@ -59,3 +59,17 @@
18 .
19 This package provides the Landscape client configuration UI.
20 XB-Python-Version: ${python:Versions}
21+
22+Package: landscape-client-ui-install
23+Architecture: any
24+Depends: ${python:Depends}, ${misc:Depends},
25+ python-gobject,
26+ python-dbus,
27+ policykit-1,
28+ gir1.2-gtk-3.0,
29+ python-aptdaemon
30+Description: The Landscape administration system client
31+ Landscape is a web-based tool for managing Ubuntu systems.
32+ .
33+ This package provides an automatic installer for landscape-client-ui.
34+XB-Python-Version: ${python:Versions}
35
36=== added file 'debian/landscape-client-ui-install.install'
37--- debian/landscape-client-ui-install.install 1970-01-01 00:00:00 +0000
38+++ debian/landscape-client-ui-install.install 2012-03-09 17:06:22 +0000
39@@ -0,0 +1,3 @@
40+usr/bin/landscape-client-ui-install
41+usr/share/applications/landscape-client-settings.desktop
42+usr/share/icons/hicolor/scalable/apps/preferences-management-service.svg
43
44=== modified file 'debian/landscape-client-ui.install'
45--- debian/landscape-client-ui.install 2012-03-09 08:46:50 +0000
46+++ debian/landscape-client-ui.install 2012-03-09 17:06:22 +0000
47@@ -7,6 +7,4 @@
48 usr/share/polkit-1/actions/com.canonical.LandscapeClientRegistration.policy
49 etc/dbus-1/system.d/com.canonical.LandscapeClientSettings.conf
50 etc/dbus-1/system.d/com.canonical.LandscapeClientRegistration.conf
51-usr/share/applications/landscape-client-settings.desktop
52-usr/share/icons/hicolor/scalable/apps/preferences-management-service.svg
53 usr/share/glib-2.0/schemas/com.canonical.landscape-client-settings.gschema.xml
54
55=== modified file 'debian/rules'
56--- debian/rules 2012-03-09 08:46:50 +0000
57+++ debian/rules 2012-03-09 17:06:22 +0000
58@@ -2,24 +2,24 @@
59
60 dist_release := $(shell lsb_release -cs)
61 ifneq ($(dist_release),dapper)
62- use_pycentral = yes
63+ use_pycentral = yes
64 endif
65 ifeq (,$(filter $(dist_release), hardy lucid))
66- use_dhpython2 = yes
67+ use_dhpython2 = yes
68 endif
69+
70+dh_extra_flags = -plandscape-common -plandscape-client
71 ifneq (,$(filter $(dist_release),precise))
72 # We want landscape-client-ui only from precise onward
73- dh_extra_flags =
74-else
75- dh_extra_flags = -Nlandscape-client-ui
76+ dh_extra_flags = $(dh_extra_flags) -plandscape-client-ui -plandscape-client-install-ui
77 endif
78
79 -include /usr/share/python/python.mk
80 ifeq (,$(py_sitename))
81- py_sitename = site-packages
82- py_libdir = /usr/lib/python$(subst python,,$(1))/site-packages
83- py_sitename_sh = $(py_sitename)
84- py_libdir_sh = $(py_libdir)
85+ py_sitename = site-packages
86+ py_libdir = /usr/lib/python$(subst python,,$(1))/site-packages
87+ py_sitename_sh = $(py_sitename)
88+ py_libdir_sh = $(py_libdir)
89 endif
90
91 package = landscape-client
92@@ -107,15 +107,15 @@
93 ifeq ($(use_dhpython2),yes)
94 dh_python2 --no-guessing-versions
95 else
96- ifeq ($(use_pycentral),yes)
97- ifneq (,$(py_setup_install_args))
98- DH_PYCENTRAL=include-links dh_pycentral
99- else
100- DH_PYCENTRAL=nomove dh_pycentral
101- endif
102- else
103+ ifeq ($(use_pycentral),yes)
104+ ifneq (,$(py_setup_install_args))
105+ DH_PYCENTRAL=include-links dh_pycentral
106+ else
107+ DH_PYCENTRAL=nomove dh_pycentral
108+ endif
109+ else
110 dh_python
111- endif
112+ endif
113 endif
114 dh_installdeb $(dh_extra_flags)
115 dh_gencontrol $(dh_extra_flags)
116
117=== added file 'scripts/landscape-client-ui-install'
118--- scripts/landscape-client-ui-install 1970-01-01 00:00:00 +0000
119+++ scripts/landscape-client-ui-install 2012-03-09 17:06:22 +0000
120@@ -0,0 +1,62 @@
121+#!/usr/bin/python
122+
123+import os
124+import dbus
125+import subprocess
126+
127+from gi.repository import GObject, Gtk
128+
129+from aptdaemon.client import AptClient
130+from defer import inline_callbacks
131+from aptdaemon import policykit1
132+from aptdaemon.gtk3widgets import AptProgressDialog
133+
134+
135+script = "/usr/bin/landscape-client-settings-ui"
136+
137+
138+def on_transaction_done(transaction, exit):
139+ Gtk.main_quit()
140+
141+
142+@inline_callbacks
143+def install_package():
144+ aptclient = AptClient()
145+ bus = dbus.SystemBus()
146+ name = bus.get_unique_name()
147+ action = policykit1.PK_ACTION_INSTALL_OR_REMOVE_PACKAGES
148+ flags = policykit1.CHECK_AUTH_ALLOW_USER_INTERACTION
149+ yield policykit1.check_authorization_by_name(name, action, flags=flags)
150+ transaction = yield aptclient.install_packages(
151+ ["landscape-client-ui"])
152+ transaction.connect('finished', on_transaction_done)
153+ dia = AptProgressDialog(transaction)
154+ dia.run(close_on_finished=True, show_error=True)
155+
156+
157+def main():
158+ dialog = Gtk.MessageDialog(
159+ flags=Gtk.DialogFlags.MODAL, type=Gtk.MessageType.INFO,
160+ buttons=Gtk.ButtonsType.CANCEL)
161+ dialog.set_markup(
162+ "<big><b>%s</b></big>\n\n%s" % (
163+ "Landscape client is not installed",
164+ "You need to install Landscape client to be able to configure it. "
165+ "Do you want to intall it now?"))
166+ dialog.set_title("Install Landscape client?")
167+ dialog.add_button("Install", Gtk.ResponseType.YES)
168+ result = dialog.run()
169+ dialog.destroy()
170+ if result == Gtk.ResponseType.YES:
171+ install_package()
172+ else:
173+ Gtk.main_quit()
174+ return False
175+
176+
177+if __name__ == "__main__":
178+ if not os.path.exists(script):
179+ GObject.idle_add(main)
180+ Gtk.main()
181+ else:
182+ subprocess.call(script)
183
184=== modified file 'setup.py'
185--- setup.py 2012-03-09 08:46:50 +0000
186+++ setup.py 2012-03-09 17:06:22 +0000
187@@ -44,8 +44,7 @@
188 ("/usr/share/icons/hicolor/scalable/apps/",
189 ["icons/preferences-management-service.svg"]),
190 ("/usr/share/glib-2.0/schemas/",
191- ["glib-2.0/schemas/com.canonical.landscape-client-settings.gschema.xml"])
192- ],
193+ ["glib-2.0/schemas/com.canonical.landscape-client-settings.gschema.xml"])],
194 scripts=["scripts/landscape-client",
195 "scripts/landscape-config",
196 "scripts/landscape-message",
197@@ -60,8 +59,7 @@
198 "scripts/landscape-dbus-proxy",
199 "scripts/landscape-client-settings-mechanism",
200 "scripts/landscape-client-registration-mechanism",
201- "scripts/landscape-client-settings-ui"
202- ],
203+ "scripts/landscape-client-settings-ui",
204+ "scripts/landscape-client-ui-install"],
205 ext_modules=[Extension("landscape.lib.initgroups",
206- ["landscape/lib/initgroups.c"])]
207- )
208+ ["landscape/lib/initgroups.c"])])

Subscribers

People subscribed via source and target branches

to all changes: