mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
Merged next-stable
This commit is contained in:
@@ -137,8 +137,8 @@ class AdminToolshed( AdminGalaxy ):
|
||||
action='reselect_tool_panel_section',
|
||||
**kwd ) )
|
||||
else:
|
||||
message = "Unable to get latest revision for repository <b>%s</b> from the tool shed, so repository " % str( repository.name )
|
||||
message += "reinstallation is not possible at this time."
|
||||
message = "Unable to get latest revision for repository <b>%s</b> from " % str( repository.name )
|
||||
message += "the Tool Shed, so repository reinstallation is not possible at this time."
|
||||
status = "error"
|
||||
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
|
||||
action='browse_repositories',
|
||||
@@ -986,12 +986,15 @@ class AdminToolshed( AdminGalaxy ):
|
||||
# The Tool Shed cannot handle the get_repository_id request, so the code must be older than the
|
||||
# 04/2014 Galaxy release when it was introduced. It will be safest to error out and let the
|
||||
# Tool Shed admin update the Tool Shed to a later release.
|
||||
err_msg = 'The Tool Shed %s is running a code revision that does not ' % str( tool_shed_url)
|
||||
err_msg += 'allow updating an installed repository where the updates include newly defined repository '
|
||||
err_msg += 'or tool dependency definitions, so the repository %s cannot ' % str( repository.name )
|
||||
err_msg += 'be updated at this time. Contact the Tool Shed administrator if possible and'
|
||||
err_msg += 'ask if they can update the Tool Shed code to the latest release.'
|
||||
return trans.show_error_message( err_msg )
|
||||
message = 'The updates available for the repository <b>%s</b> ' % str( repository.name )
|
||||
message += 'include newly defined repository or tool dependency definitions, and attempting '
|
||||
message += 'to update the repository resulted in the following error. Contact the Tool Shed '
|
||||
message += 'administrator if necessary.<br/>%s' % str( e )
|
||||
status = 'error'
|
||||
return trans.response.send_redirect( web.url_for( controller='admin_toolshed',
|
||||
action='browse_repositories',
|
||||
message=message,
|
||||
status=status ) )
|
||||
changeset_revisions = updating_to_changeset_revision
|
||||
else:
|
||||
changeset_revisions = kwd.get( 'changeset_revisions', None )
|
||||
@@ -1811,7 +1814,7 @@ class AdminToolshed( AdminGalaxy ):
|
||||
"""Update a cloned repository to the latest revision possible."""
|
||||
message = kwd.get( 'message', '' )
|
||||
status = kwd.get( 'status', 'done' )
|
||||
tool_shed_url = kwd[ 'tool_shed_url' ]
|
||||
tool_shed_url = kwd.get( 'tool_shed_url', None )
|
||||
name = kwd.get( 'name', None )
|
||||
owner = kwd.get( 'owner', None )
|
||||
changeset_revision = kwd.get( 'changeset_revision', None )
|
||||
|
||||
@@ -2535,18 +2535,19 @@ class RepositoryController( BaseUIController, ratings_util.ItemRatings ):
|
||||
repository_metadata_id = trans.security.encode_id( repository_metadata.id ),
|
||||
metadata = repository_metadata.metadata
|
||||
# Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend.
|
||||
toolshed_base_url = str( web.url_for( '/', qualified=True ) ).rstrip( '/' )
|
||||
repository_dependencies = \
|
||||
repository_dependency_util.get_repository_dependencies_for_changeset_revision( trans=trans,
|
||||
repository=repository,
|
||||
repository_metadata=repository_metadata,
|
||||
toolshed_base_url=str( web.url_for( '/', qualified=True ) ).rstrip( '/' ),
|
||||
toolshed_base_url=toolshed_base_url,
|
||||
key_rd_dicts_to_be_processed=None,
|
||||
all_repository_dependencies=None,
|
||||
handled_key_rd_dicts=None )
|
||||
if metadata:
|
||||
if 'repository_dependencies' in metadata and not repository_dependencies:
|
||||
# See if we have an invalid repository dependency definition or if the repository dependency is required only for compiling the
|
||||
# repository's tool dependency.
|
||||
# See if we have an invalid repository dependency definition or if the repository dependency is required
|
||||
# only for compiling the repository's tool dependency.
|
||||
invalid = False
|
||||
repository_dependencies_dict = metadata[ 'repository_dependencies' ]
|
||||
rd_tups = repository_dependencies_dict.get( 'repository_dependencies', [] )
|
||||
|
||||
@@ -138,8 +138,8 @@ def handle_bz2( repository, uploaded_file_name ):
|
||||
|
||||
def handle_complex_repository_dependency_elem( trans, elem, sub_elem_index, sub_elem, sub_elem_altered, altered, unpopulate=False ):
|
||||
"""
|
||||
Populate or unpopulate the toolshed and changeset_revision attributes of a <repository> tag that defines a complex repository
|
||||
dependency.
|
||||
Populate or unpopulate the toolshed and changeset_revision attributes of a <repository> tag that defines
|
||||
a complex repository dependency.
|
||||
"""
|
||||
# The received sub_elem looks something like the following:
|
||||
# <repository name="package_eigen_2_0" owner="test" prior_installation_required="True" />
|
||||
@@ -153,15 +153,16 @@ def handle_complex_repository_dependency_elem( trans, elem, sub_elem_index, sub_
|
||||
altered = True
|
||||
return altered, sub_elem_altered, elem, error_message
|
||||
|
||||
def handle_directory_changes( trans, repository, full_path, filenames_in_archive, remove_repo_files_not_in_tar, new_repo_alert, commit_message,
|
||||
undesirable_dirs_removed, undesirable_files_removed ):
|
||||
def handle_directory_changes( trans, repository, full_path, filenames_in_archive, remove_repo_files_not_in_tar, new_repo_alert,
|
||||
commit_message, undesirable_dirs_removed, undesirable_files_removed ):
|
||||
repo_dir = repository.repo_path( trans.app )
|
||||
repo = hg.repository( suc.get_configured_ui(), repo_dir )
|
||||
content_alert_str = ''
|
||||
files_to_remove = []
|
||||
filenames_in_archive = [ os.path.join( full_path, name ) for name in filenames_in_archive ]
|
||||
if remove_repo_files_not_in_tar and not repository.is_new( trans.app ):
|
||||
# We have a repository that is not new (it contains files), so discover those files that are in the repository, but not in the uploaded archive.
|
||||
# We have a repository that is not new (it contains files), so discover those files that are in the
|
||||
# repository, but not in the uploaded archive.
|
||||
for root, dirs, files in os.walk( full_path ):
|
||||
if root.find( '.hg' ) < 0 and root.find( 'hgrc' ) < 0:
|
||||
for undesirable_dir in UNDESIRABLE_DIRS:
|
||||
@@ -413,9 +414,10 @@ def handle_tool_dependencies_definition( trans, tool_dependencies_config, unpopu
|
||||
# <install version="1.0">
|
||||
for actions_index, actions_elem in enumerate( package_elem ):
|
||||
if actions_elem.tag == 'actions_group':
|
||||
# Inspect all entries in the <actions_group> tag set, skipping <actions> tag sets that define os and architecture
|
||||
# attributes. We want to inspect only the last <actions> tag set contained within the <actions_group> tag set to
|
||||
# see if a complex repository dependency is defined.
|
||||
# Inspect all entries in the <actions_group> tag set, skipping <actions>
|
||||
# tag sets that define os and architecture attributes. We want to inspect
|
||||
# only the last <actions> tag set contained within the <actions_group> tag
|
||||
# set to see if a complex repository dependency is defined.
|
||||
for actions_group_index, actions_group_elem in enumerate( actions_elem ):
|
||||
if actions_group_elem.tag == 'actions':
|
||||
# Skip all actions tags that include os or architecture attributes.
|
||||
|
||||
@@ -228,11 +228,12 @@ def get_repo_info_dicts( trans, tool_shed_url, repository_id, changeset_revision
|
||||
repository = suc.get_repository_in_tool_shed( trans, repository_id )
|
||||
repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
|
||||
# Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend.
|
||||
toolshed_base_url = str( web.url_for( '/', qualified=True ) ).rstrip( '/' )
|
||||
repository_dependencies = \
|
||||
repository_dependency_util.get_repository_dependencies_for_changeset_revision( trans=trans,
|
||||
repository=repository,
|
||||
repository_metadata=repository_metadata,
|
||||
toolshed_base_url=str( web.url_for( '/', qualified=True ) ).rstrip( '/' ),
|
||||
toolshed_base_url=toolshed_base_url,
|
||||
key_rd_dicts_to_be_processed=None,
|
||||
all_repository_dependencies=None,
|
||||
handled_key_rd_dicts=None )
|
||||
|
||||
@@ -106,6 +106,8 @@ def create_repository_dependency_objects( trans, tool_path, tool_shed_url, repo_
|
||||
only those items contained in the received repo_info_dicts list will be processed.
|
||||
"""
|
||||
log.debug( "Creating repository dependency objects..." )
|
||||
# Handle secure and insecure protocol since it may change over time.
|
||||
tool_shed_url = suc.handle_tool_shed_url_protocol( trans.app, tool_shed_url )
|
||||
# The following list will be maintained within this method to contain all created or updated tool shed repositories,
|
||||
# including repository dependencies that may not be installed.
|
||||
all_created_or_updated_tool_shed_repositories = []
|
||||
@@ -293,8 +295,8 @@ def get_prior_installation_required_and_only_if_compiling_contained_td( trans, t
|
||||
|
||||
def get_repository_dependencies_for_installed_tool_shed_repository( trans, repository ):
|
||||
"""
|
||||
Send a request to the appropriate tool shed to retrieve the dictionary of repository dependencies defined for the received repository which is
|
||||
installed into Galaxy. This method is called only from Galaxy.
|
||||
Send a request to the appropriate tool shed to retrieve the dictionary of repository dependencies defined
|
||||
for the received repository which is installed into Galaxy. This method is called only from Galaxy.
|
||||
"""
|
||||
tool_shed_url = suc.get_url_from_tool_shed( trans.app, repository.tool_shed )
|
||||
url = suc.url_join( tool_shed_url,
|
||||
@@ -565,12 +567,13 @@ def handle_key_rd_dicts_for_repository( trans, current_repository_key, repositor
|
||||
key_rd_dicts_to_be_processed = remove_from_key_rd_dicts( key_rd_dict, key_rd_dicts_to_be_processed )
|
||||
else:
|
||||
# The repository is in a different tool shed, so build an url and send a request.
|
||||
error_message = "Repository dependencies are currently supported only within the same tool shed. Ignoring repository dependency definition "
|
||||
error_message = "Repository dependencies are currently supported only within the same Tool Shed. Ignoring repository dependency definition "
|
||||
error_message += "for tool shed %s, name %s, owner %s, changeset revision %s" % ( toolshed, name, owner, changeset_revision )
|
||||
log.debug( error_message )
|
||||
return toolshed, required_repository, required_repository_metadata, repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts
|
||||
|
||||
def handle_next_repository_dependency( trans, key_rd_dicts_to_be_processed, all_repository_dependencies, handled_key_rd_dicts, circular_repository_dependencies ):
|
||||
def handle_next_repository_dependency( trans, key_rd_dicts_to_be_processed, all_repository_dependencies, handled_key_rd_dicts,
|
||||
circular_repository_dependencies ):
|
||||
next_repository_key_rd_dict = key_rd_dicts_to_be_processed.pop( 0 )
|
||||
next_repository_key_rd_dicts = [ next_repository_key_rd_dict ]
|
||||
next_repository_key = next_repository_key_rd_dict.keys()[ 0 ]
|
||||
|
||||
@@ -1341,9 +1341,7 @@ def get_tool_shed_repository_by_shed_name_owner_changeset_revision( app, tool_sh
|
||||
"""
|
||||
# This method is used only in Galaxy, not the tool shed.
|
||||
repository_query = __repository_query( app )
|
||||
if tool_shed.find( '//' ) > 0:
|
||||
tool_shed = tool_shed.split( '//' )[1]
|
||||
tool_shed = tool_shed.rstrip( '/' )
|
||||
tool_shed = remove_protocol_from_tool_shed_url( tool_shed )
|
||||
return repository_query \
|
||||
.filter( and_( app.install_model.ToolShedRepository.table.c.tool_shed == tool_shed,
|
||||
app.install_model.ToolShedRepository.table.c.name == name,
|
||||
@@ -1597,6 +1595,12 @@ def handle_galaxy_url( trans, **kwd ):
|
||||
galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' )
|
||||
return galaxy_url
|
||||
|
||||
def handle_tool_shed_url_protocol( app, tool_shed_url ):
|
||||
"""Handle secure and insecure HTTP protocol since they may change over time."""
|
||||
tool_shed_url = remove_protocol_from_tool_shed_url( tool_shed_url )
|
||||
tool_shed_url = get_url_from_tool_shed( app, tool_shed_url )
|
||||
return tool_shed_url
|
||||
|
||||
def have_shed_tool_conf_for_install( trans ):
|
||||
if not trans.app.toolbox.shed_tool_confs:
|
||||
return False
|
||||
@@ -1653,6 +1657,12 @@ def remove_file( file_name ):
|
||||
except:
|
||||
pass
|
||||
|
||||
def remove_protocol_from_tool_shed_url( tool_shed_url ):
|
||||
if tool_shed_url.find( '//' ) > 0:
|
||||
tool_shed_url = tool_shed_url.split( '//' )[1]
|
||||
tool_shed_url = tool_shed_url.rstrip( '/' )
|
||||
return tool_shed_url
|
||||
|
||||
def __repository_query( app ):
|
||||
if app.name == "galaxy":
|
||||
query = app.install_model.context.query( app.install_model.ToolShedRepository )
|
||||
|
||||
Reference in New Issue
Block a user