commit/galaxy-central: greg: Fix for defining the order for installing repositories from the tool shed where 1 or more repositories defines a repository dependency with prior_installation_required=True.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f0da1c8355df/ Changeset: f0da1c8355df User: greg Date: 2013-05-10 17:06:35 Summary: Fix for defining the order for installing repositories from the tool shed where 1 or more repositories defines a repository dependency with prior_installation_required=True. Affected #: 2 files diff -r 72f47fad3d219d44988d672dc41f30748ba8d5ff -r f0da1c8355df9a68c3db5fecd27ed20def89a3ec lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py --- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py +++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py @@ -248,25 +248,31 @@ # Install the repositories, keeping track of each one for later display. for index, tsr_id in enumerate( ordered_tsr_ids ): tool_shed_repository = trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( tsr_id ) ) - repo_info_dict = ordered_repo_info_dicts[ index ] - tool_panel_section_key = ordered_tool_panel_section_keys[ index ] - repository_util.install_tool_shed_repository( trans, - tool_shed_repository, - repo_info_dict, - tool_panel_section_key, - shed_tool_conf, - tool_path, - install_tool_dependencies, - reinstalling=False ) - tool_shed_repository_dict = tool_shed_repository.as_dict( value_mapper=default_tool_shed_repository_value_mapper( trans, tool_shed_repository ) ) - tool_shed_repository_dict[ 'url' ] = web.url_for( controller='tool_shed_repositories', - action='show', - id=trans.security.encode_id( tool_shed_repository.id ) ) - installed_tool_shed_repositories.append( tool_shed_repository_dict ) - else: + if tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.NEW, + trans.model.ToolShedRepository.installation_status.UNINSTALLED ]: + + repo_info_dict = ordered_repo_info_dicts[ index ] + tool_panel_section_key = ordered_tool_panel_section_keys[ index ] + repository_util.install_tool_shed_repository( trans, + tool_shed_repository, + repo_info_dict, + tool_panel_section_key, + shed_tool_conf, + tool_path, + install_tool_dependencies, + reinstalling=False ) + tool_shed_repository_dict = tool_shed_repository.as_dict( value_mapper=default_tool_shed_repository_value_mapper( trans, tool_shed_repository ) ) + tool_shed_repository_dict[ 'url' ] = web.url_for( controller='tool_shed_repositories', + action='show', + id=trans.security.encode_id( tool_shed_repository.id ) ) + installed_tool_shed_repositories.append( tool_shed_repository_dict ) + elif message: log.error( message, exc_info=True ) trans.response.status = 500 return dict( status='error', error=message ) + elif not created_or_updated_tool_shed_repositories and not message: + # We're attempting to install more than 1 repository, and all of them have already been installed. + return dict( status='error', error='All repositories that you are attempting to install have been previously installed.' ) # Display the list of installed repositories. return installed_tool_shed_repositories diff -r 72f47fad3d219d44988d672dc41f30748ba8d5ff -r f0da1c8355df9a68c3db5fecd27ed20def89a3ec 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 @@ -95,6 +95,34 @@ tool_dependencies ) return repo_info_dict +def get_next_prior_install_required_dict_entry( prior_install_required_dict, processed_tsr_ids ): + """ + The order in which the prior_install_required_dict is processed is critical in order to ensure that the ultimate repository installation order is correctly + defined. This method determines the next key / value pair from the received prior_install_required_dict that should be processed. + """ + # Return the first key / value pair that is not yet processed and whose value is an empty list. + for key, value in prior_install_required_dict.items(): + if key in processed_tsr_ids: + continue + if not value: + return key + # Return the first key / value pair that is not yet processed and whose ids in value are all included in processed_tsr_ids. + for key, value in prior_install_required_dict.items(): + if key in processed_tsr_ids: + continue + all_contained = True + for required_repository_id in value: + if required_repository_id not in processed_tsr_ids: + all_contained = False + break + if all_contained: + return key + # Return the first key / value pair that is not yet processed. Hopefully this is all that is necessary at this point. + for key, value in prior_install_required_dict.items(): + if key in processed_tsr_ids: + continue + return key + def get_prior_install_required_dict( trans, tsr_ids, repo_info_dicts ): """ Return a dictionary whose keys are the received tsr_ids and whose values are a list of tsr_ids, each of which is contained in the received list of tsr_ids @@ -591,10 +619,13 @@ # Create a dictionary whose keys are the received tsr_ids and whose values are a list of tsr_ids, each of which is contained in the received list of tsr_ids # and whose associated repository must be installed prior to the repository associated with the tsr_id key. prior_install_required_dict = get_prior_install_required_dict( trans, tsr_ids, repo_info_dicts ) - # Create the ordered_tsr_ids, the ordered_repo_info_dicts and the ordered_tool_panel_section_keys lists. - for tsr_id in tsr_ids: + processed_tsr_ids = [] + while len( processed_tsr_ids ) != len( prior_install_required_dict.keys() ): + tsr_id = get_next_prior_install_required_dict_entry( prior_install_required_dict, processed_tsr_ids ) + processed_tsr_ids.append( tsr_id ) + # Create the ordered_tsr_ids, the ordered_repo_info_dicts and the ordered_tool_panel_section_keys lists. if tsr_id not in ordered_tsr_ids: - prior_install_required_ids = prior_install_required_dict.get( tsr_id, [] ) + prior_install_required_ids = prior_install_required_dict[ tsr_id ] for prior_install_required_id in prior_install_required_ids: if prior_install_required_id not in ordered_tsr_ids: # Install the associated repository dependency first. 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