commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/04dcd40a25ab/ Changeset: 04dcd40a25ab Branch: next-stable User: Dave Bouvier Date: 2013-05-30 19:23:16 Summary: Fix for incorrect changeset revision being selected on the preview page when installing a repository from the tool shed. Fix for exception being raised when resetting metadata on a repository that does not contain tools. Affected #: 3 files diff -r 7be69524cfaae9c56f1eb9cd77a857a9b912108c -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 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 @@ -779,7 +779,7 @@ operation = kwd[ 'operation' ].lower() if operation == "preview_tools_in_changeset": repository = suc.get_repository_in_tool_shed( trans, repository_id ) - repository_metadata = metadata_util.get_latest_repository_metadata( trans, repository.id ) + repository_metadata = metadata_util.get_latest_repository_metadata( trans, repository.id, downloadable=True ) latest_installable_changeset_revision = repository_metadata.changeset_revision return trans.response.send_redirect( web.url_for( controller='repository', action='preview_tools_in_changeset', diff -r 7be69524cfaae9c56f1eb9cd77a857a9b912108c -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -899,12 +899,15 @@ metadata_dict[ 'workflows' ] = [ ( relative_path, exported_workflow_dict ) ] return metadata_dict -def get_latest_repository_metadata( trans, decoded_repository_id ): +def get_latest_repository_metadata( trans, decoded_repository_id, downloadable=False ): """Get last metadata defined for a specified repository from the database.""" - return trans.sa_session.query( trans.model.RepositoryMetadata ) \ - .filter( trans.model.RepositoryMetadata.table.c.repository_id == decoded_repository_id ) \ - .order_by( trans.model.RepositoryMetadata.table.c.id.desc() ) \ - .first() + repository = trans.sa_session.query( trans.model.Repository ).get( decoded_repository_id ) + repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + if downloadable: + changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) + else: + changeset_revision = suc.get_latest_changeset_revision( trans, repository, repo ) + return suc.get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_revision ) def get_orphan_tool_dependencies( metadata ): """Inspect tool dependencies included in the received metadata and determine if any of them are orphans within the repository.""" @@ -1233,7 +1236,7 @@ dictionaries. The metadata contained in new_tip_metadata_dict may not be a subset of that contained in the last stored repository_metadata record associated with the received repository because one or more Galaxy utilities may have been deleted from the repository in the new tip. """ - repository_metadata = get_latest_repository_metadata( trans, repository.id ) + repository_metadata = get_latest_repository_metadata( trans, repository.id, downloadable=False ) datatypes_required = new_datatypes_metadata_required( trans, repository_metadata, new_tip_metadata_dict ) # Uncomment the following if we decide that README files should affect how installable repository revisions are defined. See the NOTE in the # compare_readme_files() method. @@ -1752,7 +1755,7 @@ suc.handle_email_alerts( trans, repository, content_alert_str='', new_repo_alert=True, admin_only=False ) else: # Update the latest stored repository metadata with the contents and attributes of metadata_dict. - repository_metadata = get_latest_repository_metadata( trans, repository.id ) + repository_metadata = get_latest_repository_metadata( trans, repository.id, downloadable=False ) if repository_metadata: downloadable = is_downloadable( metadata_dict ) # Update the last saved repository_metadata table row. diff -r 7be69524cfaae9c56f1eb9cd77a857a9b912108c -r 04dcd40a25ab0e4602c208c8d0b0f84d01a9a259 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 @@ -324,11 +324,12 @@ metadata = repository.metadata # Create a dictionary of tool guid and tool config file name for each tool in the repository. guids_and_configs = {} - for tool_dict in metadata[ 'tools' ]: - guid = tool_dict[ 'guid' ] - tool_config = tool_dict[ 'tool_config' ] - file_name = strip_path( tool_config ) - guids_and_configs[ guid ] = file_name + if 'tools' in metadata: + for tool_dict in metadata[ 'tools' ]: + guid = tool_dict[ 'guid' ] + tool_config = tool_dict[ 'tool_config' ] + file_name = strip_path( tool_config ) + guids_and_configs[ guid ] = file_name # Parse the shed_tool_conf file in which all of this repository's tools are defined and generate the tool_panel_dict. tree, error_message = xml_util.parse_xml( shed_tool_conf ) if tree is None: @@ -490,6 +491,16 @@ """Get a tool shed repository record from the Galaxy database defined by the id.""" return trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( id ) ) +def get_latest_changeset_revision( trans, repository, repo ): + repository_tip = repository.tip( trans.app ) + repository_metadata = get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), repository_tip ) + if repository_metadata and repository_metadata.downloadable: + return repository_tip + changeset_revisions = get_ordered_metadata_changeset_revisions( repository, repo, downloadable=False ) + if changeset_revisions: + return changeset_revisions[ -1 ] + return INITIAL_CHANGELOG_HASH + def get_latest_downloadable_changeset_revision( trans, repository, repo ): repository_tip = repository.tip( trans.app ) repository_metadata = get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), repository_tip ) https://bitbucket.org/galaxy/galaxy-central/commits/052c1a1080a2/ Changeset: 052c1a1080a2 User: Dave Bouvier Date: 2013-05-30 19:24:04 Summary: Merge in next-stable. Affected #: 3 files diff -r dfb77de2aff56137a6f7bf8efc7761f03fcabf6f -r 052c1a1080a2ef5812a0b25c4e65f6d437b9fa52 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 @@ -778,7 +778,7 @@ operation = kwd[ 'operation' ].lower() if operation == "preview_tools_in_changeset": repository = suc.get_repository_in_tool_shed( trans, repository_id ) - repository_metadata = metadata_util.get_latest_repository_metadata( trans, repository.id ) + repository_metadata = metadata_util.get_latest_repository_metadata( trans, repository.id, downloadable=True ) latest_installable_changeset_revision = repository_metadata.changeset_revision return trans.response.send_redirect( web.url_for( controller='repository', action='preview_tools_in_changeset', diff -r dfb77de2aff56137a6f7bf8efc7761f03fcabf6f -r 052c1a1080a2ef5812a0b25c4e65f6d437b9fa52 lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -899,12 +899,15 @@ metadata_dict[ 'workflows' ] = [ ( relative_path, exported_workflow_dict ) ] return metadata_dict -def get_latest_repository_metadata( trans, decoded_repository_id ): +def get_latest_repository_metadata( trans, decoded_repository_id, downloadable=False ): """Get last metadata defined for a specified repository from the database.""" - return trans.sa_session.query( trans.model.RepositoryMetadata ) \ - .filter( trans.model.RepositoryMetadata.table.c.repository_id == decoded_repository_id ) \ - .order_by( trans.model.RepositoryMetadata.table.c.id.desc() ) \ - .first() + repository = trans.sa_session.query( trans.model.Repository ).get( decoded_repository_id ) + repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) + if downloadable: + changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo ) + else: + changeset_revision = suc.get_latest_changeset_revision( trans, repository, repo ) + return suc.get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_revision ) def get_orphan_tool_dependencies( metadata ): """Inspect tool dependencies included in the received metadata and determine if any of them are orphans within the repository.""" @@ -1233,7 +1236,7 @@ dictionaries. The metadata contained in new_tip_metadata_dict may not be a subset of that contained in the last stored repository_metadata record associated with the received repository because one or more Galaxy utilities may have been deleted from the repository in the new tip. """ - repository_metadata = get_latest_repository_metadata( trans, repository.id ) + repository_metadata = get_latest_repository_metadata( trans, repository.id, downloadable=False ) datatypes_required = new_datatypes_metadata_required( trans, repository_metadata, new_tip_metadata_dict ) # Uncomment the following if we decide that README files should affect how installable repository revisions are defined. See the NOTE in the # compare_readme_files() method. @@ -1752,7 +1755,7 @@ suc.handle_email_alerts( trans, repository, content_alert_str='', new_repo_alert=True, admin_only=False ) else: # Update the latest stored repository metadata with the contents and attributes of metadata_dict. - repository_metadata = get_latest_repository_metadata( trans, repository.id ) + repository_metadata = get_latest_repository_metadata( trans, repository.id, downloadable=False ) if repository_metadata: downloadable = is_downloadable( metadata_dict ) # Update the last saved repository_metadata table row. diff -r dfb77de2aff56137a6f7bf8efc7761f03fcabf6f -r 052c1a1080a2ef5812a0b25c4e65f6d437b9fa52 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 @@ -324,11 +324,12 @@ metadata = repository.metadata # Create a dictionary of tool guid and tool config file name for each tool in the repository. guids_and_configs = {} - for tool_dict in metadata[ 'tools' ]: - guid = tool_dict[ 'guid' ] - tool_config = tool_dict[ 'tool_config' ] - file_name = strip_path( tool_config ) - guids_and_configs[ guid ] = file_name + if 'tools' in metadata: + for tool_dict in metadata[ 'tools' ]: + guid = tool_dict[ 'guid' ] + tool_config = tool_dict[ 'tool_config' ] + file_name = strip_path( tool_config ) + guids_and_configs[ guid ] = file_name # Parse the shed_tool_conf file in which all of this repository's tools are defined and generate the tool_panel_dict. tree, error_message = xml_util.parse_xml( shed_tool_conf ) if tree is None: @@ -490,6 +491,16 @@ """Get a tool shed repository record from the Galaxy database defined by the id.""" return trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( id ) ) +def get_latest_changeset_revision( trans, repository, repo ): + repository_tip = repository.tip( trans.app ) + repository_metadata = get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), repository_tip ) + if repository_metadata and repository_metadata.downloadable: + return repository_tip + changeset_revisions = get_ordered_metadata_changeset_revisions( repository, repo, downloadable=False ) + if changeset_revisions: + return changeset_revisions[ -1 ] + return INITIAL_CHANGELOG_HASH + def get_latest_downloadable_changeset_revision( trans, repository, repo ): repository_tip = repository.tip( trans.app ) repository_metadata = get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), repository_tip ) 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)
-
commits-noreply@bitbucket.org