2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/29ab5a6d75a7/ Changeset: 29ab5a6d75a7 Branch: stable User: greg Date: 2013-08-20 17:13:54 Summary: Fix for retrieving an installed tool shed repository record from the Galaxy database during installation of a repository dependency where the dependency definition defines a changeset_revision that is older than the changeset_revision associated with the installed repository. This occurs only with repositories of type tool_dependency_definition. Affected #: 4 files diff -r 6822f41bc9bb2a2bf4673d6dcdeb1939730d970f -r 29ab5a6d75a778cd4989adf881c47916607b9acb 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 @@ -1639,9 +1639,14 @@ repository = suc.get_repository_by_name_and_owner( trans.app, 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 ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) + if not repository_metadata: + # The received changeset_revision is no longer associated with metadata, so get the next changeset_revision in the repository + # changelog that is associated with metadata. + changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision=changeset_revision ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) repo_info_dict = repository_util.create_repo_info_dict( trans=trans, repository_clone_url=repository_clone_url, @@ -2138,6 +2143,25 @@ self.email_alerts_repository_grid.title = "Set email alerts for repository changes" return self.email_alerts_repository_grid( trans, **kwd ) + @web.expose + def next_installable_changeset_revision( self, trans, **kwd ): + """ + Handle a request from a Galaxy instance where the changeset_revision defined for a repository in a dependency definition file is older + than the changeset_revision associated with the installed repository. This will occur with repository's of type tool_dependency_definition, + and this scenario will occur while repository dependency hierarchies are bing installed. + """ + name = kwd.get( 'name', None ) + owner = kwd.get( 'owner', None ) + changeset_revision = kwd.get( 'changeset_revision', None ) + repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) + repo_dir = repository.repo_path( trans.app ) + repo = hg.repository( suc.get_configured_ui(), repo_dir ) + # Get the next installable changeset_revision beyond the received changeset_revision. + changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) + if changeset_revision: + return changeset_revision + return '' + @web.json def open_folder( self, trans, folder_path ): # Avoid caching @@ -2199,8 +2223,6 @@ older changeset_revsion, but later the repository was updated in the tool shed and the Galaxy admin is trying to install the latest changeset revision of the same repository instead of updating the one that was previously installed. """ - message = kwd.get( 'message', '' ) - status = kwd.get( 'status', 'done' ) name = kwd.get( 'name', None ) owner = kwd.get( 'owner', None ) changeset_revision = kwd.get( 'changeset_revision', None ) diff -r 6822f41bc9bb2a2bf4673d6dcdeb1939730d970f -r 29ab5a6d75a778cd4989adf881c47916607b9acb lib/tool_shed/galaxy_install/tool_dependencies/common_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py @@ -11,6 +11,12 @@ log = logging.getLogger( __name__ ) +def clean_tool_shed_url( base_url ): + if base_url: + protocol, base = base_url.split( '://' ) + return base.rstrip( '/' ) + return base_url + def create_env_var_dict( elem, tool_dependency_install_dir=None, tool_shed_repository_install_dir=None ): env_var_name = elem.get( 'name', 'PATH' ) env_var_action = elem.get( 'action', 'prepend_to' ) @@ -121,6 +127,7 @@ repository_owner = elem.get( 'owner', None ) changeset_revision = elem.get( 'changeset_revision', None ) if toolshed and repository_name and repository_owner and changeset_revision: + toolshed = clean_tool_shed_url( toolshed ) repository = suc.get_repository_for_dependency_relationship( app, toolshed, repository_name, repository_owner, changeset_revision ) if repository: for sub_elem in elem: diff -r 6822f41bc9bb2a2bf4673d6dcdeb1939730d970f -r 29ab5a6d75a778cd4989adf881c47916607b9acb lib/tool_shed/galaxy_install/tool_dependencies/install_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py @@ -17,10 +17,6 @@ log = logging.getLogger( __name__ ) -def clean_tool_shed_url( base_url ): - protocol, base = base_url.split( '://' ) - return base.rstrip( '/' ) - def create_temporary_tool_dependencies_config( app, tool_shed_url, name, owner, changeset_revision ): """Make a call to the tool shed to get the required repository's tool_dependencies.xml file.""" url = url_join( tool_shed_url, @@ -54,7 +50,7 @@ def get_tool_shed_repository_by_tool_shed_name_owner_changeset_revision( app, tool_shed_url, name, owner, changeset_revision ): sa_session = app.model.context.current - tool_shed = clean_tool_shed_url( tool_shed_url ) + tool_shed = common_util.clean_tool_shed_url( tool_shed_url ) tool_shed_repository = sa_session.query( app.model.ToolShedRepository ) \ .filter( and_( app.model.ToolShedRepository.table.c.tool_shed == tool_shed, app.model.ToolShedRepository.table.c.name == name, diff -r 6822f41bc9bb2a2bf4673d6dcdeb1939730d970f -r 29ab5a6d75a778cd4989adf881c47916607b9acb lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -760,6 +760,20 @@ name=name, owner=owner, changeset_revision=changeset_revision ) + if not repository: + # The received changeset_revision is no longer installable, so get the next changeset_revision in the repository's changelog in the + # tool shed that is associated with repository_metadata. + tool_shed_url = get_url_from_tool_shed( app, tool_shed ) + url = url_join( tool_shed_url, + 'repository/next_installable_changeset_revision?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s' % \ + ( url_for( '/', qualified=True ), name, owner, changeset_revision ) ) + text = common_util.tool_shed_get( app, tool_shed_url, url ) + if text: + repository = get_tool_shed_repository_by_shed_name_owner_changeset_revision( app=app, + tool_shed=tool_shed, + name=name, + owner=owner, + changeset_revision=text ) return repository def get_repository_file_contents( file_path ): https://bitbucket.org/galaxy/galaxy-central/commits/6e148e87d819/ Changeset: 6e148e87d819 User: greg Date: 2013-08-20 17:14:53 Summary: Merge with 29ab5a6d75a778cd4989adf881c47916607b9acb Affected #: 4 files diff -r c42567f43aa762a45f7eb7fc0917260edcaa5636 -r 6e148e87d81925bb0b920e9e66c87cda0bd358c5 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 @@ -1716,9 +1716,14 @@ repository = suc.get_repository_by_name_and_owner( trans.app, 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 ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) + if not repository_metadata: + # The received changeset_revision is no longer associated with metadata, so get the next changeset_revision in the repository + # changelog that is associated with metadata. + changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision=changeset_revision ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) repo_info_dict = repository_util.create_repo_info_dict( trans=trans, repository_clone_url=repository_clone_url, @@ -2215,6 +2220,25 @@ self.email_alerts_repository_grid.title = "Set email alerts for repository changes" return self.email_alerts_repository_grid( trans, **kwd ) + @web.expose + def next_installable_changeset_revision( self, trans, **kwd ): + """ + Handle a request from a Galaxy instance where the changeset_revision defined for a repository in a dependency definition file is older + than the changeset_revision associated with the installed repository. This will occur with repository's of type tool_dependency_definition, + and this scenario will occur while repository dependency hierarchies are bing installed. + """ + name = kwd.get( 'name', None ) + owner = kwd.get( 'owner', None ) + changeset_revision = kwd.get( 'changeset_revision', None ) + repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) + repo_dir = repository.repo_path( trans.app ) + repo = hg.repository( suc.get_configured_ui(), repo_dir ) + # Get the next installable changeset_revision beyond the received changeset_revision. + changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) + if changeset_revision: + return changeset_revision + return '' + @web.json def open_folder( self, trans, folder_path ): # Avoid caching @@ -2276,8 +2300,6 @@ older changeset_revsion, but later the repository was updated in the tool shed and the Galaxy admin is trying to install the latest changeset revision of the same repository instead of updating the one that was previously installed. """ - message = kwd.get( 'message', '' ) - status = kwd.get( 'status', 'done' ) name = kwd.get( 'name', None ) owner = kwd.get( 'owner', None ) changeset_revision = kwd.get( 'changeset_revision', None ) diff -r c42567f43aa762a45f7eb7fc0917260edcaa5636 -r 6e148e87d81925bb0b920e9e66c87cda0bd358c5 lib/tool_shed/galaxy_install/tool_dependencies/common_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/common_util.py @@ -12,6 +12,12 @@ log = logging.getLogger( __name__ ) +def clean_tool_shed_url( base_url ): + if base_url: + protocol, base = base_url.split( '://' ) + return base.rstrip( '/' ) + return base_url + def create_env_var_dict( elem, tool_dependency_install_dir=None, tool_shed_repository_install_dir=None ): env_var_name = elem.get( 'name', 'PATH' ) env_var_action = elem.get( 'action', 'prepend_to' ) @@ -129,6 +135,7 @@ repository_owner = elem.get( 'owner', None ) changeset_revision = elem.get( 'changeset_revision', None ) if toolshed and repository_name and repository_owner and changeset_revision: + toolshed = clean_tool_shed_url( toolshed ) repository = suc.get_repository_for_dependency_relationship( app, toolshed, repository_name, repository_owner, changeset_revision ) if repository: for sub_elem in elem: diff -r c42567f43aa762a45f7eb7fc0917260edcaa5636 -r 6e148e87d81925bb0b920e9e66c87cda0bd358c5 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py @@ -18,10 +18,6 @@ log = logging.getLogger( __name__ ) -def clean_tool_shed_url( base_url ): - protocol, base = base_url.split( '://' ) - return base.rstrip( '/' ) - def create_temporary_tool_dependencies_config( app, tool_shed_url, name, owner, changeset_revision ): """Make a call to the tool shed to get the required repository's tool_dependencies.xml file.""" url = url_join( tool_shed_url, @@ -55,7 +51,7 @@ def get_tool_shed_repository_by_tool_shed_name_owner_changeset_revision( app, tool_shed_url, name, owner, changeset_revision ): sa_session = app.model.context.current - tool_shed = clean_tool_shed_url( tool_shed_url ) + tool_shed = common_util.clean_tool_shed_url( tool_shed_url ) tool_shed_repository = sa_session.query( app.model.ToolShedRepository ) \ .filter( and_( app.model.ToolShedRepository.table.c.tool_shed == tool_shed, app.model.ToolShedRepository.table.c.name == name, diff -r c42567f43aa762a45f7eb7fc0917260edcaa5636 -r 6e148e87d81925bb0b920e9e66c87cda0bd358c5 lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -867,6 +867,20 @@ name=name, owner=owner, changeset_revision=changeset_revision ) + if not repository: + # The received changeset_revision is no longer installable, so get the next changeset_revision in the repository's changelog in the + # tool shed that is associated with repository_metadata. + tool_shed_url = get_url_from_tool_shed( app, tool_shed ) + url = url_join( tool_shed_url, + 'repository/next_installable_changeset_revision?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s' % \ + ( url_for( '/', qualified=True ), name, owner, changeset_revision ) ) + text = common_util.tool_shed_get( app, tool_shed_url, url ) + if text: + repository = get_tool_shed_repository_by_shed_name_owner_changeset_revision( app=app, + tool_shed=tool_shed, + name=name, + owner=owner, + changeset_revision=text ) return repository def get_repository_file_contents( file_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.