1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9fe1a6fc375b/ Changeset: 9fe1a6fc375b User: greg Date: 2014-01-15 21:35:41 Summary: Display messages for repositories in the tool shed that have dependencies on deprecated repositories. Affected #: 6 files diff -r d2f73445ce7ada2f13947aa7c7c8506743d40d3f -r 9fe1a6fc375b3fad14dac271ed8f85e02fc6ef6d lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -971,8 +971,9 @@ @web.require_login( "deprecate repository" ) def deprecate( self, trans, **kwd ): """Mark a repository in the tool shed as deprecated or not deprecated.""" - # Marking a repository in the tool shed as deprecated has no effect on any downloadable changeset revisions that may be associated with the - # repository. Revisions are not marked as not downlaodable because those that have installed the repository must be allowed to get updates. + # Marking a repository in the tool shed as deprecated has no effect on any downloadable changeset + # revisions that may be associated with the repository. Revisions are not marked as not downlaodable + # because those that have installed the repository must be allowed to get updates. message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) repository_id = kwd.get( 'id', None ) @@ -2287,7 +2288,9 @@ status = 'warning' else: # Handle messaging for orphan tool dependency definitions. - orphan_message = tool_dependency_util.generate_message_for_orphan_tool_dependencies( trans, repository, metadata ) + orphan_message = tool_dependency_util.generate_message_for_orphan_tool_dependencies( trans, + repository, + metadata ) if orphan_message: message += orphan_message status = 'warning' @@ -2302,14 +2305,23 @@ skip_tool_tests_check_box = CheckboxField( 'skip_tool_tests', checked=skip_tool_tests_checked ) categories = suc.get_categories( trans ) selected_categories = [ rca.category_id for rca in repository.categories ] - containers_dict = container_util.build_repository_containers_for_tool_shed( trans, repository, changeset_revision, repository_dependencies, repository_metadata ) + containers_dict = container_util.build_repository_containers_for_tool_shed( trans, + repository, + changeset_revision, + repository_dependencies, + repository_metadata ) heads = suc.get_repository_heads( repo ) + deprecated_repository_dependency_tups = \ + repository_dependency_util.get_repository_dependency_tups_from_repository_metadata( trans.app, + repository_metadata, + deprecated_only=True ) return trans.fill_template( '/webapps/tool_shed/repository/manage_repository.mako', repo_name=repo_name, description=description, long_description=long_description, current_allow_push_list=current_allow_push_list, allow_push_select_field=allow_push_select_field, + deprecated_repository_dependency_tups=deprecated_repository_dependency_tups, repo=repo, heads=heads, repository=repository, diff -r d2f73445ce7ada2f13947aa7c7c8506743d40d3f -r 9fe1a6fc375b3fad14dac271ed8f85e02fc6ef6d lib/tool_shed/galaxy_install/installed_repository_manager.py --- a/lib/tool_shed/galaxy_install/installed_repository_manager.py +++ b/lib/tool_shed/galaxy_install/installed_repository_manager.py @@ -76,7 +76,7 @@ # Get the list of repository dependencies for this repository. status = self.install_model.ToolShedRepository.installation_status.INSTALLED repository_dependency_tups = \ - repository_dependency_util.get_repository_dependency_tups_for_repository( self.app, repository, status=status ) + repository_dependency_util.get_repository_dependency_tups_for_installed_repository( self.app, repository, status=status ) # Add an entry to self.installed_repository_dependencies_of_installed_repositories. if repository_tup not in self.installed_repository_dependencies_of_installed_repositories: debug_msg = "Adding an entry for revision %s of repository %s owned by %s " % ( installed_changeset_revision, name, owner ) @@ -132,7 +132,7 @@ debug_msg += "to repository_dependencies_of_installed_repositories." log.debug( debug_msg ) repository_dependency_tups = \ - repository_dependency_util.get_repository_dependency_tups_for_repository( self.app, repository, status=None ) + repository_dependency_util.get_repository_dependency_tups_for_installed_repository( self.app, repository, status=None ) self.repository_dependencies_of_installed_repositories[ repository_tup ] = repository_dependency_tups def add_entry_to_runtime_tool_dependencies_of_installed_tool_dependencies( self, tool_dependency ): diff -r d2f73445ce7ada2f13947aa7c7c8506743d40d3f -r 9fe1a6fc375b3fad14dac271ed8f85e02fc6ef6d lib/tool_shed/util/repository_dependency_util.py --- a/lib/tool_shed/util/repository_dependency_util.py +++ b/lib/tool_shed/util/repository_dependency_util.py @@ -303,10 +303,13 @@ key_rd_dicts_to_be_processed=None, all_repository_dependencies=None, handled_key_rd_dicts=None, circular_repository_dependencies=None ): """ - Return a dictionary of all repositories upon which the contents of the received repository_metadata record depend. The dictionary keys - are name-spaced values consisting of toolshed_base_url/repository_name/repository_owner/changeset_revision and the values are lists of - repository_dependency tuples consisting of ( toolshed_base_url, repository_name, repository_owner, changeset_revision ). This method - ensures that all required repositories to the nth degree are returned. + Return a dictionary of all repositories upon which the contents of the received + repository_metadata record depend. The dictionary keys are name-spaced values + consisting of: + toolshed_base_url/repository_name/repository_owner/changeset_revision + and the values are lists of repository_dependency tuples consisting of: + ( toolshed_base_url, repository_name, repository_owner, changeset_revision ). + This method ensures that all required repositories to the nth degree are returned. """ if handled_key_rd_dicts is None: handled_key_rd_dicts = [] @@ -331,8 +334,8 @@ all_repository_dependencies = initialize_all_repository_dependencies( current_repository_key, repository_dependencies_dict, all_repository_dependencies ) - # Handle the repository dependencies defined in the current repository, if any, and populate the various repository dependency objects for - # this round of processing. + # Handle the repository dependencies defined in the current repository, if any, and populate + # the various repository dependency objects for this round of processing. current_repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts, all_repository_dependencies = \ populate_repository_dependency_objects_for_processing( trans, current_repository_key, @@ -375,10 +378,41 @@ all_repository_dependencies = prune_invalid_repository_dependencies( all_repository_dependencies ) return all_repository_dependencies -def get_repository_dependency_tups_for_repository( app, repository, dependency_tups=None, status=None ): +def get_repository_dependency_tups_from_repository_metadata( app, repository_metadata, deprecated_only=False ): + """ + Return a list of of tuples defining repository objects required by the received repository. The returned + list defines the entire repository dependency tree. This method is called only from the Tool Shed. + """ + dependency_tups = [] + if repository_metadata is not None: + metadata = repository_metadata.metadata + if metadata: + repository_dependencies_dict = metadata.get( 'repository_dependencies', None ) + if repository_dependencies_dict is not None: + repository_dependency_tups = repository_dependencies_dict.get( 'repository_dependencies', None ) + if repository_dependency_tups is not None: + # The value of repository_dependency_tups is a list of repository dependency tuples like this: + # ['http://localhost:9009', 'package_samtools_0_1_18', 'devteam', 'ef37fc635cb9', 'False', 'False'] + for repository_dependency_tup in repository_dependency_tups: + toolshed, name, owner, changeset_revision, pir, oicct = \ + common_util.parse_repository_dependency_tuple( repository_dependency_tup ) + repository = suc.get_repository_by_name_and_owner( app, name, owner ) + if repository: + if deprecated_only: + if repository.deprecated: + dependency_tups.append( repository_dependency_tup ) + else: + dependency_tups.append( repository_dependency_tup ) + else: + log.debug( "Cannot locate repository %s owned by %s for inclusion in repository dependency tups." % \ + ( name, owner ) ) + return dependency_tups + +def get_repository_dependency_tups_for_installed_repository( app, repository, dependency_tups=None, status=None ): """ Return a list of of tuples defining tool_shed_repository objects (whose status can be anything) required by the - received repository. The returned list defines the entire repository dependency tree. + received repository. The returned list defines the entire repository dependency tree. This method is called + only from Galaxy. """ if dependency_tups is None: dependency_tups = [] @@ -393,7 +427,9 @@ continue if required_repository_tup not in dependency_tups: dependency_tups.append( required_repository_tup ) - return get_repository_dependency_tups_for_repository( app, required_repository, dependency_tups=dependency_tups ) + return get_repository_dependency_tups_for_installed_repository( app, + required_repository, + dependency_tups=dependency_tups ) return dependency_tups def get_repository_tuple_for_installed_repository_manager( repository ): @@ -657,12 +693,16 @@ containers_dict[ 'missing_repository_dependencies' ] = None return containers_dict -def populate_repository_dependency_objects_for_processing( trans, current_repository_key, repository_dependencies_dict, key_rd_dicts_to_be_processed, - handled_key_rd_dicts, circular_repository_dependencies, all_repository_dependencies ): +def populate_repository_dependency_objects_for_processing( trans, current_repository_key, repository_dependencies_dict, + key_rd_dicts_to_be_processed, handled_key_rd_dicts, + circular_repository_dependencies, all_repository_dependencies ): """ - The process that discovers all repository dependencies for a specified repository's changeset revision uses this method to populate the following items - for the current processing loop: filtered_current_repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts, all_repository_dependencies. - Each processing loop may discover more repository dependencies, so this method is repeatedly called until all repository dependencies have been discovered. + The process that discovers all repository dependencies for a specified repository's + changeset revision uses this method to populate the following items for the current + processing loop: filtered_current_repository_key_rd_dicts, key_rd_dicts_to_be_processed, + handled_key_rd_dicts, all_repository_dependencies. Each processing loop may discover + more repository dependencies, so this method is repeatedly called until all repository + dependencies have been discovered. """ current_repository_key_rd_dicts = [] filtered_current_repository_key_rd_dicts = [] @@ -673,13 +713,15 @@ if current_repository_key_rd_dicts and current_repository_key: # Remove all repository dependencies that point to a revision within its own repository. current_repository_key_rd_dicts = remove_ropository_dependency_reference_to_self( current_repository_key_rd_dicts ) - current_repository_key_rd_dicts = get_updated_changeset_revisions_for_repository_dependencies( trans, current_repository_key_rd_dicts ) + current_repository_key_rd_dicts = get_updated_changeset_revisions_for_repository_dependencies( trans, + current_repository_key_rd_dicts ) for key_rd_dict in current_repository_key_rd_dicts: # Filter out repository dependencies that are required only if compiling the dependent repository's tool dependency. key_rd_dict = filter_only_if_compiling_contained_td( key_rd_dict ) if key_rd_dict: is_circular = False - if not in_key_rd_dicts( key_rd_dict, handled_key_rd_dicts ) and not in_key_rd_dicts( key_rd_dict, key_rd_dicts_to_be_processed ): + if not in_key_rd_dicts( key_rd_dict, handled_key_rd_dicts ) and not in_key_rd_dicts( key_rd_dict, + key_rd_dicts_to_be_processed ): filtered_current_repository_key_rd_dicts.append( key_rd_dict ) repository_dependency = key_rd_dict[ current_repository_key ] if current_repository_key in all_repository_dependencies: @@ -708,8 +750,10 @@ def prune_invalid_repository_dependencies( repository_dependencies ): """ - Eliminate all invalid entries in the received repository_dependencies dictionary. An entry is invalid if the value_list of the key/value pair is - empty. This occurs when an invalid combination of tool shed, name , owner, changeset_revision is used and a repository_metadata record is not found. + Eliminate all invalid entries in the received repository_dependencies dictionary. An entry + is invalid if the value_list of the key/value pair is empty. This occurs when an invalid + combination of tool shed, name , owner, changeset_revision is used and a repository_metadata + record is not found. """ valid_repository_dependencies = {} description = repository_dependencies.get( 'description', None ) @@ -752,7 +796,9 @@ toolshed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \ common_util.parse_repository_dependency_tuple( repository_dependency ) if rd_toolshed == toolshed and rd_name == name and rd_owner == owner: - log.debug( "Removing repository dependency for repository %s owned by %s since it refers to a revision within itself." % ( name, owner ) ) + debug_msg = "Removing repository dependency for repository %s owned by %s " % ( name, owner ) + debug_msg += 'since it refers to a revision within itself.' + log.debug( debug_msg ) else: new_key_rd_dict = {} new_key_rd_dict[ key ] = repository_dependency diff -r d2f73445ce7ada2f13947aa7c7c8506743d40d3f -r 9fe1a6fc375b3fad14dac271ed8f85e02fc6ef6d templates/webapps/tool_shed/common/common.mako --- a/templates/webapps/tool_shed/common/common.mako +++ b/templates/webapps/tool_shed/common/common.mako @@ -51,6 +51,23 @@ </script></%def> +<%def name="render_deprecated_repository_dependencies_message( deprecated_repository_dependency_tups )"> + <div class="warningmessage"> + <% + from tool_shed.util.common_util import parse_repository_dependency_tuple + msg = '<ul>' + for deprecated_repository_dependency_tup in deprecated_repository_dependency_tups: + toolshed, name, owner, changeset_revision, pir, oicct = \ + parse_repository_dependency_tuple( deprecated_repository_dependency_tup ) + msg += '<li>Revision <b>%s</b> of repository <b>%s</b> owned by <b>%s</b></li>' % \ + ( changeset_revision, name, owner ) + msg += '</ul>' + %> + This repository depends upon the following deprecated repositories<br/> + ${msg} + </div> +</%def> + <%def name="render_star_rating( name, rating, disabled=False )"><% if disabled: @@ -87,6 +104,20 @@ </div></%def> +<%def name="render_multiple_heads_message( heads )"> + <div class="warningmessage"> + <% + from tool_shed.util.shed_util_common import get_revision_label_from_ctx + heads_str = '' + for ctx in heads: + heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx, include_date=True ) + %> + Contact the administrator of this Tool Shed as soon as possible and let them know that + this repository has the following multiple heads which must be merged.<br/> + ${heads_str} + </div> +</%def> + <%def name="render_review_comment( comment_text )"><style type="text/css"> #reviews_table{ table-layout:fixed; diff -r d2f73445ce7ada2f13947aa7c7c8506743d40d3f -r 9fe1a6fc375b3fad14dac271ed8f85e02fc6ef6d templates/webapps/tool_shed/repository/manage_repository.mako --- a/templates/webapps/tool_shed/repository/manage_repository.mako +++ b/templates/webapps/tool_shed/repository/manage_repository.mako @@ -87,6 +87,14 @@ multiple_heads = len( heads ) > 1 else: multiple_heads = False + + if repository_metadata is None: + revision_installable = False + else: + if repository_metadata.downloadable is None: + revision_installable = 'unknown' + else: + revision_installable = repository_metadata.downloadable %><%! @@ -119,18 +127,12 @@ <div class="warningmessage"> This repository has been marked as deprecated, so some tool shed features may be restricted. </div> -%elif multiple_heads: - <div class="warningmessage"> - <% - from tool_shed.util.shed_util_common import get_revision_label_from_ctx - heads_str = '' - for ctx in heads: - heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx, include_date=True ) - %> - Contact the administrator of this Tool Shed as soon as possible and let them know that - this repository has the following multiple heads which must be merged.<br/> - ${heads_str} - </div> +%endif: +%if multiple_heads: + ${render_multiple_heads_message( heads )} +%endif +%if deprecated_repository_dependency_tups: + ${render_deprecated_repository_dependencies_message( deprecated_repository_dependency_tups )} %endif %if len( changeset_revision_select_field.options ) > 1: @@ -207,7 +209,11 @@ ${repository.user.username | h} </div><div class="form-row"> - <label>Times downloaded:</label> + <label>This revision can be installed:</label> + ${revision_installable} + </div> + <div class="form-row"> + <label>Times cloned / installed:</label> ${repository.times_downloaded | h} </div> %if is_admin: diff -r d2f73445ce7ada2f13947aa7c7c8506743d40d3f -r 9fe1a6fc375b3fad14dac271ed8f85e02fc6ef6d templates/webapps/tool_shed/repository/view_repository.mako --- a/templates/webapps/tool_shed/repository/view_repository.mako +++ b/templates/webapps/tool_shed/repository/view_repository.mako @@ -30,6 +30,14 @@ multiple_heads = len( heads ) > 1 else: multiple_heads = False + + if repository_metadata is None: + revision_installable = False + else: + if repository_metadata.downloadable is None: + revision_installable = 'unknown' + else: + revision_installable = repository_metadata.downloadable %><%! @@ -66,18 +74,12 @@ <div class="warningmessage"> This repository has been marked as deprecated, so some tool shed features may be restricted. </div> -%elif multiple_heads: - <div class="warningmessage"> - <% - from tool_shed.util.shed_util_common import get_revision_label_from_ctx - heads_str = '' - for ctx in heads: - heads_str += '%s<br/>' % get_revision_label_from_ctx( ctx, include_date=True ) - %> - Contact the administrator of this Tool Shed as soon as possible and let them know that - this repository has the following multiple heads which must be merged.<br/> - ${heads_str} - </div> +%endif: +%if multiple_heads: + ${render_multiple_heads_message( heads )} +%endif +%if deprecated_repository_dependency_tups: + ${render_deprecated_repository_dependencies_message( deprecated_repository_dependency_tups )} %endif %if len( changeset_revision_select_field.options ) > 1: @@ -142,7 +144,11 @@ ${repository.user.username | h} </div><div class="form-row"> - <label>Times downloaded:</label> + <label>This revision can be installed:</label> + ${revision_installable} + </div> + <div class="form-row"> + <label>Times cloned / installed:</label> ${repository.times_downloaded} </div> %if trans.user_is_admin(): 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.