1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/76a8795d3a7e/ changeset: 76a8795d3a7e user: greg date: 2013-01-14 23:15:46 summary: Fixes for discovering repository dependencies when resinstalling a tool shed repository when the repository dependencies were added to updated revisions of a repository after it was uninstalled. affected #: 3 files diff -r b94fbc70b5be12b56852f811843092eeca6b2f98 -r 76a8795d3a7e2c662be4eab0d7f94d1d49de853a lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -952,12 +952,16 @@ update_dict = encoding_util.tool_shed_decode( encoded_update_dict ) changeset_revision = update_dict[ 'changeset_revision' ] ctx_rev = update_dict[ 'ctx_rev' ] + includes_tools = update_dict.get( 'includes_tools', False ) + has_repository_dependencies = update_dict.get( 'has_repository_dependencies', False ) response.close() except Exception, e: log.debug( "Error getting change set revision for update from the tool shed for repository '%s': %s" % ( repository.name, str( e ) ) ) + includes_tools = False + has_repository_dependencies = False changeset_revision = None ctx_rev = None - return changeset_revision, ctx_rev + return changeset_revision, ctx_rev, includes_tools, has_repository_dependencies def handle_missing_data_table_entry( app, relative_install_dir, tool_path, repository_tools_tups ): """ Inspect each tool to see if any have input parameters that are dynamically generated select lists that require entries in the diff -r b94fbc70b5be12b56852f811843092eeca6b2f98 -r 76a8795d3a7e2c662be4eab0d7f94d1d49de853a lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -1256,6 +1256,21 @@ @web.expose def get_changeset_revision_and_ctx_rev( self, trans, **kwd ): """Handle a request from a local Galaxy instance to retrieve the changeset revision hash to which an installed repository can be updated.""" + def has_tools_and_repository_dependencies( repository_metadata ): + includes_tools = False + has_repository_dependencies = False + if repository_metadata: + metadata = repository_metadata.metadata + if metadata: + if 'tools' in metadata: + includes_tools = True + else: + includes_tools = False + if 'repository_dependencies' in metadata: + has_repository_dependencies = True + else: + has_repository_dependencies = False + return includes_tools, has_repository_dependencies params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) @@ -1264,20 +1279,24 @@ owner = params.get( 'owner', None ) changeset_revision = params.get( 'changeset_revision', None ) repository = suc.get_repository_by_name_and_owner( trans, name, owner ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, + trans.security.encode_id( repository.id ), + changeset_revision ) + includes_tools, has_repository_dependencies = has_tools_and_repository_dependencies( repository_metadata ) repo_dir = repository.repo_path( trans.app ) repo = hg.repository( suc.get_configured_ui(), repo_dir ) # Default to the received changeset revision and ctx_rev. update_to_ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) ctx_rev = str( update_to_ctx.rev() ) latest_changeset_revision = changeset_revision - update_dict = dict( changeset_revision=changeset_revision, ctx_rev=ctx_rev ) + update_dict = dict( changeset_revision=changeset_revision, + ctx_rev=ctx_rev, + includes_tools=includes_tools, + has_repository_dependencies=has_repository_dependencies ) if changeset_revision == repository.tip( trans.app ): # If changeset_revision is the repository tip, there are no additional updates. return encoding_util.tool_shed_encode( update_dict ) else: - repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, - trans.security.encode_id( repository.id ), - changeset_revision ) if repository_metadata: # If changeset_revision is in the repository_metadata table for this repository, there are no additional updates. return encoding_util.tool_shed_encode( update_dict ) @@ -1286,10 +1305,16 @@ # repository was installed. We need to find the changeset_revision to which we need to update. update_to_changeset_hash = None for changeset in repo.changelog: + includes_tools = False + has_repository_dependencies = False changeset_hash = str( repo.changectx( changeset ) ) ctx = suc.get_changectx_for_changeset( repo, changeset_hash ) if update_to_changeset_hash: - if suc.get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_hash ): + update_to_repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, + trans.security.encode_id( repository.id ), + changeset_hash ) + if update_to_repository_metadata: + includes_tools, has_repository_dependencies = has_tools_and_repository_dependencies( update_to_repository_metadata ) # We found a RepositoryMetadata record. if changeset_hash == repository.tip( trans.app ): # The current ctx is the repository tip, so use it. @@ -1302,6 +1327,8 @@ elif not update_to_changeset_hash and changeset_hash == changeset_revision: # We've found the changeset in the changelog for which we need to get the next update. update_to_changeset_hash = changeset_hash + update_dict[ 'includes_tools' ] = includes_tools + update_dict[ 'has_repository_dependencies' ] = has_repository_dependencies update_dict[ 'changeset_revision' ] = str( latest_changeset_revision ) update_dict[ 'ctx_rev' ] = str( update_to_ctx.rev() ) return encoding_util.tool_shed_encode( update_dict ) diff -r b94fbc70b5be12b56852f811843092eeca6b2f98 -r 76a8795d3a7e2c662be4eab0d7f94d1d49de853a 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 @@ -372,27 +372,15 @@ if operation == "activate or reinstall": repository = suc.get_installed_tool_shed_repository( trans, kwd[ 'id' ] ) if repository.uninstalled: - # Since we're reinstalling the repository we need to find the latest changeset revision to which is can be updated so that we + # 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. - current_changeset_revision, current_ctx_rev = shed_util.get_update_to_changeset_revision_and_ctx_rev( trans, repository ) - if current_ctx_rev != repository.ctx_rev: - repo = hg.repository( suc.get_configured_ui(), path=os.path.abspath( repository.repo_path( trans.app ) ) ) - repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, repository ) - shed_util.pull_repository( repo, repository_clone_url, current_changeset_revision ) - suc.update_repository( repo, ctx_rev=current_ctx_rev ) - shed_tool_conf, tool_path, relative_install_dir = suc.get_tool_panel_config_tool_path_install_dir( trans.app, repository ) - shed_config_dict = trans.app.toolbox.get_shed_config_dict_by_filename( shed_tool_conf ) - metadata_dict, invalid_file_tups = suc.generate_metadata_for_changeset_revision( app=trans.app, - repository=repository, - repository_clone_url=repository_clone_url, - shed_config_dict=shed_config_dict, - relative_install_dir=relative_install_dir, - repository_files_dir=None, - resetting_all_metadata_on_repository=False, - updating_installed_repository=True, - persist=True ) - if repository.includes_tools or repository.has_repository_dependencies: + 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', @@ -859,12 +847,12 @@ if cloned_ok: if reinstalling: # Since we're reinstalling the repository we need to find the latest changeset revision to which is can be updated. - current_changeset_revision, current_ctx_rev = shed_util.get_update_to_changeset_revision_and_ctx_rev( trans, tool_shed_repository ) + current_changeset_revision, current_ctx_rev, includes_tools, has_repository_dependencies = \ + shed_util.get_update_to_changeset_revision_and_ctx_rev( trans, tool_shed_repository ) if current_ctx_rev != ctx_rev: repo = hg.repository( suc.get_configured_ui(), path=os.path.abspath( install_dir ) ) shed_util.pull_repository( repo, repository_clone_url, current_changeset_revision ) suc.update_repository( repo, ctx_rev=current_ctx_rev ) - self.handle_repository_contents( trans, tool_shed_repository=tool_shed_repository, tool_path=tool_path, 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.