commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/4c1879921d9a/ Changeset: 4c1879921d9a Branch: next-stable User: greg Date: 2013-10-31 17:00:28 Summary: Fix for repairing a repository that has no repository dependencies. Affected #: 1 file diff -r 23d65abf66067c09929a269bd3da4a92ae727918 -r 4c1879921d9a0454879e84b3d3c064bad10c008b lib/tool_shed/galaxy_install/repository_util.py --- a/lib/tool_shed/galaxy_install/repository_util.py +++ b/lib/tool_shed/galaxy_install/repository_util.py @@ -140,63 +140,27 @@ each repository's tool dependencies. This method is called only from Galaxy when attempting to correct issues with an installed repository that has installation problems somewhere in it's dependency hierarchy. """ + tsr_ids = [] + repo_info_dicts = [] + tool_panel_section_keys = [] repair_dict = {} # Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend. repository_dependencies_dict = repository_dependency_util.get_repository_dependencies_for_installed_tool_shed_repository( trans, repository ) - # Generate the list of installed repositories from the information contained in the repository_dependencies dictionary. - installed_repositories = get_installed_repositories_from_repository_dependencies( trans, repository_dependencies_dict ) - # Some repositories may have repository dependencies that are required to be installed before the dependent repository, so we'll order the list of - # tsr_ids to ensure all repositories are repaired in the required order. - tsr_ids = [] - repo_info_dicts = [] - tool_panel_section_keys = [] - for installed_repository in installed_repositories: - tsr_ids.append( trans.security.encode_id( installed_repository.id ) ) - repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, installed_repository ) - repository_dependencies = repository_dependency_util.get_repository_dependencies_for_installed_tool_shed_repository( trans, installed_repository ) - metadata = installed_repository.metadata - if metadata: - tool_dependencies = metadata.get( 'tool_dependencies', None ) - tool_panel_section_dict = metadata.get( 'tool_panel_section', None ) - if tool_panel_section_dict: - # The installed_repository must be in the uninstalled state. The structure of tool_panel_section_dict is: - # {<tool guid> : [{ 'id':<section id>, 'name':<section name>, 'version':<section version>, 'tool_config':<tool config file name> }]} - # Here is an example: - # {"localhost:9009/repos/test/filter/Filter1/1.1.0": - # [{"id": "filter_and_sort", "name": "Filter and Sort", "tool_config": "filtering.xml", "version": ""}]} - # Currently all tools contained within an installed tool shed repository must be loaded into the same section in the tool panel, so we can - # get the section id of the first guid in the tool_panel_section_dict. In the future, we'll have to handle different sections per guid. - guid = tool_panel_section_dict.keys()[ 0 ] - section_dicts = tool_panel_section_dict[ guid ] - section_dict = section_dicts[ 0 ] - tool_panel_section_id = section_dict[ 'id' ] - tool_panel_section_name = section_dict[ 'name' ] - if tool_panel_section_id: - tool_panel_section_key, tool_panel_section = tool_util.get_or_create_tool_section( trans, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section=tool_panel_section_name ) - tool_panel_section_keys.append( tool_panel_section_key ) - else: - # The tools will be loaded outside of any sections in the tool panel. - tool_panel_section_keys.append( None ) - else: - # The installed_repository must be in the installed state, so we can skip determining if it has tools that are displayed in a tool panel section - # since no changes will be made to it. - tool_panel_section_keys.append( None ) - else: - tool_dependencies = None - # The tools will be loaded outside of any sections in the tool panel. - tool_panel_section_keys.append( None ) - repo_info_dict = create_repo_info_dict( trans=trans, - repository_clone_url=repository_clone_url, - changeset_revision=installed_repository.changeset_revision, - ctx_rev=installed_repository.ctx_rev, - repository_owner=installed_repository.owner, - repository_name=installed_repository.name, - repository=None, - repository_metadata=None, - tool_dependencies=tool_dependencies, - repository_dependencies=repository_dependencies ) + if repository_dependencies_dict: + # Generate the list of installed repositories from the information contained in the repository_dependencies dictionary. + installed_repositories = get_installed_repositories_from_repository_dependencies( trans, repository_dependencies_dict ) + # Some repositories may have repository dependencies that are required to be installed before the dependent repository, so we'll order the list of + # tsr_ids to ensure all repositories are repaired in the required order. + for installed_repository in installed_repositories: + tsr_ids.append( trans.security.encode_id( installed_repository.id ) ) + repo_info_dict, tool_panel_section_key = get_repo_info_dict_for_repair( trans, installed_repository ) + tool_panel_section_keys.append( tool_panel_section_key ) + repo_info_dicts.append( repo_info_dict ) + else: + # The received repository has no repository dependencies. + tsr_ids.append( trans.security.encode_id( repository.id ) ) + repo_info_dict, tool_panel_section_key = get_repo_info_dict_for_repair( trans, repository ) + tool_panel_section_keys.append( tool_panel_section_key ) repo_info_dicts.append( repo_info_dict ) ordered_tsr_ids, ordered_repo_info_dicts, ordered_tool_panel_section_keys = \ order_components_for_installation( trans, @@ -258,6 +222,45 @@ return repo_info_dict, includes_tools, includes_tool_dependencies, includes_tools_for_display_in_tool_panel, \ has_repository_dependencies, has_repository_dependencies_only_if_compiling_contained_td +def get_repo_info_dict_for_repair( trans, repository ): + tool_panel_section_key = None + repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, repository ) + repository_dependencies = repository_dependency_util.get_repository_dependencies_for_installed_tool_shed_repository( trans, repository ) + metadata = repository.metadata + if metadata: + tool_dependencies = metadata.get( 'tool_dependencies', None ) + tool_panel_section_dict = metadata.get( 'tool_panel_section', None ) + if tool_panel_section_dict: + # The repository must be in the uninstalled state. The structure of tool_panel_section_dict is: + # {<tool guid> : [{ 'id':<section id>, 'name':<section name>, 'version':<section version>, 'tool_config':<tool config file name> }]} + # Here is an example: + # {"localhost:9009/repos/test/filter/Filter1/1.1.0": + # [{"id": "filter_and_sort", "name": "Filter and Sort", "tool_config": "filtering.xml", "version": ""}]} + # Currently all tools contained within an installed tool shed repository must be loaded into the same section in the tool panel, so we can + # get the section id of the first guid in the tool_panel_section_dict. In the future, we'll have to handle different sections per guid. + guid = tool_panel_section_dict.keys()[ 0 ] + section_dicts = tool_panel_section_dict[ guid ] + section_dict = section_dicts[ 0 ] + tool_panel_section_id = section_dict[ 'id' ] + tool_panel_section_name = section_dict[ 'name' ] + if tool_panel_section_id: + tool_panel_section_key, tool_panel_section = tool_util.get_or_create_tool_section( trans, + tool_panel_section_id=tool_panel_section_id, + new_tool_panel_section=tool_panel_section_name ) + else: + tool_dependencies = None + repo_info_dict = create_repo_info_dict( trans=trans, + repository_clone_url=repository_clone_url, + changeset_revision=repository.changeset_revision, + ctx_rev=repository.ctx_rev, + repository_owner=repository.owner, + repository_name=repository.name, + repository=None, + repository_metadata=None, + tool_dependencies=tool_dependencies, + repository_dependencies=repository_dependencies ) + return repo_info_dict, tool_panel_section_key + def get_repository_components_for_installation( encoded_tsr_id, encoded_tsr_ids, repo_info_dicts, tool_panel_section_keys ): """ The received encoded_tsr_ids, repo_info_dicts, and tool_panel_section_keys are 3 lists that contain associated elements at each location in https://bitbucket.org/galaxy/galaxy-central/commits/564467b04a21/ Changeset: 564467b04a21 User: greg Date: 2013-10-31 17:02:44 Summary: Merged from next-stable Affected #: 1 file diff -r 8be1b569f58680c81b5d1da2d489d3c4de0f4f63 -r 564467b04a2136f7fb90fddae233f832dc87fcaf lib/tool_shed/galaxy_install/repository_util.py --- a/lib/tool_shed/galaxy_install/repository_util.py +++ b/lib/tool_shed/galaxy_install/repository_util.py @@ -140,63 +140,27 @@ each repository's tool dependencies. This method is called only from Galaxy when attempting to correct issues with an installed repository that has installation problems somewhere in it's dependency hierarchy. """ + tsr_ids = [] + repo_info_dicts = [] + tool_panel_section_keys = [] repair_dict = {} # Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend. repository_dependencies_dict = repository_dependency_util.get_repository_dependencies_for_installed_tool_shed_repository( trans, repository ) - # Generate the list of installed repositories from the information contained in the repository_dependencies dictionary. - installed_repositories = get_installed_repositories_from_repository_dependencies( trans, repository_dependencies_dict ) - # Some repositories may have repository dependencies that are required to be installed before the dependent repository, so we'll order the list of - # tsr_ids to ensure all repositories are repaired in the required order. - tsr_ids = [] - repo_info_dicts = [] - tool_panel_section_keys = [] - for installed_repository in installed_repositories: - tsr_ids.append( trans.security.encode_id( installed_repository.id ) ) - repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, installed_repository ) - repository_dependencies = repository_dependency_util.get_repository_dependencies_for_installed_tool_shed_repository( trans, installed_repository ) - metadata = installed_repository.metadata - if metadata: - tool_dependencies = metadata.get( 'tool_dependencies', None ) - tool_panel_section_dict = metadata.get( 'tool_panel_section', None ) - if tool_panel_section_dict: - # The installed_repository must be in the uninstalled state. The structure of tool_panel_section_dict is: - # {<tool guid> : [{ 'id':<section id>, 'name':<section name>, 'version':<section version>, 'tool_config':<tool config file name> }]} - # Here is an example: - # {"localhost:9009/repos/test/filter/Filter1/1.1.0": - # [{"id": "filter_and_sort", "name": "Filter and Sort", "tool_config": "filtering.xml", "version": ""}]} - # Currently all tools contained within an installed tool shed repository must be loaded into the same section in the tool panel, so we can - # get the section id of the first guid in the tool_panel_section_dict. In the future, we'll have to handle different sections per guid. - guid = tool_panel_section_dict.keys()[ 0 ] - section_dicts = tool_panel_section_dict[ guid ] - section_dict = section_dicts[ 0 ] - tool_panel_section_id = section_dict[ 'id' ] - tool_panel_section_name = section_dict[ 'name' ] - if tool_panel_section_id: - tool_panel_section_key, tool_panel_section = tool_util.get_or_create_tool_section( trans, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section=tool_panel_section_name ) - tool_panel_section_keys.append( tool_panel_section_key ) - else: - # The tools will be loaded outside of any sections in the tool panel. - tool_panel_section_keys.append( None ) - else: - # The installed_repository must be in the installed state, so we can skip determining if it has tools that are displayed in a tool panel section - # since no changes will be made to it. - tool_panel_section_keys.append( None ) - else: - tool_dependencies = None - # The tools will be loaded outside of any sections in the tool panel. - tool_panel_section_keys.append( None ) - repo_info_dict = create_repo_info_dict( trans=trans, - repository_clone_url=repository_clone_url, - changeset_revision=installed_repository.changeset_revision, - ctx_rev=installed_repository.ctx_rev, - repository_owner=installed_repository.owner, - repository_name=installed_repository.name, - repository=None, - repository_metadata=None, - tool_dependencies=tool_dependencies, - repository_dependencies=repository_dependencies ) + if repository_dependencies_dict: + # Generate the list of installed repositories from the information contained in the repository_dependencies dictionary. + installed_repositories = get_installed_repositories_from_repository_dependencies( trans, repository_dependencies_dict ) + # Some repositories may have repository dependencies that are required to be installed before the dependent repository, so we'll order the list of + # tsr_ids to ensure all repositories are repaired in the required order. + for installed_repository in installed_repositories: + tsr_ids.append( trans.security.encode_id( installed_repository.id ) ) + repo_info_dict, tool_panel_section_key = get_repo_info_dict_for_repair( trans, installed_repository ) + tool_panel_section_keys.append( tool_panel_section_key ) + repo_info_dicts.append( repo_info_dict ) + else: + # The received repository has no repository dependencies. + tsr_ids.append( trans.security.encode_id( repository.id ) ) + repo_info_dict, tool_panel_section_key = get_repo_info_dict_for_repair( trans, repository ) + tool_panel_section_keys.append( tool_panel_section_key ) repo_info_dicts.append( repo_info_dict ) ordered_tsr_ids, ordered_repo_info_dicts, ordered_tool_panel_section_keys = \ order_components_for_installation( trans, @@ -258,6 +222,45 @@ return repo_info_dict, includes_tools, includes_tool_dependencies, includes_tools_for_display_in_tool_panel, \ has_repository_dependencies, has_repository_dependencies_only_if_compiling_contained_td +def get_repo_info_dict_for_repair( trans, repository ): + tool_panel_section_key = None + repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, repository ) + repository_dependencies = repository_dependency_util.get_repository_dependencies_for_installed_tool_shed_repository( trans, repository ) + metadata = repository.metadata + if metadata: + tool_dependencies = metadata.get( 'tool_dependencies', None ) + tool_panel_section_dict = metadata.get( 'tool_panel_section', None ) + if tool_panel_section_dict: + # The repository must be in the uninstalled state. The structure of tool_panel_section_dict is: + # {<tool guid> : [{ 'id':<section id>, 'name':<section name>, 'version':<section version>, 'tool_config':<tool config file name> }]} + # Here is an example: + # {"localhost:9009/repos/test/filter/Filter1/1.1.0": + # [{"id": "filter_and_sort", "name": "Filter and Sort", "tool_config": "filtering.xml", "version": ""}]} + # Currently all tools contained within an installed tool shed repository must be loaded into the same section in the tool panel, so we can + # get the section id of the first guid in the tool_panel_section_dict. In the future, we'll have to handle different sections per guid. + guid = tool_panel_section_dict.keys()[ 0 ] + section_dicts = tool_panel_section_dict[ guid ] + section_dict = section_dicts[ 0 ] + tool_panel_section_id = section_dict[ 'id' ] + tool_panel_section_name = section_dict[ 'name' ] + if tool_panel_section_id: + tool_panel_section_key, tool_panel_section = tool_util.get_or_create_tool_section( trans, + tool_panel_section_id=tool_panel_section_id, + new_tool_panel_section=tool_panel_section_name ) + else: + tool_dependencies = None + repo_info_dict = create_repo_info_dict( trans=trans, + repository_clone_url=repository_clone_url, + changeset_revision=repository.changeset_revision, + ctx_rev=repository.ctx_rev, + repository_owner=repository.owner, + repository_name=repository.name, + repository=None, + repository_metadata=None, + tool_dependencies=tool_dependencies, + repository_dependencies=repository_dependencies ) + return repo_info_dict, tool_panel_section_key + def get_repository_components_for_installation( encoded_tsr_id, encoded_tsr_ids, repo_info_dicts, tool_panel_section_keys ): """ The received encoded_tsr_ids, repo_info_dicts, and tool_panel_section_keys are 3 lists that contain associated elements at each location in 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