Merge lp:~saviq/elisa/freeze_plugins into lp:elisa

Proposed by Michał Sawicz on 2010-05-14
Status: Needs review
Proposed branch: lp:~saviq/elisa/freeze_plugins
Merge into: lp:elisa
Diff against target: 85 lines (+18/-8)
2 files modified
elisa-core/elisa/core/plugin_registry.py (+5/-2)
elisa-plugins/elisa/plugins/poblesec/main.py (+13/-6)
To merge this branch: bzr merge lp:~saviq/elisa/freeze_plugins
Reviewer Review Type Date Requested Status
Olivier Tilloy functional 2010-05-14 Needs Fixing on 2010-05-21
Review via email: mp+25342@code.launchpad.net

Description of the change

Allow freezing a list of plugins that should not be updated automatically. This is needed e.g. for Debian so that the packaging system takes over by default.

To post a comment you must log in.
Olivier Tilloy (osomon) wrote :

You added an extra parameter to the do_process_plugins function, but you forgot to adapt 7 other places in the code where it is called.

If in my configuration I set "auto_update_plugins" to "False", I will then get a popup upon availability of updates, and clicking "Update All" will fail with the following traceback:

Traceback (most recent call last):
  File "/home/osomon/dev/elisa-branches/moovida/elisa-plugins/elisa/plugins/poblesec/modal_popup.py", line 148, in _clicked_cb
    button.callback()
  File "/home/osomon/dev/elisa-branches/moovida/elisa-plugins/elisa/plugins/poblesec/main.py", line 592, in <lambda>
    message.new_recommended)),
TypeError: do_process_plugins() takes exactly 3 arguments (2 given)

review: Needs Fixing (functional)
Michał Sawicz (saviq) wrote :

Sorry about that... Will get back to it and hopefully get this fixed.

Unmerged revisions

1616. By Michał Sawicz on 2010-02-10

Add 'freeze_plugins' option to prevent updates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'elisa-core/elisa/core/plugin_registry.py'
2--- elisa-core/elisa/core/plugin_registry.py 2009-11-09 15:44:51 +0000
3+++ elisa-core/elisa/core/plugin_registry.py 2010-05-14 16:30:48 +0000
4@@ -170,7 +170,8 @@
5 {'repository': 'http://plugins.moovida.com/plugin_list',
6 'update_plugin_cache': True,
7 'auto_update_plugins': True,
8- 'auto_install_new_recommended_plugins': True}
9+ 'auto_install_new_recommended_plugins': True,
10+ 'freeze_plugins': []}
11 config_doc = \
12 {'repository': 'The plugin repository to query for new plugins and ' \
13 'plugin updates.',
14@@ -182,7 +183,9 @@
15 'plugin updates. Ignored if update_plugin_cache is False.',
16 'auto_install_new_recommended_plugins': 'Whether to silently ' \
17 'install all new recommended plugins available. Ignored if ' \
18- 'update_plugin_cache is False.'}
19+ 'update_plugin_cache is False.',
20+ 'freeze_plugins': 'Plugins from this list won\'t be updated ' \
21+ 'automatically even if \'auto_update_plugins\' is True'}
22
23 def __init__(self, config=None, plugin_dirs=None):
24 super(PluginRegistry, self).__init__()
25
26=== modified file 'elisa-plugins/elisa/plugins/poblesec/main.py'
27--- elisa-plugins/elisa/plugins/poblesec/main.py 2010-01-14 15:32:18 +0000
28+++ elisa-plugins/elisa/plugins/poblesec/main.py 2010-05-14 16:30:48 +0000
29@@ -471,7 +471,7 @@
30 # Plugin updates and/or new recommended plugins are available for
31 # download from the plugin repository.
32
33- def iterate_plugins(available_updates, new_recommended, updated):
34+ def iterate_plugins(available_updates, new_recommended, updated, frozen):
35 plugin_registry = common.application.plugin_registry
36
37 def _plugin_updated(result, plugin_dict):
38@@ -487,6 +487,10 @@
39 return None
40
41 for plugin_dict in available_updates:
42+ if plugin_dict['name'] in frozen:
43+ self.debug('Omitted update of %s because it\'s frozen.' % \
44+ plugin_dict['name'])
45+ continue
46 dfr = plugin_registry.update_plugin(plugin_dict)
47 dfr.addCallback(_plugin_updated, plugin_dict)
48 dfr.addErrback(_update_failed, plugin_dict)
49@@ -516,16 +520,16 @@
50 dfr.addCallback(_plugin_installed, plugin_dict)
51 yield dfr
52
53- def process_plugins(result, updates, new, updated):
54- return task.coiterate(iterate_plugins(updates, new, updated))
55+ def process_plugins(result, updates, new, updated, frozen):
56+ return task.coiterate(iterate_plugins(updates, new, updated, frozen))
57
58- def do_process_plugins(updates, new):
59+ def do_process_plugins(updates, new, frozen):
60 if self._popup_visible:
61 dfr = self.hide_popup()
62 else:
63 dfr = defer.succeed(None)
64 updated = []
65- dfr.addCallback(process_plugins, updates, new, updated)
66+ dfr.addCallback(process_plugins, updates, new, updated, frozen)
67 dfr.addCallback(self.show_restart_popup, updated)
68 return dfr
69
70@@ -535,11 +539,14 @@
71 silent_install = \
72 config.get_option('auto_install_new_recommended_plugins',
73 section='plugin_registry')
74+ freeze_plugins = \
75+ config.get_option('freeze_plugins', section='plugin_registry')
76
77 if silent_update and silent_install:
78 # Do not ask the user's confirmation
79 return do_process_plugins(message.available_updates,
80- message.new_recommended)
81+ message.new_recommended,
82+ freeze_plugins)
83
84 elif silent_update:
85 if len(message.new_recommended) == 0:

Subscribers

People subscribed via source and target branches