Merge lp:~mvo/aptdaemon/enable-component into lp:aptdaemon

Proposed by Michael Vogt
Status: Merged
Merge reported by: Michael Vogt
Merged at revision: not available
Proposed branch: lp:~mvo/aptdaemon/enable-component
Merge into: lp:aptdaemon
Diff against target: 69 lines (+41/-0)
2 files modified
aptdaemon/client.py (+12/-0)
aptdaemon/core.py (+29/-0)
To merge this branch: bzr merge lp:~mvo/aptdaemon/enable-component
Reviewer Review Type Date Requested Status
Sebastian Heinlein Approve
Review via email: mp+22386@code.launchpad.net

Description of the change

add a enable_component() functionality for apturl and software-properties

To post a comment you must log in.
lp:~mvo/aptdaemon/enable-component updated
339. By Michael Vogt

rename to EnableDistroComponent

Revision history for this message
Sebastian Heinlein (glatzor) wrote :

Merged some time ago

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'aptdaemon/client.py'
--- aptdaemon/client.py 2010-03-17 05:29:47 +0000
+++ aptdaemon/client.py 2010-03-30 07:39:29 +0000
@@ -585,6 +585,18 @@
585 return self._run_transaction("InstallPackages", [package_names],585 return self._run_transaction("InstallPackages", [package_names],
586 wait, reply_handler, error_handler)586 wait, reply_handler, error_handler)
587587
588 def enable_distro_component(self, component,
589 reply_handler=None, error_handler=None):
590 """Add component to the sources list.
591
592 Keyword arguments:
593 component -- a components e.g. main or universe
594 """
595 daemon = get_aptdaemon()
596 return daemon.EnableDistroComponent(component,
597 reply_handler=reply_handler,
598 error_handler=error_handler)
599
588 def add_repository(self, src_type, uri, dist, comps=[], comment="", 600 def add_repository(self, src_type, uri, dist, comps=[], comment="",
589 sourcesfile="", reply_handler=None, error_handler=None):601 sourcesfile="", reply_handler=None, error_handler=None):
590 """Add repository to the sources list.602 """Add repository to the sources list.
591603
=== modified file 'aptdaemon/core.py'
--- aptdaemon/core.py 2010-02-10 10:48:21 +0000
+++ aptdaemon/core.py 2010-03-30 07:39:29 +0000
@@ -52,6 +52,8 @@
52from softwareproperties.AptAuth import AptAuth52from softwareproperties.AptAuth import AptAuth
53from aptsources.sourceslist import SourcesList53from aptsources.sourceslist import SourcesList
54import apt_pkg54import apt_pkg
55import aptsources
56import aptsources.distro
5557
56import errors58import errors
57from enums import *59from enums import *
@@ -1167,6 +1169,33 @@
1167 sourcesfile))1169 sourcesfile))
1168 return deferred1170 return deferred
11691171
1172 def _enable_component(self, component):
1173 """Helper for the enable-component function"""
1174 old_umask = os.umask(0022)
1175 sourceslist = SourcesList()
1176 distro = aptsources.distro.get_distro()
1177 distro.get_sources(sourceslist)
1178 distro.enable_component(component)
1179 sourceslist.save()
1180 os.umask(old_umask)
1181 return True
1182
1183 @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,
1184 in_signature="s", out_signature="b",
1185 sender_keyword="sender")
1186 def EnableDistroComponent(self, component, sender):
1187 """Enable given component in the sources list.
1188
1189 Keyword arguments:
1190 component -- a components, e.g. main or universe
1191 sender -- the unique D-Bus name of the sender (provided by D-Bus)
1192 """
1193 log.info("EnableComponent() was called: component='%s' ", component)
1194 action = policykit1.PK_ACTION_CHANGE_REPOSITORY
1195 deferred = policykit1.check_authorization_by_name(sender, action)
1196 deferred.add_callback(lambda x: self._enable_component(component))
1197 return deferred
1198
1170 @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,1199 @dbus_deferred_method(APTDAEMON_DBUS_INTERFACE,
1171 in_signature="", out_signature="as",1200 in_signature="", out_signature="as",
1172 sender_keyword="sender")1201 sender_keyword="sender")

Subscribers

People subscribed via source and target branches

to status/vote changes: