commit/galaxy-central: greg: Eliminate the recently introduced restriction on uninstalling repositories that are dependencies of other installed items, but keep the beneficial feature that displays dependent items that will be affected if a repository is uninstalled.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ecdf7d468014/ Changeset: ecdf7d468014 User: greg Date: 2014-01-20 22:07:08 Summary: Eliminate the recently introduced restriction on uninstalling repositories that are dependencies of other installed items, but keep the beneficial feature that displays dependent items that will be affected if a repository is uninstalled. Affected #: 4 files diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e lib/galaxy/model/tool_shed_install/__init__.py --- a/lib/galaxy/model/tool_shed_install/__init__.py +++ b/lib/galaxy/model/tool_shed_install/__init__.py @@ -61,53 +61,9 @@ def can_reset_metadata( self ): return self.status == self.installation_status.INSTALLED - def can_uninstall( self, app ): - # An installed repository cannot be uninstalled if other installed repositories or installed repository - # contents (i.e., tool dependencies) require it. - if self.status == self.installation_status.UNINSTALLED: - return False - this_repository_tup = ( str( self.tool_shed ), - str( self.name ), - str( self.owner ), - str( self.installed_changeset_revision ) ) - irm = app.installed_repository_manager - # See if this repository's current dependencies are restricted to a single circular relationship. This - # means that this repository has a single repository dependency which itself depends upon this repository. - # The repository dependency may have other repository dependencies, but that is not relevant here. - single_repository_dependency_tup = None - installed_repository_dependency_tups = \ - irm.installed_repository_dependencies_of_installed_repositories.get( this_repository_tup, [] ) - # If this repository defines a circular relationship to another repository, then the list of tuples - # defining installed repository dependencies will include itself. - if len( installed_repository_dependency_tups ) == 2: - if this_repository_tup in installed_repository_dependency_tups: - # We have a single circular dependency definition, so get the other repository. - for installed_repository_dependency_tup in installed_repository_dependency_tups: - if installed_repository_dependency_tup != this_repository_tup: - single_repository_dependency_tup = installed_repository_dependency_tup - break - if single_repository_dependency_tup is not None: - installed_repository_dependency_tups = \ - irm.installed_repository_dependencies_of_installed_repositories.get( this_repository_tup, [] ) - if this_repository_tup in installed_repository_dependency_tups: - # This repository is a dependency of the single repository upon which it depends, so we have - # a single circular relationship and this repository can be uninstalled. - return True - # Find other installed repositories that require this repository. - installed_dependent_repositories = \ - irm.installed_dependent_repositories_of_installed_repositories.get( this_repository_tup, [] ) - if installed_dependent_repositories: - # This repository cannot be uninstalled because other installed repositories require it. - return False - # Find installed tool dependencies that require this repository's installed tool dependencies. - installed_tool_dependencies = irm.installed_tool_dependencies_of_installed_repositories.get( this_repository_tup, [] ) - for td_tup in installed_tool_dependencies: - installed_dependent_td_tups = irm.installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies.get( td_tup, [] ) - if installed_dependent_td_tups: - # This repository cannot be uninstalled because it contains installed tool dependencies that - # are required at run time by other installed tool dependencies. - return False - return True + @property + def can_uninstall( self ): + return self.status != self.installation_status.UNINSTALLED @property def can_deactivate( self ): @@ -564,9 +520,7 @@ @property def can_uninstall( self ): - # A tool dependency can be uninstalled only if it is currently in an error state. Only the containing - # repository can be uninstalled if a tool dependency is properly installed. - return self.status in [ self.installation_status.ERROR ] + return self.status in [ self.installation_status.ERROR, self.installation_status.INSTALLED ] @property def can_update( self ): diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py --- a/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py +++ b/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py @@ -31,13 +31,6 @@ latest_revision_tip_str = '' return '<img src="%s/june_2007_style/blue/ok_small.png" %s/>' % ( url_for( '/static' ), latest_revision_tip_str ) -def generate_repository_can_be_uninstalled_img_str( include_mouse_over=False ): - if include_mouse_over: - can_be_uninstalled_tip_str = 'class="icon-button" title="This repository can be uninstalled"' - else: - can_be_uninstalled_tip_str = '' - return '<img src="%s/images/fugue/toggle-bw.png" %s/>' % ( url_for( '/static' ), can_be_uninstalled_tip_str ) - def generate_revision_updates_img_str( include_mouse_over=False ): if include_mouse_over: revision_updates_tip_str = 'class="icon-button" title="Updates are available in the Tool Shed for this revision"' @@ -80,8 +73,6 @@ tool_shed_status_str += generate_includes_workflows_img_str( include_mouse_over=True ) else: tool_shed_status_str = generate_unknown_img_str( include_mouse_over=True ) - if tool_shed_repository.can_uninstall( trans.app ): - tool_shed_status_str += generate_repository_can_be_uninstalled_img_str( include_mouse_over=True ) return tool_shed_status_str @@ -245,7 +236,6 @@ legend_str += '%s This repository is deprecated in the Tool Shed<br/>' % generate_deprecated_repository_img_str() legend_str += '%s This repository contains exported workflows<br/>' % generate_includes_workflows_img_str() legend_str += '%s Unable to get information from the Tool Shed<br/>' % generate_unknown_img_str() - legend_str += '%s This repository can be uninstalled<br/>' % generate_repository_can_be_uninstalled_img_str() return legend_str diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako --- a/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako +++ b/templates/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako @@ -38,21 +38,76 @@ <div class="form-row"><% can_deactivate_repository = repository.can_deactivate - can_uninstall_repository = repository.can_uninstall( trans.app ) + can_uninstall_repository = repository.can_uninstall %> - %if can_deactivate_repository and can_uninstall_repository: - <% deactivate_uninstall_button_text = "Deactivate or Uninstall" %> - ${remove_from_disk_check_box.get_html()} - <label for="repository" style="display: inline;font-weight:normal;">Check to uninstall or leave blank to deactivate</label> - <br/><br/> - %elif can_deactivate_repository: - <% deactivate_uninstall_button_text = "Deactivate" %> - %else: - <% deactivate_uninstall_button_text = "Uninstall" %> - ##hack to mimic check box - <input type="hidden" name="remove_from_disk" value="true"/><input type="hidden" name="remove_from_disk" value="true"/> + %if can_deactivate_repository: + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td bgcolor="#D8D8D8"> + <label>Deactivating this repository will result in the following:</label> + </td> + </tr> + </table> + <div class="toolParamHelp" style="clear: both;"> + * The repository and all of it's contents will remain on disk and can still be used by dependent items. + </div> + %if repository.includes_tools_for_display_in_tool_panel: + <div class="toolParamHelp" style="clear: both;"> + * The repository's tools will not be loaded into the tool panel. + </div> + %endif + %if repository.includes_tool_dependencies: + <div class="toolParamHelp" style="clear: both;"> + * The repository's installed tool dependencies will remain on disk. + </div> + %endif + %if repository.includes_datatypes: + <div class="toolParamHelp" style="clear: both;"> + * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry. + </div> + %endif + <div class="toolParamHelp" style="clear: both;"> + * The repository record's deleted column in the tool_shed_repository database table will be set to True. + </div> + <br/> %endif - %if not can_uninstall_repository: + %if can_uninstall_repository: + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td bgcolor="#D8D8D8"> + <label>Uninstalling this repository will result in the following:</label> + </td> + </tr> + </table> + <div class="toolParamHelp" style="clear: both;"> + * The repository and all of it's contents will be removed from disk and can no longer be used by dependent items. + </div> + %if repository.includes_tools_for_display_in_tool_panel: + <div class="toolParamHelp" style="clear: both;"> + * The repository's tool tag sets will be removed from the tool config file in which they are defined. + </div> + %endif + %if repository.includes_tool_dependencies: + <div class="toolParamHelp" style="clear: both;"> + * The repository's installed tool dependencies will be removed from disk and can no longer be used by dependent items. + </div> + <div class="toolParamHelp" style="clear: both;"> + * Each associated tool dependency record's status column in the tool_dependency database table will be set to 'Uninstalled'. + </div> + %endif + %if repository.includes_datatypes: + <div class="toolParamHelp" style="clear: both;"> + * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry. + </div> + %endif + <div class="toolParamHelp" style="clear: both;"> + * The repository record's deleted column in the tool_shed_repository database table will be set to True. + </div> + <div class="toolParamHelp" style="clear: both;"> + * The repository record's uninstalled column in the tool_shed_repository database table will be set to True. + </div> + <div style="clear: both"></div> + <br/><% from tool_shed.util.repository_dependency_util import get_repository_tuple_for_installed_repository_manager from tool_shed.util.tool_dependency_util import get_tool_dependency_tuple_for_installed_repository_manager @@ -80,7 +135,7 @@ <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#D8D8D8"> - <label>This repository cannot be uninstalled because it is required by the following installed items:</label> + <label>Uninstalling this repository will affect the following dependent items:</label></td></tr></table> @@ -116,77 +171,24 @@ <br/> %endif %endif - %if can_deactivate_repository: - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td bgcolor="#D8D8D8"> - <label>Deactivating this repository will result in the following:</label> - </td> - </tr> - </table> - <div class="toolParamHelp" style="clear: both;"> - * The repository and all of it's contents will remain on disk. - </div> - %if repository.includes_tools_for_display_in_tool_panel: - <div class="toolParamHelp" style="clear: both;"> - * The repository's tools will not be loaded into the tool panel. - </div> - %endif - %if repository.includes_tool_dependencies: - <div class="toolParamHelp" style="clear: both;"> - * The repository's installed tool dependencies will remain on disk. - </div> - %endif - %if repository.includes_datatypes: - <div class="toolParamHelp" style="clear: both;"> - * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry. - </div> - %endif - <div class="toolParamHelp" style="clear: both;"> - * The repository record's deleted column in the tool_shed_repository database table will be set to True. - </div> - <br/> - %endif - %if can_uninstall_repository: - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td bgcolor="#D8D8D8"> - <label>Uninstalling this repository will result in the following:</label> - </td> - </tr> - </table> - <div class="toolParamHelp" style="clear: both;"> - * The repository and all of it's contents will be removed from disk. - </div> - %if repository.includes_tools_for_display_in_tool_panel: - <div class="toolParamHelp" style="clear: both;"> - * The repository's tool tag sets will be removed from the tool config file in which they are defined. - </div> - %endif - %if repository.includes_tool_dependencies: - <div class="toolParamHelp" style="clear: both;"> - * The repository's installed tool dependencies will be removed from disk. - </div> - <div class="toolParamHelp" style="clear: both;"> - * Each associated tool dependency record's status column in the tool_dependency database table will be set to 'Uninstalled'. - </div> - %endif - %if repository.includes_datatypes: - <div class="toolParamHelp" style="clear: both;"> - * The repository's datatypes, datatype converters and display applications will be eliminated from the datatypes registry. - </div> - %endif - <div class="toolParamHelp" style="clear: both;"> - * The repository record's deleted column in the tool_shed_repository database table will be set to True. - </div> - <div class="toolParamHelp" style="clear: both;"> - * The repository record's uninstalled column in the tool_shed_repository database table will be set to True. - </div> - <div style="clear: both"></div> - <br/> - %endif </div><div class="form-row"> + <% + can_deactivate_repository = repository.can_deactivate + can_uninstall_repository = repository.can_uninstall + %> + %if can_deactivate_repository and can_uninstall_repository: + <% deactivate_uninstall_button_text = "Deactivate or Uninstall" %> + ${remove_from_disk_check_box.get_html()} + <label for="repository" style="display: inline;font-weight:normal;">Check to uninstall or leave blank to deactivate</label> + <br/><br/> + %elif can_deactivate_repository: + <% deactivate_uninstall_button_text = "Deactivate" %> + %else: + <% deactivate_uninstall_button_text = "Uninstall" %> + ##hack to mimic check box + <input type="hidden" name="remove_from_disk" value="true"/><input type="hidden" name="remove_from_disk" value="true"/> + %endif <input type="submit" name="deactivate_or_uninstall_repository_button" value="${deactivate_uninstall_button_text}"/></div></form> diff -r cef51275f59d72529d17769cfac6af572aeea679 -r ecdf7d468014e38739a054ef4d01b194a6ea681e test/tool_shed/functional/test_1430_repair_installed_repository.py --- a/test/tool_shed/functional/test_1430_repair_installed_repository.py +++ b/test/tool_shed/functional/test_1430_repair_installed_repository.py @@ -144,11 +144,11 @@ This is step 2 - Uninstall the filter_1430 repository. ''' installed_repository = self.test_db_util.get_installed_repository_by_name_owner( 'filter_1430', common.test_user_1_name ) - strings_displayed = [ 'This repository cannot be uninstalled' ] - strings_not_displayed = [ 'Check to uninstall' ] - self.deactivate_repository( installed_repository, - strings_displayed=strings_displayed, - strings_not_displayed=strings_not_displayed ) + strings_displayed = [ 'Uninstalling this repository will affect the following dependent items' ] + strings_not_displayed = [] + self.uninstall_repository( installed_repository, + strings_displayed=strings_displayed, + strings_not_displayed=strings_not_displayed ) strings_not_displayed = [ 'filter_1430', "Galaxy's filter tool for test 1430", installed_repository.installed_changeset_revision ] Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org