Merge lp:~flamingolof/aptdaemon/s-p-gtk-fixes into lp:aptdaemon
- s-p-gtk-fixes
- Merge into main
Proposed by
Olof Kindgren
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~flamingolof/aptdaemon/s-p-gtk-fixes |
Merge into: | lp:aptdaemon |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~flamingolof/aptdaemon/s-p-gtk-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Aptdaemon Developers | Pending | ||
Review via email: mp+8533@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Olof Kindgren (flamingolof) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'aptdaemon/client.py' | |||
2 | --- aptdaemon/client.py 2009-07-07 13:25:51 +0000 | |||
3 | +++ aptdaemon/client.py 2009-07-09 17:05:04 +0000 | |||
4 | @@ -40,7 +40,6 @@ | |||
5 | 40 | import errors | 40 | import errors |
6 | 41 | import policykit | 41 | import policykit |
7 | 42 | 42 | ||
8 | 43 | |||
9 | 44 | class AptMessage: | 43 | class AptMessage: |
10 | 45 | """Represents a non-cirtical information or warning from the daemon""" | 44 | """Represents a non-cirtical information or warning from the daemon""" |
11 | 46 | def __init__(self, enum, details): | 45 | def __init__(self, enum, details): |
12 | @@ -320,6 +319,11 @@ | |||
13 | 320 | self._locale = "%s.%s" % locale.getdefaultlocale() | 319 | self._locale = "%s.%s" % locale.getdefaultlocale() |
14 | 321 | self.terminal = None | 320 | self.terminal = None |
15 | 322 | 321 | ||
16 | 322 | def get_trusted_keys(self, exit_handler=None): | ||
17 | 323 | daemon = get_aptdaemon() | ||
18 | 324 | keys = polkit_auth_wrapper(daemon.GetTrustedKeys) | ||
19 | 325 | return keys | ||
20 | 326 | |||
21 | 323 | def upgrade_system(self, safe_mode=True, exit_handler=None): | 327 | def upgrade_system(self, safe_mode=True, exit_handler=None): |
22 | 324 | """Upgrade system.""" | 328 | """Upgrade system.""" |
23 | 325 | return self._run_transaction("UpgradeSystem", [safe_mode], | 329 | return self._run_transaction("UpgradeSystem", [safe_mode], |
24 | @@ -330,6 +334,14 @@ | |||
25 | 330 | return self._run_transaction("InstallPackages", [package_names], | 334 | return self._run_transaction("InstallPackages", [package_names], |
26 | 331 | exit_handler) | 335 | exit_handler) |
27 | 332 | 336 | ||
28 | 337 | def install_key_file(self, path, exit_handler=None): | ||
29 | 338 | """Install repository key file.""" | ||
30 | 339 | return self._run_transaction("InstallKeyFile", [path], exit_handler) | ||
31 | 340 | |||
32 | 341 | def remove_key(self, fingerprint, exit_handler=None): | ||
33 | 342 | """Remove repository key.""" | ||
34 | 343 | return self._run_transaction("RemoveKey", [fingerprint], exit_handler) | ||
35 | 344 | |||
36 | 333 | def install_file(self, path, exit_handler=None): | 345 | def install_file(self, path, exit_handler=None): |
37 | 334 | """Install local package file.""" | 346 | """Install local package file.""" |
38 | 335 | return self._run_transaction("InstallFile", [path], exit_handler) | 347 | return self._run_transaction("InstallFile", [path], exit_handler) |
39 | 336 | 348 | ||
40 | === modified file 'aptdaemon/console.py' | |||
41 | --- aptdaemon/console.py 2009-07-09 08:16:58 +0000 | |||
42 | +++ aptdaemon/console.py 2009-07-09 17:05:04 +0000 | |||
43 | @@ -78,12 +78,30 @@ | |||
44 | 78 | self._set_transaction(trans) | 78 | self._set_transaction(trans) |
45 | 79 | trans.run(block=True) | 79 | trans.run(block=True) |
46 | 80 | 80 | ||
47 | 81 | def install_key_file(self, path): | ||
48 | 82 | """Install repository key file.""" | ||
49 | 83 | trans = self._client.install_key_file(path, | ||
50 | 84 | exit_handler=self._on_exit) | ||
51 | 85 | self._set_transaction(trans) | ||
52 | 86 | trans.run(block=True) | ||
53 | 87 | |||
54 | 88 | def remove_key(self, fingerprint): | ||
55 | 89 | """Remove repository key.""" | ||
56 | 90 | trans = self._client.remove_key(fingerprint, exit_handler=self._on_exit) | ||
57 | 91 | self._set_transaction(trans) | ||
58 | 92 | trans.run(block=True) | ||
59 | 93 | |||
60 | 81 | def install_file(self, path): | 94 | def install_file(self, path): |
61 | 82 | """Install package file.""" | 95 | """Install package file.""" |
62 | 83 | trans = self._client.install_file(path, exit_handler=self._on_exit) | 96 | trans = self._client.install_file(path, exit_handler=self._on_exit) |
63 | 84 | self._set_transaction(trans) | 97 | self._set_transaction(trans) |
64 | 85 | trans.run(block=True) | 98 | trans.run(block=True) |
65 | 86 | 99 | ||
66 | 100 | def get_trusted_keys(self): | ||
67 | 101 | keys = self._client.get_trusted_keys(exit_handler=self._on_exit) | ||
68 | 102 | for key in keys: | ||
69 | 103 | print key | ||
70 | 104 | |||
71 | 87 | def remove_packages(self, packages): | 105 | def remove_packages(self, packages): |
72 | 88 | """Remove packages""" | 106 | """Remove packages""" |
73 | 89 | trans = self._client.remove_packages(packages, | 107 | trans = self._client.remove_packages(packages, |
74 | @@ -293,6 +311,15 @@ | |||
75 | 293 | parser.add_option("", "--upgrade-system", default="", | 311 | parser.add_option("", "--upgrade-system", default="", |
76 | 294 | action="store_true", dest="dist_upgrade", | 312 | action="store_true", dest="dist_upgrade", |
77 | 295 | help=_("Upgrade the system")) | 313 | help=_("Upgrade the system")) |
78 | 314 | parser.add_option("", "--install-key-file", default="", | ||
79 | 315 | action="store", type="string", dest="install_key_file", | ||
80 | 316 | help=_("Install key from file")) | ||
81 | 317 | parser.add_option("", "--list-trusted-keys", default="", | ||
82 | 318 | action="store_true", dest="get_trusted_keys", | ||
83 | 319 | help=_("Get trusted keys")) | ||
84 | 320 | parser.add_option("", "--remove-key", default="", | ||
85 | 321 | action="store", type="string", dest="remove_key", | ||
86 | 322 | help=_("Remove key with the given fingerprint")) | ||
87 | 296 | parser.add_option("", "--hide-terminal", | 323 | parser.add_option("", "--hide-terminal", |
88 | 297 | action="store_true", dest="hide_terminal", | 324 | action="store_true", dest="hide_terminal", |
89 | 298 | help=_("Do not attach to the apt terminal")) | 325 | help=_("Do not attach to the apt terminal")) |
90 | @@ -309,6 +336,12 @@ | |||
91 | 309 | options.remove.split(), | 336 | options.remove.split(), |
92 | 310 | options.purge.split(), | 337 | options.purge.split(), |
93 | 311 | options.upgrade.split()) | 338 | options.upgrade.split()) |
94 | 339 | elif options.install_key_file: | ||
95 | 340 | client.install_key_file(options.install_key_file) | ||
96 | 341 | elif options.remove_key: | ||
97 | 342 | client.remove_key(options.remove_key) | ||
98 | 343 | elif options.get_trusted_keys: | ||
99 | 344 | client.get_trusted_keys() | ||
100 | 312 | else: | 345 | else: |
101 | 313 | parser.print_help() | 346 | parser.print_help() |
102 | 314 | sys.exit(1) | 347 | sys.exit(1) |
103 | 315 | 348 | ||
104 | === modified file 'aptdaemon/core.py' | |||
105 | --- aptdaemon/core.py 2009-07-07 15:07:52 +0000 | |||
106 | +++ aptdaemon/core.py 2009-07-09 17:05:04 +0000 | |||
107 | @@ -55,7 +55,7 @@ | |||
108 | 55 | import policykit | 55 | import policykit |
109 | 56 | from worker import AptWorker | 56 | from worker import AptWorker |
110 | 57 | from misc import get_main_loop | 57 | from misc import get_main_loop |
112 | 58 | 58 | from softwareproperties.AptAuth import AptAuth | |
113 | 59 | # Setup i18n | 59 | # Setup i18n |
114 | 60 | gettext.textdomain("aptdaemon") | 60 | gettext.textdomain("aptdaemon") |
115 | 61 | 61 | ||
116 | @@ -551,6 +551,54 @@ | |||
117 | 551 | @dbus.service.method(APTDAEMON_TRANSACTION_DBUS_INTERFACE, | 551 | @dbus.service.method(APTDAEMON_TRANSACTION_DBUS_INTERFACE, |
118 | 552 | in_signature="s", out_signature="", | 552 | in_signature="s", out_signature="", |
119 | 553 | sender_keyword="sender") | 553 | sender_keyword="sender") |
120 | 554 | def InstallKeyFile(self, path, sender): | ||
121 | 555 | """Install the given key file. | ||
122 | 556 | |||
123 | 557 | Keyword arguments: | ||
124 | 558 | path -- the absolute path to the package file | ||
125 | 559 | sender -- the unique D-Bus name of the sender (provided by D-Bus) | ||
126 | 560 | """ | ||
127 | 561 | log_trans.info("InstallKeyFile() was called: %s" % path) | ||
128 | 562 | self._check_caller(sender) | ||
129 | 563 | if self.role != ROLE_UNSET: | ||
130 | 564 | raise TransactionRoleAlreadySet() | ||
131 | 565 | action = policykit.PK_ACTION_INSTALL_KEY_FILE | ||
132 | 566 | if not policykit.is_authorized_sender(action, sender): | ||
133 | 567 | raise errors.NotAuthorizedError(action, sender) | ||
134 | 568 | #FIXME: Perform some checks | ||
135 | 569 | self.role = ROLE_INSTALL_KEY_FILE | ||
136 | 570 | self.kwargs = {"path" : path} | ||
137 | 571 | log_trans.debug("Queue transaction") | ||
138 | 572 | self.queue.put(self) | ||
139 | 573 | log_trans.debug("Queued") | ||
140 | 574 | |||
141 | 575 | @dbus.service.method(APTDAEMON_TRANSACTION_DBUS_INTERFACE, | ||
142 | 576 | in_signature="s", out_signature="", | ||
143 | 577 | sender_keyword="sender") | ||
144 | 578 | def RemoveKey(self, fingerprint, sender): | ||
145 | 579 | """Remove the given key. | ||
146 | 580 | |||
147 | 581 | Keyword arguments: | ||
148 | 582 | fingerprint -- the fingerprint of the key to remove | ||
149 | 583 | sender -- the unique D-Bus name of the sender (provided by D-Bus) | ||
150 | 584 | """ | ||
151 | 585 | log_trans.info("RemoveKey() was called: %s" % fingerprint) | ||
152 | 586 | self._check_caller(sender) | ||
153 | 587 | if self.role != ROLE_UNSET: | ||
154 | 588 | raise TransactionRoleAlreadySet() | ||
155 | 589 | action = policykit.PK_ACTION_REMOVE_KEY | ||
156 | 590 | if not policykit.is_authorized_sender(action, sender): | ||
157 | 591 | raise errors.NotAuthorizedError(action, sender) | ||
158 | 592 | #FIXME: Perform some checks | ||
159 | 593 | self.role = ROLE_REMOVE_KEY | ||
160 | 594 | self.kwargs = {"fingerprint" : fingerprint} | ||
161 | 595 | log_trans.debug("Queue transaction") | ||
162 | 596 | self.queue.put(self) | ||
163 | 597 | log_trans.debug("Queued") | ||
164 | 598 | |||
165 | 599 | @dbus.service.method(APTDAEMON_TRANSACTION_DBUS_INTERFACE, | ||
166 | 600 | in_signature="s", out_signature="", | ||
167 | 601 | sender_keyword="sender") | ||
168 | 554 | def InstallFile(self, path, sender): | 602 | def InstallFile(self, path, sender): |
169 | 555 | """Install the given package file. | 603 | """Install the given package file. |
170 | 556 | 604 | ||
171 | @@ -940,6 +988,19 @@ | |||
172 | 940 | return trans.tid | 988 | return trans.tid |
173 | 941 | 989 | ||
174 | 942 | @dbus.service.method(APTDAEMON_DBUS_INTERFACE, | 990 | @dbus.service.method(APTDAEMON_DBUS_INTERFACE, |
175 | 991 | in_signature="", out_signature="as", | ||
176 | 992 | sender_keyword="sender") | ||
177 | 993 | def GetTrustedKeys(self,sender): | ||
178 | 994 | """Return a list of installed repository keys.""" | ||
179 | 995 | log_trans.info("GetTrustedKeys() was called") | ||
180 | 996 | action = policykit.PK_ACTION_GET_TRUSTED_KEYS | ||
181 | 997 | if not policykit.is_authorized_sender(action, sender): | ||
182 | 998 | raise errors.NotAuthorizedError(action, sender) | ||
183 | 999 | aptauth = AptAuth() | ||
184 | 1000 | keys = aptauth.list() | ||
185 | 1001 | return keys | ||
186 | 1002 | |||
187 | 1003 | @dbus.service.method(APTDAEMON_DBUS_INTERFACE, | ||
188 | 943 | in_signature="", out_signature="sas") | 1004 | in_signature="", out_signature="sas") |
189 | 944 | def GetActiveTransactions(self): | 1005 | def GetActiveTransactions(self): |
190 | 945 | """Return the currently running transaction and the list of queued | 1006 | """Return the currently running transaction and the list of queued |
191 | 946 | 1007 | ||
192 | === modified file 'aptdaemon/enums.py' | |||
193 | --- aptdaemon/enums.py 2009-07-06 23:29:31 +0000 | |||
194 | +++ aptdaemon/enums.py 2009-07-09 17:00:21 +0000 | |||
195 | @@ -33,6 +33,8 @@ | |||
196 | 33 | (ERROR_PACKAGE_DOWNLOAD_FAILED, | 33 | (ERROR_PACKAGE_DOWNLOAD_FAILED, |
197 | 34 | ERROR_REPO_DOWNLOAD_FAILED, | 34 | ERROR_REPO_DOWNLOAD_FAILED, |
198 | 35 | ERROR_DEPENDENCIES_BROKEN, | 35 | ERROR_DEPENDENCIES_BROKEN, |
199 | 36 | ERROR_KEY_NOT_INSTALLED, | ||
200 | 37 | ERROR_KEY_NOT_REMOVED, | ||
201 | 36 | ERROR_NO_LOCK, | 38 | ERROR_NO_LOCK, |
202 | 37 | ERROR_NO_CACHE, | 39 | ERROR_NO_CACHE, |
203 | 38 | ERROR_NO_PACKAGE, | 40 | ERROR_NO_PACKAGE, |
204 | @@ -41,7 +43,7 @@ | |||
205 | 41 | ERROR_PACKAGE_NOT_INSTALLED, | 43 | ERROR_PACKAGE_NOT_INSTALLED, |
206 | 42 | ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE, | 44 | ERROR_NOT_REMOVE_ESSENTIAL_PACKAGE, |
207 | 43 | ERROR_DAEMON_DIED, | 45 | ERROR_DAEMON_DIED, |
209 | 44 | ERROR_UNKNOWN) = range(12) | 46 | ERROR_UNKNOWN) = range(14) |
210 | 45 | 47 | ||
211 | 46 | # Message enums | 48 | # Message enums |
212 | 47 | (MSG_SYSTEM_ALREADY_UPTODATE, | 49 | (MSG_SYSTEM_ALREADY_UPTODATE, |
213 | @@ -62,14 +64,15 @@ | |||
214 | 62 | 64 | ||
215 | 63 | (ROLE_UNSET, | 65 | (ROLE_UNSET, |
216 | 64 | ROLE_INSTALL_PACKAGES, | 66 | ROLE_INSTALL_PACKAGES, |
218 | 65 | ROLE_INSTALL_SIGNATURE, | 67 | ROLE_INSTALL_KEY_FILE, |
219 | 66 | ROLE_INSTALL_FILE, | 68 | ROLE_INSTALL_FILE, |
220 | 67 | ROLE_UPGRADE_PACKAGES, | 69 | ROLE_UPGRADE_PACKAGES, |
221 | 68 | ROLE_UPGRADE_SYSTEM, | 70 | ROLE_UPGRADE_SYSTEM, |
222 | 69 | ROLE_UPDATE_CACHE, | 71 | ROLE_UPDATE_CACHE, |
223 | 72 | ROLE_REMOVE_KEY, | ||
224 | 70 | ROLE_REMOVE_PACKAGES, | 73 | ROLE_REMOVE_PACKAGES, |
225 | 71 | ROLE_COMMIT_PACKAGES, | 74 | ROLE_COMMIT_PACKAGES, |
227 | 72 | ROLE_REMOVE_SIGNATURE) = range(10) | 75 | ROLE_REMOVE_KEY_FILE) = range(11) |
228 | 73 | 76 | ||
229 | 74 | ICONS_STATUS = { | 77 | ICONS_STATUS = { |
230 | 75 | STATUS_CANCELLING:'aptdaemon-cleanup', | 78 | STATUS_CANCELLING:'aptdaemon-cleanup', |
231 | @@ -94,7 +97,7 @@ | |||
232 | 94 | ICONS_ROLE = { | 97 | ICONS_ROLE = { |
233 | 95 | ROLE_INSTALL_FILE:'aptdaemon-add', | 98 | ROLE_INSTALL_FILE:'aptdaemon-add', |
234 | 96 | ROLE_INSTALL_PACKAGES:'aptdaemon-add', | 99 | ROLE_INSTALL_PACKAGES:'aptdaemon-add', |
236 | 97 | ROLE_INSTALL_SIGNATURE:'emblem-system', | 100 | ROLE_INSTALL_KEY_FILE:'emblem-system', |
237 | 98 | ROLE_UPDATE_CACHE:'aptdaemon-update-cache', | 101 | ROLE_UPDATE_CACHE:'aptdaemon-update-cache', |
238 | 99 | ROLE_REMOVE_PACKAGES:'aptdaemon-delete', | 102 | ROLE_REMOVE_PACKAGES:'aptdaemon-delete', |
239 | 100 | ROLE_UPGRADE_PACKAGES:'aptdaemon-upgrade', | 103 | ROLE_UPGRADE_PACKAGES:'aptdaemon-upgrade', |
240 | @@ -127,8 +130,9 @@ | |||
241 | 127 | PAST_ROLE = { | 130 | PAST_ROLE = { |
242 | 128 | ROLE_INSTALL_FILE : _("Installed file"), | 131 | ROLE_INSTALL_FILE : _("Installed file"), |
243 | 129 | ROLE_INSTALL_PACKAGES : _("Installed packages"), | 132 | ROLE_INSTALL_PACKAGES : _("Installed packages"), |
245 | 130 | ROLE_INSTALL_SIGNATURE: _("Installed signature"), | 133 | ROLE_INSTALL_KEY_FILE: _("Installed key"), |
246 | 131 | ROLE_UPDATE_CACHE : _("Updated cache"), | 134 | ROLE_UPDATE_CACHE : _("Updated cache"), |
247 | 135 | ROLE_REMOVE_KEY : _("Removed key"), | ||
248 | 132 | ROLE_REMOVE_PACKAGES : _("Removed packages"), | 136 | ROLE_REMOVE_PACKAGES : _("Removed packages"), |
249 | 133 | ROLE_UPGRADE_PACKAGES : _("Updated packages"), | 137 | ROLE_UPGRADE_PACKAGES : _("Updated packages"), |
250 | 134 | ROLE_UPGRADE_SYSTEM : _("Upgraded system"), | 138 | ROLE_UPGRADE_SYSTEM : _("Upgraded system"), |
251 | @@ -157,8 +161,9 @@ | |||
252 | 157 | PRESENT_ROLE = { | 161 | PRESENT_ROLE = { |
253 | 158 | ROLE_INSTALL_FILE : _("Installing file"), | 162 | ROLE_INSTALL_FILE : _("Installing file"), |
254 | 159 | ROLE_INSTALL_PACKAGES : _("Installing packages"), | 163 | ROLE_INSTALL_PACKAGES : _("Installing packages"), |
256 | 160 | ROLE_INSTALL_SIGNATURE: _("Installing signature"), | 164 | ROLE_INSTALL_KEY_FILE : _("Installing key"), |
257 | 161 | ROLE_UPDATE_CACHE : _("Updating cache"), | 165 | ROLE_UPDATE_CACHE : _("Updating cache"), |
258 | 166 | ROLE_REMOVE_KEY : _("Removing key"), | ||
259 | 162 | ROLE_REMOVE_PACKAGES : _("Removing packages"), | 167 | ROLE_REMOVE_PACKAGES : _("Removing packages"), |
260 | 163 | ROLE_UPGRADE_PACKAGES : _("Updating packages"), | 168 | ROLE_UPGRADE_PACKAGES : _("Updating packages"), |
261 | 164 | ROLE_UPGRADE_SYSTEM : _("Upgrading system"), | 169 | ROLE_UPGRADE_SYSTEM : _("Upgrading system"), |
262 | @@ -180,6 +185,10 @@ | |||
263 | 180 | "they are a common source of problems.\n" | 185 | "they are a common source of problems.\n" |
264 | 181 | "Furthermore run the following command in a " | 186 | "Furthermore run the following command in a " |
265 | 182 | "Terminal: apt-get install -f"), | 187 | "Terminal: apt-get install -f"), |
266 | 188 | ERROR_KEY_NOT_INSTALLED : _("The selected file may not be a GPG key file " | ||
267 | 189 | "or it might be corrupt."), | ||
268 | 190 | ERROR_KEY_NOT_REMOVED : _("The selected key couldn't be removed " | ||
269 | 191 | "Check if you provided a valid fingerprint."), | ||
270 | 183 | ERROR_NO_LOCK : _("Check if you are currently running another " | 192 | ERROR_NO_LOCK : _("Check if you are currently running another " |
271 | 184 | "software management tool, e.g. Synaptic or aptitude. " | 193 | "software management tool, e.g. Synaptic or aptitude. " |
272 | 185 | "Only one tool is allowed to make changes at the " | 194 | "Only one tool is allowed to make changes at the " |
273 | @@ -211,6 +220,8 @@ | |||
274 | 211 | ERROR_PACKAGE_DOWNLOAD_FAILED : _("Failed to download package files"), | 220 | ERROR_PACKAGE_DOWNLOAD_FAILED : _("Failed to download package files"), |
275 | 212 | ERROR_REPO_DOWNLOAD_FAILED : _("Failed to download repository information"), | 221 | ERROR_REPO_DOWNLOAD_FAILED : _("Failed to download repository information"), |
276 | 213 | ERROR_DEPENDENCIES_BROKEN : _("Package dependencies are broken"), | 222 | ERROR_DEPENDENCIES_BROKEN : _("Package dependencies are broken"), |
277 | 223 | ERROR_KEY_NOT_INSTALLED : _("Key was not installed"), | ||
278 | 224 | ERROR_KEY_NOT_INSTALLED : _("Key was not removed"), | ||
279 | 214 | ERROR_NO_LOCK : _("Failed to lock the package manager"), | 225 | ERROR_NO_LOCK : _("Failed to lock the package manager"), |
280 | 215 | ERROR_NO_CACHE : _("Failed to load the package list"), | 226 | ERROR_NO_CACHE : _("Failed to load the package list"), |
281 | 216 | ERROR_NO_PACKAGE : _("Package does not exist"), | 227 | ERROR_NO_PACKAGE : _("Package does not exist"), |
282 | 217 | 228 | ||
283 | === modified file 'aptdaemon/policykit.py' | |||
284 | --- aptdaemon/policykit.py 2009-07-02 10:43:47 +0000 | |||
285 | +++ aptdaemon/policykit.py 2009-07-09 17:00:21 +0000 | |||
286 | @@ -24,8 +24,11 @@ | |||
287 | 24 | import dbus | 24 | import dbus |
288 | 25 | 25 | ||
289 | 26 | PK_ACTION_REMOVE_PACKAGES = "org.debian.apt.remove-packages" | 26 | PK_ACTION_REMOVE_PACKAGES = "org.debian.apt.remove-packages" |
290 | 27 | PK_ACTION_REMOVE_KEY = "org.debian.apt.remove-key" | ||
291 | 27 | PK_ACTION_INSTALL_PACKAGES = "org.debian.apt.install-packages" | 28 | PK_ACTION_INSTALL_PACKAGES = "org.debian.apt.install-packages" |
292 | 29 | PK_ACTION_INSTALL_KEY_FILE = "org.debian.apt.install-key-file" | ||
293 | 28 | PK_ACTION_INSTALL_FILE = "org.debian.apt.install-file" | 30 | PK_ACTION_INSTALL_FILE = "org.debian.apt.install-file" |
294 | 31 | PK_ACTION_GET_TRUSTED_KEYS = "org.debian.apt.get-trusted-keys" | ||
295 | 29 | PK_ACTION_UPGRADE_PACKAGES = "org.debian.apt.upgrade-packages" | 32 | PK_ACTION_UPGRADE_PACKAGES = "org.debian.apt.upgrade-packages" |
296 | 30 | PK_ACTION_UPDATE_CACHE = "org.debian.apt.update-cache" | 33 | PK_ACTION_UPDATE_CACHE = "org.debian.apt.update-cache" |
297 | 31 | PK_ACTION_UPGRADE_SYSTEM = "org.debian.apt.upgrade-system" | 34 | PK_ACTION_UPGRADE_SYSTEM = "org.debian.apt.upgrade-system" |
298 | 32 | 35 | ||
299 | === modified file 'aptdaemon/worker.py' | |||
300 | --- aptdaemon/worker.py 2009-07-07 14:03:32 +0000 | |||
301 | +++ aptdaemon/worker.py 2009-07-09 17:00:21 +0000 | |||
302 | @@ -39,6 +39,8 @@ | |||
303 | 39 | DaemonDpkgInstallProgress, \ | 39 | DaemonDpkgInstallProgress, \ |
304 | 40 | DaemonDpkgRecoverProgress | 40 | DaemonDpkgRecoverProgress |
305 | 41 | 41 | ||
306 | 42 | from softwareproperties.SoftwareProperties import SoftwareProperties | ||
307 | 43 | from softwareproperties.AptAuth import AptAuth | ||
308 | 42 | log = logging.getLogger("AptDamon.Worker") | 44 | log = logging.getLogger("AptDamon.Worker") |
309 | 43 | 45 | ||
310 | 44 | class AptWorker(gobject.GObject): | 46 | class AptWorker(gobject.GObject): |
311 | @@ -100,6 +102,10 @@ | |||
312 | 100 | self.upgrade_packages(**self.trans.kwargs) | 102 | self.upgrade_packages(**self.trans.kwargs) |
313 | 101 | elif self.trans.role == ROLE_COMMIT_PACKAGES: | 103 | elif self.trans.role == ROLE_COMMIT_PACKAGES: |
314 | 102 | self.commit_packages(**self.trans.kwargs) | 104 | self.commit_packages(**self.trans.kwargs) |
315 | 105 | elif self.trans.role == ROLE_INSTALL_KEY_FILE: | ||
316 | 106 | self.install_key_file(**self.trans.kwargs) | ||
317 | 107 | elif self.trans.role == ROLE_REMOVE_KEY: | ||
318 | 108 | self.remove_key(**self.trans.kwargs) | ||
319 | 103 | except TransactionFailed, excep: | 109 | except TransactionFailed, excep: |
320 | 104 | self.trans.error = excep | 110 | self.trans.error = excep |
321 | 105 | self.trans.exit = EXIT_FAILED | 111 | self.trans.exit = EXIT_FAILED |
322 | @@ -172,6 +178,31 @@ | |||
323 | 172 | pkg_name) | 178 | pkg_name) |
324 | 173 | pkg.markInstall() | 179 | pkg.markInstall() |
325 | 174 | 180 | ||
326 | 181 | def install_key_file(self, path): | ||
327 | 182 | """Install repository key file. | ||
328 | 183 | |||
329 | 184 | Keyword argument: | ||
330 | 185 | path -- absolute path to the key file | ||
331 | 186 | """ | ||
332 | 187 | softwareproperties = SoftwareProperties() | ||
333 | 188 | if not softwareproperties.add_key(os.path.expanduser(path)): | ||
334 | 189 | raise TransactionFailed(ERROR_KEY_NOT_INSTALLED, | ||
335 | 190 | "Key file %s couldn't be installed" % \ | ||
336 | 191 | path) | ||
337 | 192 | |||
338 | 193 | def remove_key(self, fingerprint): | ||
339 | 194 | """Remove repository key. | ||
340 | 195 | |||
341 | 196 | Keyword argument: | ||
342 | 197 | fingerprint -- fingerprint of the key to remove | ||
343 | 198 | """ | ||
344 | 199 | softwareproperties = SoftwareProperties() | ||
345 | 200 | if not softwareproperties.remove_key(fingerprint): | ||
346 | 201 | raise TransactionFailed(ERROR_KEY_NOT_REMOVED, | ||
347 | 202 | "Key with fingerprint %s couldn't be removed" % \ | ||
348 | 203 | fingerprint) | ||
349 | 204 | |||
350 | 205 | |||
351 | 175 | def install_file(self, path): | 206 | def install_file(self, path): |
352 | 176 | """Install local package file. | 207 | """Install local package file. |
353 | 177 | 208 | ||
354 | 178 | 209 | ||
355 | === modified file 'data/org.debian.apt.policy.in' | |||
356 | --- data/org.debian.apt.policy.in 2009-07-02 10:43:47 +0000 | |||
357 | +++ data/org.debian.apt.policy.in 2009-07-09 17:00:21 +0000 | |||
358 | @@ -17,6 +17,39 @@ | |||
359 | 17 | </defaults> | 17 | </defaults> |
360 | 18 | </action> | 18 | </action> |
361 | 19 | 19 | ||
362 | 20 | <action id="org.debian.apt.install-key-file"> | ||
363 | 21 | <description>Install repository key file</description> | ||
364 | 22 | <message> | ||
365 | 23 | Authentication is required to install a repository key. | ||
366 | 24 | </message> | ||
367 | 25 | <defaults> | ||
368 | 26 | <allow_inactive>no</allow_inactive> | ||
369 | 27 | <allow_active>auth_admin_keep_always</allow_active> | ||
370 | 28 | </defaults> | ||
371 | 29 | </action> | ||
372 | 30 | |||
373 | 31 | <action id="org.debian.apt.remove-key"> | ||
374 | 32 | <description>Remove a repository key</description> | ||
375 | 33 | <message> | ||
376 | 34 | Authentication is required to remove repository key. | ||
377 | 35 | </message> | ||
378 | 36 | <defaults> | ||
379 | 37 | <allow_inactive>no</allow_inactive> | ||
380 | 38 | <allow_active>auth_admin_keep_always</allow_active> | ||
381 | 39 | </defaults> | ||
382 | 40 | </action> | ||
383 | 41 | |||
384 | 42 | <action id="org.debian.apt.get-trusted-keys"> | ||
385 | 43 | <description>View trusted keys</description> | ||
386 | 44 | <message> | ||
387 | 45 | Authentication is required to view trusted keys. | ||
388 | 46 | </message> | ||
389 | 47 | <defaults> | ||
390 | 48 | <allow_inactive>no</allow_inactive> | ||
391 | 49 | <allow_active>auth_admin_keep_always</allow_active> | ||
392 | 50 | </defaults> | ||
393 | 51 | </action> | ||
394 | 52 | |||
395 | 20 | <action id="org.debian.apt.install-file"> | 53 | <action id="org.debian.apt.install-file"> |
396 | 21 | <_description>Install package file</_description> | 54 | <_description>Install package file</_description> |
397 | 22 | <_message> | 55 | <_message> |
Added methods
InstallKeyFile -- Installs a repository key from a given file
GetTrustedKeys -- Returns a list of repository keys
RemoveKey -- Remove a key with the specified fingerprint