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

Proposed by Michał Sawicz
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 Needs Fixing
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.
Revision history for this message
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)
Revision history for this message
Michał Sawicz (saviq) wrote :

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

Unmerged revisions

1616. By Michał Sawicz

Add 'freeze_plugins' option to prevent updates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'elisa-core/elisa/core/plugin_registry.py'
--- elisa-core/elisa/core/plugin_registry.py 2009-11-09 15:44:51 +0000
+++ elisa-core/elisa/core/plugin_registry.py 2010-05-14 16:30:48 +0000
@@ -170,7 +170,8 @@
170 {'repository': 'http://plugins.moovida.com/plugin_list',170 {'repository': 'http://plugins.moovida.com/plugin_list',
171 'update_plugin_cache': True,171 'update_plugin_cache': True,
172 'auto_update_plugins': True,172 'auto_update_plugins': True,
173 'auto_install_new_recommended_plugins': True}173 'auto_install_new_recommended_plugins': True,
174 'freeze_plugins': []}
174 config_doc = \175 config_doc = \
175 {'repository': 'The plugin repository to query for new plugins and ' \176 {'repository': 'The plugin repository to query for new plugins and ' \
176 'plugin updates.',177 'plugin updates.',
@@ -182,7 +183,9 @@
182 'plugin updates. Ignored if update_plugin_cache is False.',183 'plugin updates. Ignored if update_plugin_cache is False.',
183 'auto_install_new_recommended_plugins': 'Whether to silently ' \184 'auto_install_new_recommended_plugins': 'Whether to silently ' \
184 'install all new recommended plugins available. Ignored if ' \185 'install all new recommended plugins available. Ignored if ' \
185 'update_plugin_cache is False.'}186 'update_plugin_cache is False.',
187 'freeze_plugins': 'Plugins from this list won\'t be updated ' \
188 'automatically even if \'auto_update_plugins\' is True'}
186189
187 def __init__(self, config=None, plugin_dirs=None):190 def __init__(self, config=None, plugin_dirs=None):
188 super(PluginRegistry, self).__init__()191 super(PluginRegistry, self).__init__()
189192
=== modified file 'elisa-plugins/elisa/plugins/poblesec/main.py'
--- elisa-plugins/elisa/plugins/poblesec/main.py 2010-01-14 15:32:18 +0000
+++ elisa-plugins/elisa/plugins/poblesec/main.py 2010-05-14 16:30:48 +0000
@@ -471,7 +471,7 @@
471 # Plugin updates and/or new recommended plugins are available for471 # Plugin updates and/or new recommended plugins are available for
472 # download from the plugin repository.472 # download from the plugin repository.
473473
474 def iterate_plugins(available_updates, new_recommended, updated):474 def iterate_plugins(available_updates, new_recommended, updated, frozen):
475 plugin_registry = common.application.plugin_registry475 plugin_registry = common.application.plugin_registry
476476
477 def _plugin_updated(result, plugin_dict):477 def _plugin_updated(result, plugin_dict):
@@ -487,6 +487,10 @@
487 return None487 return None
488488
489 for plugin_dict in available_updates:489 for plugin_dict in available_updates:
490 if plugin_dict['name'] in frozen:
491 self.debug('Omitted update of %s because it\'s frozen.' % \
492 plugin_dict['name'])
493 continue
490 dfr = plugin_registry.update_plugin(plugin_dict)494 dfr = plugin_registry.update_plugin(plugin_dict)
491 dfr.addCallback(_plugin_updated, plugin_dict)495 dfr.addCallback(_plugin_updated, plugin_dict)
492 dfr.addErrback(_update_failed, plugin_dict)496 dfr.addErrback(_update_failed, plugin_dict)
@@ -516,16 +520,16 @@
516 dfr.addCallback(_plugin_installed, plugin_dict)520 dfr.addCallback(_plugin_installed, plugin_dict)
517 yield dfr521 yield dfr
518522
519 def process_plugins(result, updates, new, updated):523 def process_plugins(result, updates, new, updated, frozen):
520 return task.coiterate(iterate_plugins(updates, new, updated))524 return task.coiterate(iterate_plugins(updates, new, updated, frozen))
521525
522 def do_process_plugins(updates, new):526 def do_process_plugins(updates, new, frozen):
523 if self._popup_visible:527 if self._popup_visible:
524 dfr = self.hide_popup()528 dfr = self.hide_popup()
525 else:529 else:
526 dfr = defer.succeed(None)530 dfr = defer.succeed(None)
527 updated = []531 updated = []
528 dfr.addCallback(process_plugins, updates, new, updated)532 dfr.addCallback(process_plugins, updates, new, updated, frozen)
529 dfr.addCallback(self.show_restart_popup, updated)533 dfr.addCallback(self.show_restart_popup, updated)
530 return dfr534 return dfr
531535
@@ -535,11 +539,14 @@
535 silent_install = \539 silent_install = \
536 config.get_option('auto_install_new_recommended_plugins',540 config.get_option('auto_install_new_recommended_plugins',
537 section='plugin_registry')541 section='plugin_registry')
542 freeze_plugins = \
543 config.get_option('freeze_plugins', section='plugin_registry')
538544
539 if silent_update and silent_install:545 if silent_update and silent_install:
540 # Do not ask the user's confirmation546 # Do not ask the user's confirmation
541 return do_process_plugins(message.available_updates,547 return do_process_plugins(message.available_updates,
542 message.new_recommended)548 message.new_recommended,
549 freeze_plugins)
543550
544 elif silent_update:551 elif silent_update:
545 if len(message.new_recommended) == 0:552 if len(message.new_recommended) == 0:

Subscribers

People subscribed via source and target branches