commit/galaxy-central: greg: Get updates to the latest changset revision and reset metadata when reinstalling an uninstalled tool shed repository in Galaxy.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/b94fbc70b5be/ changeset: b94fbc70b5be user: greg date: 2013-01-14 21:16:06 summary: Get updates to the latest changset revision and reset metadata when reinstalling an uninstalled tool shed repository in Galaxy. affected #: 2 files diff -r dc575517a5f2d3081e1795c5d5e91c77e4488bc5 -r b94fbc70b5be12b56852f811843092eeca6b2f98 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -46,9 +46,9 @@ """ for dependency_key, requirements_dict in tool_dependencies.items(): if dependency_key not in [ 'set_environment' ]: - repository_name = requirements_dict[ 'repository_name' ] - repository_owner = requirements_dict[ 'repository_owner' ] - changeset_revision = requirements_dict[ 'changeset_revision' ] + repository_name = requirements_dict.get( 'repository_name', 'unknown' ) + repository_owner = requirements_dict.get( 'repository_owner', 'unknown' ) + changeset_revision = requirements_dict.get( 'changeset_revision', 'unknown' ) dependency_name = requirements_dict[ 'name' ] version = requirements_dict[ 'version' ] type = requirements_dict[ 'type' ] diff -r dc575517a5f2d3081e1795c5d5e91c77e4488bc5 -r b94fbc70b5be12b56852f811843092eeca6b2f98 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,6 +372,26 @@ 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 + # 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: # 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', @@ -811,6 +831,7 @@ @web.require_admin def install_tool_shed_repositories( self, trans, tool_shed_repositories, reinstalling=False, **kwd ): """Install specified tool shed repositories.""" + shed_tool_conf = kwd.get( 'shed_tool_conf', '' ) tool_path = kwd[ 'tool_path' ] includes_tool_dependencies = util.string_as_bool( kwd[ 'includes_tool_dependencies' ] ) install_tool_dependencies = CheckboxField.is_checked( kwd.get( 'install_tool_dependencies', '' ) ) @@ -843,6 +864,7 @@ 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, @@ -850,7 +872,7 @@ relative_install_dir=relative_install_dir, tool_shed=tool_shed_repository.tool_shed, tool_section=tool_section, - shed_tool_conf=kwd.get( 'shed_tool_conf', '' ), + shed_tool_conf=shed_tool_conf, reinstalling=reinstalling ) trans.sa_session.refresh( tool_shed_repository ) metadata = tool_shed_repository.metadata @@ -1389,12 +1411,12 @@ repository_id=repository_id, repository_name=tool_shed_repository.name, repository_owner=tool_shed_repository.owner, - changeset_revision=tool_shed_repository.installed_changeset_revision ) + changeset_revision=tool_shed_repository.changeset_revision ) else: repository_dependencies = None repo_info_dict = suc.create_repo_info_dict( trans=trans, repository_clone_url=repository_clone_url, - changeset_revision=tool_shed_repository.installed_changeset_revision, + changeset_revision=tool_shed_repository.changeset_revision, ctx_rev=ctx_rev, repository_owner=tool_shed_repository.owner, repository_name=tool_shed_repository.name, @@ -1475,7 +1497,7 @@ repository_id=repository_id, repository_name=tool_shed_repository.name, repository_owner=tool_shed_repository.owner, - changeset_revision=tool_shed_repository.installed_changeset_revision ) + changeset_revision=tool_shed_repository.changeset_revision ) if repository_dependencies: includes_repository_dependencies = True else: @@ -1483,7 +1505,7 @@ 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.installed_changeset_revision, + changeset_revision=tool_shed_repository.changeset_revision, ctx_rev=ctx_rev, repository_owner=tool_shed_repository.owner, repository_name=tool_shed_repository.name, 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