commit/galaxy-central: greg: Properly handle updates which have become available for tool shed repositories while they were ninstalled when reinstalling them.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e6302ee56ed0/ changeset: e6302ee56ed0 user: greg date: 2013-01-16 21:39:22 summary: Properly handle updates which have become available for tool shed repositories while they were ninstalled when reinstalling them. affected #: 8 files diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -596,8 +596,7 @@ # In this case, a record for the repository will exist in the database with the status of 'New'. repository = suc.get_repository_for_dependency_relationship( trans.app, tool_shed_url, name, repository_owner, changeset_revision ) if repository and repository.metadata: - installed_rd, missing_rd = \ - get_installed_and_missing_repository_dependencies( trans, repository ) + installed_rd, missing_rd = get_installed_and_missing_repository_dependencies( trans, repository ) else: installed_rd, missing_rd = get_installed_and_missing_repository_dependencies_for_new_install( trans, repo_info_tuple ) # Discover all repository dependencies and retrieve information for installing them. diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -66,7 +66,7 @@ tool_dependencies[ dependency_key ] = requirements_dict return tool_dependencies def build_readme_files_dict( metadata, tool_path=None ): - """Return a dictionary of valid readme file name <-> readme file content pairs for all readme files contained in the received repository_metadata.""" + """Return a dictionary of valid readme file name <-> readme file content pairs for all readme files contained in the received metadata.""" readme_files_dict = {} if metadata: if 'readme_files' in metadata: @@ -128,10 +128,14 @@ containers_dict[ 'readme_files' ] = readme_files_root_folder # Installed repository dependencies container. if repository_dependencies: + if new_install: + label = 'Repository dependencies' + else: + label = 'Installed repository dependencies' folder_id, repository_dependencies_root_folder = container_util.build_repository_dependencies_folder( trans=trans, folder_id=folder_id, repository_dependencies=repository_dependencies, - label='Installed repository dependencies', + label=label, installed=True ) containers_dict[ 'repository_dependencies' ] = repository_dependencies_root_folder # Missing repository dependencies container. @@ -777,17 +781,20 @@ sa_session.flush() return tool_shed_repository def create_repo_info_dict( trans, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_name=None, repository=None, - repository_metadata=None, metadata=None, repository_dependencies=None ): + repository_metadata=None, tool_dependencies=None, repository_dependencies=None ): """ Return a dictionary that includes all of the information needed to install a repository into a local Galaxy instance. The dictionary will also contain the recursive list of repository dependencies defined for the repository, as well as the defined tool dependencies. - This method is called from Galaxy in two places: - 1. During the tool shed repository installation process (via the tool shed's get_repository_information() method)- in this case both the received - repository and repository_metadata will be objects. - 2. When a tool shed repository that was uninstalled from a Galaxy instance is being re-installed - in this case, both repository and - repository_metadata will be None, but metadata will be the tool_shed_repository metadata on the Galaxy side, and the repository_dependencies will - be an object previously retrieved from the tool shed. + This method is called from Galaxy unser three scenarios: + 1. During the tool shed repository installation process via the tool shed's get_repository_information() method. In this case both the received + repository and repository_metadata will be objects., but tool_dependencies and repository_dependencies will be None + 2. When a tool shed repository that was uninstalled from a Galaxy instance is being reinstalled with no updates available. In this case, both + repository and repository_metadata will be None, but tool_dependencies and repository_dependencies will be objects previously retrieved from the + tool shed if the repository includes definitions for them. + 3. When a tool shed repository that was uninstalled from a Galaxy instance is being reinstalled with updates available. In this case, this + method is reached via the tool shed's get_updated_repository_information() method, and both repository and repository_metadata will be objects + but tool_dependencies and repository_dependencies will be None. """ repo_info_dict = {} repository = get_repository_by_name_and_owner( trans, repository_name, repository_owner ) @@ -806,27 +813,24 @@ all_repository_dependencies=None, handled_key_rd_dicts=None, circular_repository_dependencies=None ) - if metadata: - tool_dependencies = metadata.get( 'tool_dependencies', None ) - if tool_dependencies: - new_tool_dependencies = {} - for dependency_key, requirements_dict in tool_dependencies.items(): - if dependency_key in [ 'set_environment' ]: - new_set_environment_dict_list = [] - for set_environment_dict in requirements_dict: - set_environment_dict[ 'repository_name' ] = repository_name - set_environment_dict[ 'repository_owner' ] = repository_owner - set_environment_dict[ 'changeset_revision' ] = changeset_revision - new_set_environment_dict_list.append( set_environment_dict ) - new_tool_dependencies[ dependency_key ] = new_set_environment_dict_list - else: - requirements_dict[ 'repository_name' ] = repository_name - requirements_dict[ 'repository_owner' ] = repository_owner - requirements_dict[ 'changeset_revision' ] = changeset_revision - new_tool_dependencies[ dependency_key ] = requirements_dict - tool_dependencies = new_tool_dependencies - else: - tool_dependencies = None + tool_dependencies = metadata.get( 'tool_dependencies', None ) + if tool_dependencies: + new_tool_dependencies = {} + for dependency_key, requirements_dict in tool_dependencies.items(): + if dependency_key in [ 'set_environment' ]: + new_set_environment_dict_list = [] + for set_environment_dict in requirements_dict: + set_environment_dict[ 'repository_name' ] = repository_name + set_environment_dict[ 'repository_owner' ] = repository_owner + set_environment_dict[ 'changeset_revision' ] = changeset_revision + new_set_environment_dict_list.append( set_environment_dict ) + new_tool_dependencies[ dependency_key ] = new_set_environment_dict_list + else: + requirements_dict[ 'repository_name' ] = repository_name + requirements_dict[ 'repository_owner' ] = repository_owner + requirements_dict[ 'changeset_revision' ] = changeset_revision + new_tool_dependencies[ dependency_key ] = requirements_dict + tool_dependencies = new_tool_dependencies # Cast unicode to string. repo_info_dict[ str( repository.name ) ] = ( str( repository.description ), str( repository_clone_url ), diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -1406,7 +1406,7 @@ a local Galaxy instance. """ includes_tools = False - includes_repository_dependencies = False + has_repository_dependencies = False includes_tool_dependencies = False repo_info_dicts = [] for tup in zip( util.listify( repository_ids ), util.listify( changeset_revisions ) ): @@ -1417,8 +1417,8 @@ metadata = repository_metadata.metadata if not includes_tools and 'tools' in metadata: includes_tools = True - if not includes_repository_dependencies and 'repository_dependencies' in metadata: - includes_repository_dependencies = True + if not has_repository_dependencies and 'repository_dependencies' in metadata: + has_repository_dependencies = True if not includes_tool_dependencies and 'tool_dependencies' in metadata: includes_tool_dependencies = True repo_dir = repository.repo_path( trans.app ) @@ -1431,11 +1431,12 @@ repository_owner=repository.user.username, repository_name=repository.name, repository=repository, - metadata=None, - repository_metadata=repository_metadata ) + repository_metadata=repository_metadata, + tool_dependencies=None, + repository_dependencies=None ) repo_info_dicts.append( encoding_util.tool_shed_encode( repo_info_dict ) ) return dict( includes_tools=includes_tools, - includes_repository_dependencies=includes_repository_dependencies, + has_repository_dependencies=has_repository_dependencies, includes_tool_dependencies=includes_tool_dependencies, repo_info_dicts=repo_info_dicts ) @web.json @@ -1465,10 +1466,6 @@ def get_tool_dependencies( self, trans, **kwd ): """Handle a request from a Galaxy instance.""" params = util.Params( kwd ) - message = util.restore_text( params.get( 'message', '' ) ) - status = params.get( 'status', 'done' ) - # If the request originated with the UpdateManager, it will not include a galaxy_url. - galaxy_url = kwd.get( 'galaxy_url', '' ) name = params.get( 'name', None ) owner = params.get( 'owner', None ) changeset_revision = params.get( 'changeset_revision', None ) @@ -1478,10 +1475,8 @@ break metadata = downloadable_revision.metadata tool_dependencies = metadata.get( 'tool_dependencies', '' ) - from_install_manager = kwd.get( 'from_install_manager', False ) - if from_install_manager: - if tool_dependencies: - return encoding_util.tool_shed_encode( tool_dependencies ) + if tool_dependencies: + return encoding_util.tool_shed_encode( tool_dependencies ) return '' @web.expose def get_tool_versions( self, trans, **kwd ): @@ -1506,6 +1501,53 @@ if tool_version_dicts: return json.to_json_string( tool_version_dicts ) return '' + @web.json + def get_updated_repository_information( self, trans, name, owner, changeset_revision, **kwd ): + """Generate a disctionary that contains the information about a repository that is necessary for installing it into a local Galaxy instance.""" + repository = suc.get_repository_by_name_and_owner( trans, name, owner ) + repository_id = trans.security.encode_id( repository.id ) + repository_clone_url = suc.generate_clone_url_for_repository_in_tool_shed( trans, repository ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) + repo_dir = repository.repo_path( trans.app ) + repo = hg.repository( suc.get_configured_ui(), repo_dir ) + ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) + repo_info_dict = suc.create_repo_info_dict( trans=trans, + repository_clone_url=repository_clone_url, + changeset_revision=changeset_revision, + ctx_rev=str( ctx.rev() ), + repository_owner=repository.user.username, + repository_name=repository.name, + repository=repository, + repository_metadata=repository_metadata, + tool_dependencies=None, + repository_dependencies=None ) + metadata = repository_metadata.metadata + if metadata: + readme_files_dict = suc.build_readme_files_dict( metadata ) + if 'tools' in metadata: + includes_tools = True + else: + includes_tools = False + else: + readme_files_dict = None + includes_tools = False + # See if the repo_info_dict was populated with repository_dependencies or tool_dependencies. + for name, repo_info_tuple in repo_info_dict.items(): + description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_dependencies, tool_dependencies = \ + suc.get_repo_info_tuple_contents( repo_info_tuple ) + if repository_dependencies: + has_repository_dependencies = True + else: + has_repository_dependencies = False + if tool_dependencies: + includes_tool_dependencies = True + else: + includes_tool_dependencies = False + return dict( includes_tools=includes_tools, + has_repository_dependencies=has_repository_dependencies, + includes_tool_dependencies=includes_tool_dependencies, + readme_files_dict=readme_files_dict, + repo_info_dict=repo_info_dict ) def get_versions_of_tool( self, trans, repository, repository_metadata, guid ): """Return the tool lineage in descendant order for the received guid contained in the received repsitory_metadata.tool_versions.""" encoded_id = trans.security.encode_id( repository.id ) diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 lib/galaxy/webapps/community/util/container_util.py --- a/lib/galaxy/webapps/community/util/container_util.py +++ b/lib/galaxy/webapps/community/util/container_util.py @@ -485,10 +485,14 @@ sub_folder.repository_dependencies.append( repository_dependency ) for repository_dependency in rd_value: if trans.webapp.name == 'galaxy': - # We have two extra items in the tuple, repository.id and repository.status. - tool_shed_repository_id = repository_dependency[ 4 ] - installation_status = repository_dependency[ 5 ] - repository_dependency = repository_dependency[ 0:4 ] + if len( repository_dependency ) == 6: + # We have two extra items in the tuple, repository.id and repository.status. + tool_shed_repository_id = repository_dependency[ 4 ] + installation_status = repository_dependency[ 5 ] + repository_dependency = repository_dependency[ 0:4 ] + else: + tool_shed_repository_id = None + installation_status = 'unknown' else: tool_shed_repository_id = None installation_status = None diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 lib/galaxy/webapps/galaxy/controllers/admin.py --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -711,8 +711,7 @@ tool_dependencies_dict = {} repository_name = elem.get( 'name' ) changeset_revision = elem.get( 'changeset_revision' ) - url = '%s/repository/get_tool_dependencies?name=%s&owner=devteam&changeset_revision=%s&from_install_manager=True' % \ - ( tool_shed_url, repository_name, changeset_revision ) + url = '%s/repository/get_tool_dependencies?name=%s&owner=devteam&changeset_revision=%s' % ( tool_shed_url, repository_name, changeset_revision ) response = urllib2.urlopen( url ) text = response.read() response.close() diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -374,21 +374,41 @@ if repository.uninstalled: # Since we're reinstalling the repository we need to find the latest changeset revision to which it can be updated so that we # can reset the metadata if necessary. This will ensure that information about repository dependencies and tool dependencies - # will be current. + # will be current. Only allow selecting a different section in the tool panel if the repository was uninstalled. current_changeset_revision, current_ctx_rev, includes_tools, has_repository_dependencies = \ shed_util.get_update_to_changeset_revision_and_ctx_rev( trans, repository ) if current_ctx_rev == repository.ctx_rev: - includes_tools = repository.includes_tools - has_repository_dependencies = repository.has_repository_dependencies - if includes_tools or has_repository_dependencies: - # Only allow selecting a different section in the tool panel if the repository was uninstalled. - return trans.response.send_redirect( web.url_for( controller='admin_toolshed', - action='reselect_tool_panel_section', - **kwd ) ) + # The uninstalled repository is current. + if repository.includes_tools or repository.has_repository_dependencies: + return trans.response.send_redirect( web.url_for( controller='admin_toolshed', + action='reselect_tool_panel_section', + **kwd ) ) + else: + return trans.response.send_redirect( web.url_for( controller='admin_toolshed', + action='reinstall_repository', + **kwd ) ) else: - return trans.response.send_redirect( web.url_for( controller='admin_toolshed', - action='reinstall_repository', - **kwd ) ) + # The uninstalled repository has updates available in the tool shed. + updated_repo_info_dict = self.get_updated_repository_information( trans=trans, + repository_id=trans.security.encode_id( repository.id ), + repository_name=repository.name, + repository_owner=repository.owner, + changeset_revision=current_changeset_revision ) + has_repository_dependencies = updated_repo_info_dict.get( 'has_repository_dependencies', False ) + includes_tool_dependencies = updated_repo_info_dict.get( 'includes_tool_dependencies', False ) + if has_repository_dependencies or includes_tool_dependencies: + json_repo_info_dict = json.to_json_string( updated_repo_info_dict ) + encoded_repo_info_dict = encoding_util.tool_shed_encode( json_repo_info_dict ) + kwd[ 'latest_changeset_revision' ] = current_changeset_revision + kwd[ 'latest_ctx_rev' ] = current_ctx_rev + kwd[ 'updated_repo_info_dict' ] = encoded_repo_info_dict + return trans.response.send_redirect( web.url_for( controller='admin_toolshed', + action='reselect_tool_panel_section', + **kwd ) ) + else: + return trans.response.send_redirect( web.url_for( controller='admin_toolshed', + action='reinstall_repository', + **kwd ) ) else: return trans.response.send_redirect( web.url_for( controller='admin_toolshed', action='activate_repository', @@ -581,6 +601,45 @@ else: text = '' return text + @web.expose + @web.require_admin + def get_tool_dependencies( self, trans, repository_id, repository_name, repository_owner, changeset_revision ): + """ + Send a request to the appropriate tool shed to retrieve the dictionary of tool dependencies defined for the received repository name, + owner and changeset revision. The received repository_id is the encoded id of the installed tool shed repository in Galaxy. We need + it so that we can derive the tool shed from which it was installed. + """ + repository = suc.get_installed_tool_shed_repository( trans, repository_id ) + tool_shed_url = suc.get_url_from_repository_tool_shed( trans.app, repository ) + url = suc.url_join( tool_shed_url, + 'repository/get_tool_dependencies?name=%s&owner=%s&changeset_revision=%s' % \ + ( repository_name, repository_owner, changeset_revision ) ) + response = urllib2.urlopen( url ) + raw_text = response.read() + response.close() + if len( raw_text ) > 2: + encoded_text = json.from_json_string( raw_text ) + text = encoding_util.tool_shed_decode( encoded_text ) + else: + text = '' + return text + @web.expose + @web.require_admin + def get_updated_repository_information( self, trans, repository_id, repository_name, repository_owner, changeset_revision ): + """ + Send a request to the appropriate tool shed to retrieve the dictionary of information required to reinstall an updated revision of an + uninstalled tool shed repository. + """ + repository = suc.get_installed_tool_shed_repository( trans, repository_id ) + tool_shed_url = suc.get_url_from_repository_tool_shed( trans.app, repository ) + url = suc.url_join( tool_shed_url, + 'repository/get_updated_repository_information?name=%s&owner=%s&changeset_revision=%s' % \ + ( repository_name, repository_owner, changeset_revision ) ) + response = urllib2.urlopen( url ) + raw_text = response.read() + response.close() + repo_information_dict = json.from_json_string( raw_text ) + return repo_information_dict def get_versions_of_tool( self, app, guid ): tool_version = shed_util.get_tool_version( app, guid ) return tool_version.get_version_ids( app, reverse=True ) @@ -1149,7 +1208,7 @@ status = kwd.get( 'status', 'done' ) tool_shed_url = kwd[ 'tool_shed_url' ] # Handle repository dependencies. - includes_repository_dependencies = util.string_as_bool( kwd.get( 'includes_repository_dependencies', False ) ) + has_repository_dependencies = util.string_as_bool( kwd.get( 'has_repository_dependencies', False ) ) install_repository_dependencies = kwd.get( 'install_repository_dependencies', '' ) # Every repository will be installed into the same tool panel section or all will be installed outside of any sections. new_tool_panel_section = kwd.get( 'new_tool_panel_section', '' ) @@ -1173,12 +1232,12 @@ response.close() repo_information_dict = json.from_json_string( raw_text ) includes_tools = util.string_as_bool( repo_information_dict.get( 'includes_tools', False ) ) - includes_repository_dependencies = util.string_as_bool( repo_information_dict.get( 'includes_repository_dependencies', False ) ) + has_repository_dependencies = util.string_as_bool( repo_information_dict.get( 'has_repository_dependencies', False ) ) includes_tool_dependencies = util.string_as_bool( repo_information_dict.get( 'includes_tool_dependencies', False ) ) encoded_repo_info_dicts = util.listify( repo_information_dict.get( 'repo_info_dicts', [] ) ) repo_info_dicts = [ encoding_util.tool_shed_decode( encoded_repo_info_dict ) for encoded_repo_info_dict in encoded_repo_info_dicts ] - if ( not includes_tools and not includes_repository_dependencies ) or \ - ( ( includes_tools or includes_repository_dependencies ) and kwd.get( 'select_tool_panel_section_button', False ) ): + if ( not includes_tools and not has_repository_dependencies ) or \ + ( ( includes_tools or has_repository_dependencies ) and kwd.get( 'select_tool_panel_section_button', False ) ): install_repository_dependencies = CheckboxField.is_checked( install_repository_dependencies ) if includes_tools: shed_tool_conf = kwd[ 'shed_tool_conf' ] @@ -1241,7 +1300,7 @@ for tsr in created_or_updated_tool_shed_repositories: tool_panel_section_keys.append( tool_panel_section_key ) new_kwd = dict( includes_tools=includes_tools, - includes_repository_dependencies=includes_repository_dependencies, + has_repository_dependencies=has_repository_dependencies, install_repository_dependencies=install_repository_dependencies, includes_tool_dependencies=includes_tool_dependencies, install_tool_dependencies=install_tool_dependencies, @@ -1331,7 +1390,7 @@ includes_tools=includes_tools, includes_tool_dependencies=includes_tool_dependencies, install_tool_dependencies_check_box=install_tool_dependencies_check_box, - includes_repository_dependencies=includes_repository_dependencies, + has_repository_dependencies=has_repository_dependencies, install_repository_dependencies_check_box=install_repository_dependencies_check_box, new_tool_panel_section=new_tool_panel_section, containers_dict=containers_dict, @@ -1364,7 +1423,7 @@ tool_panel_section_key = None tool_panel_section_keys = [] metadata = tool_shed_repository.metadata - # Keep track of tool dependencies define dfor the current repository or those defined for any of it's repository dependencies. + # Keep track of tool dependencies defined for the current repository or those defined for any of it's repository dependencies. includes_tool_dependencies = tool_shed_repository.includes_tool_dependencies if tool_shed_repository.includes_tools: # Handle the selected tool panel location for loading tools included in the tool shed repository. @@ -1381,7 +1440,7 @@ tool_shed_repository.installed_changeset_revision, tool_shed_repository.ctx_rev, repository_clone_url, - tool_shed_repository.metadata, + metadata, trans.model.ToolShedRepository.installation_status.NEW, tool_shed_repository.installed_changeset_revision, tool_shed_repository.owner, @@ -1402,6 +1461,10 @@ changeset_revision=tool_shed_repository.changeset_revision ) else: repository_dependencies = None + if metadata: + tool_dependencies = metadata.get( 'tool_dependencies', None ) + else: + tool_dependencies = None repo_info_dict = suc.create_repo_info_dict( trans=trans, repository_clone_url=repository_clone_url, changeset_revision=tool_shed_repository.changeset_revision, @@ -1410,15 +1473,15 @@ repository_name=tool_shed_repository.name, repository=None, repository_metadata=None, - metadata=metadata, + tool_dependencies=tool_dependencies, repository_dependencies=repository_dependencies ) repo_info_dicts.append( repo_info_dict ) # Make sure all tool_shed_repository records exist. created_or_updated_tool_shed_repositories, tool_panel_section_keys, repo_info_dicts, filtered_repo_info_dicts, message = \ - shed_util.create_repository_dependency_objects( trans, - tool_path, - tool_shed_url, - repo_info_dicts, + shed_util.create_repository_dependency_objects( trans=trans, + tool_path=tool_path, + tool_shed_url=tool_shed_url, + repo_info_dicts=repo_info_dicts, reinstalling=True, install_repository_dependencies=install_repository_dependencies, no_changes_checked=no_changes_checked, @@ -1472,40 +1535,62 @@ @web.expose @web.require_admin def reselect_tool_panel_section( self, trans, **kwd ): - """Select or change the tool panel section to contain the tools included in the tool shed repositories being reinstalled.""" + """ + Select or change the tool panel section to contain the tools included in the tool shed repository being reinstalled. If there are updates + available for the repository in the tool shed, the tool_dependencies and repository_dependencies associated with the updated changeset revision + will have been retrieved from the tool shed and passed in the received kwd. In this case, the stored tool shed repository metqdata from the + Galaxy database will not be used since it is outdated. + """ message = '' - repository_id = kwd[ 'id' ] + repository_id = kwd.get( 'id', None ) + latest_changeset_revision = kwd.get( 'latest_changeset_revision', None ) + latest_ctx_rev = kwd.get( 'latest_ctx_rev', None ) tool_shed_repository = suc.get_installed_tool_shed_repository( trans, repository_id ) + repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, tool_shed_repository ) metadata = tool_shed_repository.metadata tool_shed_url = suc.get_url_from_repository_tool_shed( trans.app, tool_shed_repository ) - ctx_rev = suc.get_ctx_rev( tool_shed_url, tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.installed_changeset_revision ) - repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, tool_shed_repository ) tool_path, relative_install_dir = tool_shed_repository.get_tool_relative_path( trans.app ) - repository_dependencies = self.get_repository_dependencies( trans=trans, - repository_id=repository_id, - repository_name=tool_shed_repository.name, - repository_owner=tool_shed_repository.owner, - changeset_revision=tool_shed_repository.changeset_revision ) - if repository_dependencies: - includes_repository_dependencies = True + if latest_changeset_revision and latest_ctx_rev: + # There are updates available in the tool shed for the repository, so use the receieved dependency information which was retrieved from + # the tool shed. + encoded_updated_repo_info_dict = kwd.get( 'updated_repo_info_dict', None ) + updated_repo_info_dict = encoding_util.tool_shed_decode( encoded_updated_repo_info_dict ) + readme_files_dict = updated_repo_info_dict.get( 'readme_files_dict', None ) + includes_tools = updated_repo_info_dict.get( 'includes_tools', False ) + has_repository_dependencies = updated_repo_info_dict.get( 'has_repository_dependencies', False ) + includes_tool_dependencies = updated_repo_info_dict.get( 'includes_tool_dependencies', False ) + repo_info_dict = updated_repo_info_dict[ 'repo_info_dict' ] else: - includes_repository_dependencies = False - includes_tool_dependencies = tool_shed_repository.includes_tool_dependencies - repo_info_dict = suc.create_repo_info_dict( trans=trans, - repository_clone_url=repository_clone_url, - changeset_revision=tool_shed_repository.changeset_revision, - ctx_rev=ctx_rev, - repository_owner=tool_shed_repository.owner, - repository_name=tool_shed_repository.name, - repository=None, - repository_metadata=None, - metadata=metadata, - repository_dependencies=repository_dependencies ) - if includes_repository_dependencies: - # Discover all repository dependencies and retrieve information for installing them. - required_repo_info_dicts = shed_util.get_required_repo_info_dicts( tool_shed_url, util.listify( repo_info_dict ) ) + # There are no updates available from the tool shed for the repository, so use it's locally stored metadata. + if metadata: + readme_files_dict = suc.build_readme_files_dict( metadata ) + tool_dependencies = metadata.get( 'tool_dependencies', None ) + else: + readme_files_dict = None + tool_dependencies = None + includes_tool_dependencies = tool_shed_repository.includes_tool_dependencies + repository_dependencies = self.get_repository_dependencies( trans=trans, + repository_id=repository_id, + repository_name=tool_shed_repository.name, + repository_owner=tool_shed_repository.owner, + changeset_revision=tool_shed_repository.changeset_revision ) + repo_info_dict = suc.create_repo_info_dict( trans=trans, + repository_clone_url=repository_clone_url, + changeset_revision=tool_shed_repository.changeset_revision, + ctx_rev=tool_shed_repository.ctx_rev, + repository_owner=tool_shed_repository.owner, + repository_name=tool_shed_repository.name, + repository=None, + repository_metadata=None, + tool_dependencies=tool_dependencies, + repository_dependencies=repository_dependencies ) + repository_name, repository_owner, changeset_revision, includes_tool_dependencies, installed_repository_dependencies, \ + missing_repository_dependencies, installed_tool_dependencies, missing_tool_dependencies = \ + shed_util.get_dependencies_for_repository( trans, tool_shed_url, repo_info_dict, includes_tool_dependencies ) + if installed_repository_dependencies or missing_repository_dependencies: + has_repository_dependencies = True else: - required_repo_info_dicts = None + has_repository_dependencies = False # Get the location in the tool panel in which the tool was originally loaded. if 'tool_panel_section' in metadata: tool_panel_dict = metadata[ 'tool_panel_section' ] @@ -1533,14 +1618,14 @@ message += "The tools contained in your <b>%s</b> repository were last loaded into the tool panel outside of any sections. " % tool_shed_repository.name message += "Uncheck the <b>No changes</b> check box and select a tool panel section to load the tools into that section. " status = 'warning' - # Populate the containers_dict from the metadata for the tool shed repository we're reinstalling, but make sure to include tool dependencies defined for - # all of the repository's repository dependencies. - containers_dict = shed_util.populate_containers_dict_from_repository_metadata( trans=trans, - tool_shed_url=tool_shed_url, - tool_path=tool_path, - repository=tool_shed_repository, - reinstalling=True, - required_repo_info_dicts=required_repo_info_dicts ) + containers_dict = shed_util.populate_containers_dict_for_new_install( trans=trans, + tool_shed_url=tool_shed_url, + tool_path=tool_path, + readme_files_dict=readme_files_dict, + installed_repository_dependencies=installed_repository_dependencies, + missing_repository_dependencies=missing_repository_dependencies, + installed_tool_dependencies=installed_tool_dependencies, + missing_tool_dependencies=missing_tool_dependencies ) # Since we're reinstalling we'll merge the list of missing repository dependencies into the list of installed repository dependencies since each displayed # repository dependency will display a status, whether installed or missing. containers_dict = suc.merge_missing_repository_dependencies_to_installed_container( containers_dict ) @@ -1561,7 +1646,7 @@ no_changes_check_box=no_changes_check_box, original_section_name=original_section_name, includes_tool_dependencies=includes_tool_dependencies, - includes_repository_dependencies=includes_repository_dependencies, + has_repository_dependencies=has_repository_dependencies, install_repository_dependencies_check_box=install_repository_dependencies_check_box, install_tool_dependencies_check_box=install_tool_dependencies_check_box, containers_dict=containers_dict, diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 templates/admin/tool_shed_repository/reselect_tool_panel_section.mako --- a/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako +++ b/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako @@ -33,7 +33,7 @@ ${render_readme_section( containers_dict )} <div style="clear: both"></div> %endif - %if includes_repository_dependencies or includes_tool_dependencies: + %if has_repository_dependencies or includes_tool_dependencies: <div class="form-row"><table class="colored" width="100%"><th bgcolor="#EBD9B2">Confirm dependency installation</th> diff -r f199b236ceb08e9588351223b6277861e9f87325 -r e6302ee56ed03e4cc9f95ff1720b08721ced5600 templates/admin/tool_shed_repository/select_tool_panel_section.mako --- a/templates/admin/tool_shed_repository/select_tool_panel_section.mako +++ b/templates/admin/tool_shed_repository/select_tool_panel_section.mako @@ -17,10 +17,10 @@ <% # Handle the case where an uninstalled repository encountered errors during the process of being reinstalled. In - # this case, the repository metadata is an empty dictionary, but one or both of includes_repository_dependencies + # this case, the repository metadata is an empty dictionary, but one or both of has_repository_dependencies # and includes_tool_dependencies may be True. If either of these are True but we have no metadata, we cannot install # repository dependencies on this pass. - if includes_repository_dependencies: + if has_repository_dependencies: repository_dependencies = containers_dict[ 'repository_dependencies' ] missing_repository_dependencies = containers_dict[ 'missing_repository_dependencies' ] if repository_dependencies or missing_repository_dependencies: 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)
-
Bitbucket