1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/dad76985fc57/
changeset: dad76985fc57
user: greg
date: 2012-12-12 20:58:13
summary: Fix for rendering the repository dependencies container.
affected #: 1 file
diff -r 3301ed8fea42b1067f88138573b7d716c3b631e5 -r dad76985fc571feed65cc63de37b2685312348e3 lib/galaxy/webapps/community/util/container_util.py
--- a/lib/galaxy/webapps/community/util/container_util.py
+++ b/lib/galaxy/webapps/community/util/container_util.py
@@ -214,6 +214,7 @@
del repository_dependencies[ 'description' ]
repository_dependencies_folder, folder_id, repository_dependency_id = \
populate_repository_dependencies_container( repository_dependencies_folder, repository_dependencies, folder_id, repository_dependency_id )
+ repository_dependencies_folder = prune_repository_dependencies( repository_dependencies_folder )
else:
repository_dependencies_root_folder = None
return folder_id, repository_dependencies_root_folder
@@ -346,6 +347,10 @@
workflows_root_folder = None
return folder_id, workflows_root_folder
def cast_empty_repository_dependency_folders( folder, repository_dependency_id ):
+ """
+ Change any empty folders contained within the repository dependencies container into a repository dependency since it has no repository dependencies
+ of it's own. This method is not used (and may not be needed), but here it is just in case.
+ """
if not folder.folders and not folder.repository_dependencies:
repository_dependency_id += 1
repository_dependency = folder.to_repository_dependency( repository_dependency_id )
@@ -439,4 +444,20 @@
print ' %s%s' % ( pad_str, repository_dependency.listify )
for sub_folder in folder.folders:
print_folders( pad+5, sub_folder )
+def prune_repository_dependencies( folder ):
+ """
+ Since the object used to generate a repository dependencies container is a dictionary and not an odict() (it must be json-serialize-able), the
+ order in which the dictionary is processed to create the container sometimes results in repository dependency entries in a folder that also
+ includes the repository dependency as a sub-folder (if the repository dependency has it's own repository dependency). This method will remove
+ all repository dependencies from folder that are also sub-folders of folder.
+ """
+ repository_dependencies = [ rd for rd in folder.repository_dependencies ]
+ for repository_dependency in repository_dependencies:
+ listified_repository_dependency = repository_dependency.listify
+ if is_subfolder_of( folder, listified_repository_dependency ):
+ repository_dependencies.remove( repository_dependency )
+ folder.repository_dependencies = repository_dependencies
+ for sub_folder in folder.folders:
+ return prune_repository_dependencies( sub_folder )
+ return folder
\ No newline at end of file
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/3301ed8fea42/
changeset: 3301ed8fea42
user: greg
date: 2012-12-12 20:35:12
summary: Fixes for installing tool shed repositories.
affected #: 8 files
diff -r c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -636,9 +636,6 @@
relative_install_dir = os.path.join( tool_path, partial_install_dir )
return tool_path, relative_install_dir
return None, None
-def get_tool_shed_from_clone_url( repository_clone_url ):
- tmp_url = clean_repository_clone_url( repository_clone_url )
- return tmp_url.split( 'repos' )[ 0 ].rstrip( '/' )
def get_tool_shed_repository_by_shed_name_owner_changeset_revision( app, tool_shed, name, owner, changeset_revision ):
# This method is used only in Galaxy, not the tool shed.
sa_session = app.model.context.current
@@ -693,18 +690,6 @@
changeset_revision = None
ctx_rev = None
return changeset_revision, ctx_rev
-def get_url_from_repository_tool_shed( app, repository ):
- """
- The stored value of repository.tool_shed is something like: toolshed.g2.bx.psu.edu. We need the URL to this tool shed, which is
- something like: http://toolshed.g2.bx.psu.edu/.
- """
- for shed_name, shed_url in app.tool_shed_registry.tool_sheds.items():
- if shed_url.find( repository.tool_shed ) >= 0:
- if shed_url.endswith( '/' ):
- shed_url = shed_url.rstrip( '/' )
- return shed_url
- # The tool shed from which the repository was originally installed must no longer be configured in tool_sheds_conf.xml.
- return None
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 c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 lib/galaxy/util/shed_util_common.py
--- a/lib/galaxy/util/shed_util_common.py
+++ b/lib/galaxy/util/shed_util_common.py
@@ -1,4 +1,4 @@
-import os, shutil, tempfile, logging, string, threading
+import os, shutil, tempfile, logging, string, threading, urllib2
from galaxy import util
from galaxy.tools import parameters
from galaxy.util import inflector
@@ -91,12 +91,12 @@
folder_id, readme_files_root_folder = build_readme_files_folder( folder_id, readme_files_dict )
containers_dict[ 'readme_files' ] = readme_files_root_folder
if repository_dependencies:
- folder_id, repository_dependencies_root_folder = build_repository_dependencies_folder( toolshed_base_url=toolshed_base_url,
- repository_name=repository_name,
- repository_owner=repository_owner,
- changeset_revision=changeset_revision,
- folder_id=folder_id,
- repository_dependencies=repository_dependencies )
+ folder_id, repository_dependencies_root_folder = container_util.build_repository_dependencies_folder( toolshed_base_url=toolshed_base_url,
+ repository_name=repository_name,
+ repository_owner=repository_owner,
+ changeset_revision=changeset_revision,
+ folder_id=folder_id,
+ repository_dependencies=repository_dependencies )
containers_dict[ 'repository_dependencies' ] = repository_dependencies_root_folder
if tool_dependencies:
folder_id, tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( folder_id, tool_dependencies, for_galaxy=True )
@@ -526,42 +526,44 @@
trans.sa_session.add( repository_metadata )
trans.sa_session.flush()
return repository_metadata
-def create_repo_info_dict( trans, repo, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_name=None,
- repository=None, repository_metadata=None ):
+def create_repo_info_dict( trans, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_name=None, repository=None,
+ repository_metadata=None, metadata=None, repository_dependencies=None ):
"""
- Return a dictionary that includes all of the information needed to install a repository into a local Galaxy instance. The dictionary will also contain
- the recursive list of repository dependencies defined for the repository, as well as the defined tool dependencies. This method is called during the
- tool shed repository installation process from Galaxy. In this case both the received repository and repository_metadata will be objects, but repository_name
- sill be None. This method is also called when a tool shed repository that was uninstalled from a Galaxy instance is being re-installed. In this case, both
- repository and repository_metadata will be None, but repository_name will have a value.
+ Return a dictionary that includes all of the information needed to install a repository into a local Galaxy instance. The dictionary will also
+ contain the recursive list of repository dependencies defined for the repository, as well as the defined tool dependencies.
+
+ This method is called from Galaxy from two places:
+ 1. During the tool shed repository installation process (via the tool shed's get_repository_information() method)- in this case both the received
+ repository and repository_metadata will be objects.
+ 2. When a tool shed repository that was uninstalled from a Galaxy instance is being re-installed - in this case, both repository and
+ repository_metadata will be None, but metadata will be the tool_shed_repository metadata on the Galaxy side, and the repository_dependencies will
+ be an object previously retrieved from the tool shed.
"""
repo_info_dict = {}
- if repository is None and repository_metadata is None:
- # The repository associated with the received repository_clone_url is being re-installed into a Galaxy instance, so we need to retrieve the
- # appropriate repository from the tool shed using the received information.
- repository = get_repository_by_name_and_owner( trans, repository_name, repository_owner )
+ repository = get_repository_by_name_and_owner( trans, repository_name, repository_owner )
+ if trans.webapp.name == 'community':
+ # We're in the tool shed.
repository_metadata = get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_revision )
- if repository_metadata:
- metadata = repository_metadata.metadata
- if metadata:
- # Get a dictionary of all repositories upon which the contents of the received repository depends.
- repository_dependencies = get_repository_dependencies_for_changeset_revision( trans=trans,
- repo=repo,
- repository=repository,
- repository_metadata=repository_metadata,
- toolshed_base_url=str( url_for( '/', qualified=True ) ).rstrip( '/' ),
- key_rd_dicts_to_be_processed=None,
- all_repository_dependencies=None,
- handled_key_rd_dicts=None,
- circular_repository_dependencies=None )
- # Cast unicode to string.
- repo_info_dict[ str( repository.name ) ] = ( str( repository.description ),
- str( repository_clone_url ),
- str( changeset_revision ),
- str( ctx_rev ),
- str( repository_owner ),
- repository_dependencies,
- metadata.get( 'tool_dependencies', None ) )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ if metadata:
+ # Get a dictionary of all repositories upon which the contents of the received repository depends.
+ repository_dependencies = get_repository_dependencies_for_changeset_revision( trans=trans,
+ repository=repository,
+ repository_metadata=repository_metadata,
+ toolshed_base_url=str( url_for( '/', qualified=True ) ).rstrip( '/' ),
+ key_rd_dicts_to_be_processed=None,
+ all_repository_dependencies=None,
+ handled_key_rd_dicts=None,
+ circular_repository_dependencies=None )
+ # Cast unicode to string.
+ repo_info_dict[ str( repository.name ) ] = ( str( repository.description ),
+ str( repository_clone_url ),
+ str( changeset_revision ),
+ str( ctx_rev ),
+ str( repository_owner ),
+ repository_dependencies,
+ metadata.get( 'tool_dependencies', None ) )
return repo_info_dict
def generate_clone_url_for_repository_in_tool_shed( trans, repository ):
"""Generate the URL for cloning a repository that is in the tool shed."""
@@ -1189,12 +1191,18 @@
return valid_filenames
def get_repository_by_name_and_owner( trans, name, owner ):
"""Get a repository from the database via name and owner"""
+ if trans.webapp.name == 'galaxy':
+ return trans.sa_session.query( trans.model.ToolShedRepository ) \
+ .filter( and_( trans.model.ToolShedRepository.table.c.name == name,
+ trans.model.ToolShedRepository.table.c.owner == owner ) ) \
+ .first()
+ # We're in the tool shed.
user = get_user_by_username( trans, owner )
return trans.sa_session.query( trans.model.Repository ) \
.filter( and_( trans.model.Repository.table.c.name == name,
trans.model.Repository.table.c.user_id == user.id ) ) \
.first()
-def get_repository_dependencies_for_changeset_revision( trans, repo, repository, repository_metadata, toolshed_base_url,
+def get_repository_dependencies_for_changeset_revision( trans, repository, repository_metadata, toolshed_base_url,
key_rd_dicts_to_be_processed=None, all_repository_dependencies=None,
handled_key_rd_dicts=None, circular_repository_dependencies=None ):
"""
@@ -1291,7 +1299,7 @@
"""Get a repository on the tool shed side from the database via id"""
return trans.sa_session.query( trans.model.Repository ).get( trans.security.decode_id( id ) )
def get_repository_metadata_by_changeset_revision( trans, id, changeset_revision ):
- """Get metadata for a specified repository change set from the database"""
+ """Get metadata for a specified repository change set from the database."""
# Make sure there are no duplicate records, and return the single unique record for the changeset_revision. Duplicate records were somehow
# created in the past. The cause of this issue has been resolved, but we'll leave this method as is for a while longer to ensure all duplicate
# records are removed.
@@ -1357,6 +1365,9 @@
relative_path_to_sample_file = relative_path_to_sample_file[ len( tool_path ) + 1 :]
sample_file_metadata_paths.append( relative_path_to_sample_file )
return sample_file_metadata_paths, sample_file_copy_paths
+def get_tool_shed_from_clone_url( repository_clone_url ):
+ tmp_url = clean_repository_clone_url( repository_clone_url )
+ return tmp_url.split( 'repos' )[ 0 ].rstrip( '/' )
def get_updated_changeset_revisions_for_repository_dependencies( trans, key_rd_dicts ):
updated_key_rd_dicts = []
for key_rd_dict in key_rd_dicts:
@@ -1387,6 +1398,18 @@
# We have the updated changset revision.
updated_key_rd_dicts.append( new_key_rd_dict )
return updated_key_rd_dicts
+def get_url_from_repository_tool_shed( app, repository ):
+ """
+ The stored value of repository.tool_shed is something like: toolshed.g2.bx.psu.edu. We need the URL to this tool shed, which is
+ something like: http://toolshed.g2.bx.psu.edu/.
+ """
+ for shed_name, shed_url in app.tool_shed_registry.tool_sheds.items():
+ if shed_url.find( repository.tool_shed ) >= 0:
+ if shed_url.endswith( '/' ):
+ shed_url = shed_url.rstrip( '/' )
+ return shed_url
+ # The tool shed from which the repository was originally installed must no longer be configured in tool_sheds_conf.xml.
+ return None
def get_user_by_username( trans, username ):
"""Get a user from the database by username"""
return trans.sa_session.query( trans.model.User ) \
@@ -1412,7 +1435,7 @@
new_key_rd_dict[ current_repository_key ] = rd_copy
current_repository_key_rd_dicts.append( new_key_rd_dict )
if current_repository_key_rd_dicts:
- toolshed, required_repo, required_repository, required_repository_metadata, repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts = \
+ toolshed, required_repository, required_repository_metadata, repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts = \
handle_key_rd_dicts_for_repository( trans,
current_repository_key,
current_repository_key_rd_dicts,
@@ -1420,7 +1443,6 @@
handled_key_rd_dicts,
circular_repository_dependencies )
return get_repository_dependencies_for_changeset_revision( trans=trans,
- repo=required_repo,
repository=required_repository,
repository_metadata=required_repository_metadata,
toolshed_base_url=toolshed,
@@ -1456,8 +1478,6 @@
trans.security.encode_id( required_repository.id ),
changeset_revision )
if required_repository_metadata:
- required_repo_dir = required_repository.repo_path( trans.app )
- required_repo = hg.repository( get_configured_ui(), required_repo_dir )
# The required_repository_metadata changeset_revision is installable.
required_metadata = required_repository_metadata.metadata
if required_metadata:
@@ -1475,12 +1495,12 @@
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_repo, required_repository, required_repository_metadata, repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts
+ 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 ):
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 ]
- toolshed, required_repo, required_repository, required_repository_metadata, repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts = \
+ toolshed, required_repository, required_repository_metadata, repository_key_rd_dicts, key_rd_dicts_to_be_processed, handled_key_rd_dicts = \
handle_key_rd_dicts_for_repository( trans,
next_repository_key,
next_repository_key_rd_dicts,
@@ -1488,7 +1508,6 @@
handled_key_rd_dicts,
circular_repository_dependencies )
return get_repository_dependencies_for_changeset_revision( trans=trans,
- repo=required_repo,
repository=required_repository,
repository_metadata=required_repository_metadata,
toolshed_base_url=toolshed,
diff -r c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -1243,6 +1243,58 @@
message=message,
status=status )
@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."""
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ galaxy_url = kwd.get( 'galaxy_url', '' )
+ name = params.get( 'name', None )
+ owner = params.get( 'owner', None )
+ changeset_revision = params.get( 'changeset_revision', None )
+ repository = get_repository_by_name_and_owner( trans, name, owner )
+ repo_dir = repository.repo_path( trans.app )
+ repo = hg.repository( get_configured_ui(), repo_dir )
+ # Default to the received changeset revision and ctx_rev.
+ update_to_ctx = 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 )
+ if changeset_revision == repository.tip( trans.app ):
+ # If changeset_revision is the repository tip, there are no additional updates.
+ return tool_shed_encode( update_dict )
+ else:
+ repository_metadata = 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 tool_shed_encode( update_dict )
+ else:
+ # The changeset_revision column in the repository_metadata table has been updated with a new changeset_revision value since the
+ # 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:
+ changeset_hash = str( repo.changectx( changeset ) )
+ ctx = get_changectx_for_changeset( repo, changeset_hash )
+ if update_to_changeset_hash:
+ if get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_hash ):
+ # We found a RepositoryMetadata record.
+ if changeset_hash == repository.tip( trans.app ):
+ # The current ctx is the repository tip, so use it.
+ update_to_ctx = get_changectx_for_changeset( repo, changeset_hash )
+ latest_changeset_revision = changeset_hash
+ else:
+ update_to_ctx = get_changectx_for_changeset( repo, update_to_changeset_hash )
+ latest_changeset_revision = update_to_changeset_hash
+ break
+ 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[ 'changeset_revision' ] = str( latest_changeset_revision )
+ update_dict[ 'ctx_rev' ] = str( update_to_ctx.rev() )
+ return tool_shed_encode( update_dict )
+ @web.expose
def get_ctx_rev( self, trans, **kwd ):
"""Given a repository and changeset_revision, return the correct ctx.rev() value."""
repository_name = kwd[ 'name' ]
@@ -1274,6 +1326,30 @@
return repository_metadata.metadata
return None
@web.json
+ def get_repository_dependencies( self, trans, **kwd ):
+ params = util.Params( kwd )
+ name = params.get( 'name', None )
+ owner = params.get( 'owner', None )
+ changeset_revision = params.get( 'changeset_revision', None )
+ repository = get_repository_by_name_and_owner( trans, name, owner )
+ repository_id = trans.security.encode_id( repository.id )
+ repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ if metadata:
+ # Get a dictionary of all repositories upon which the contents of the received repository depends.
+ repository_dependencies = get_repository_dependencies_for_changeset_revision( trans=trans,
+ repository=repository,
+ repository_metadata=repository_metadata,
+ toolshed_base_url=str( url_for( '/', qualified=True ) ).rstrip( '/' ),
+ key_rd_dicts_to_be_processed=None,
+ all_repository_dependencies=None,
+ handled_key_rd_dicts=None,
+ circular_repository_dependencies=None )
+ if repository_dependencies:
+ return tool_shed_encode( repository_dependencies )
+ return ''
+ @web.json
def get_repository_information( self, trans, repository_ids, changeset_revisions, **kwd ):
"""
Generate a list of dictionaries, each of which contains the information about a repository that will be necessary for installing
@@ -1299,13 +1375,13 @@
repo = hg.repository( get_configured_ui(), repo_dir )
ctx = get_changectx_for_changeset( repo, changeset_revision )
repo_info_dict = create_repo_info_dict( trans=trans,
- repo=repo,
repository_clone_url=repository_clone_url,
changeset_revision=changeset_revision,
ctx_rev=str( ctx.rev() ),
repository_owner=repository.user.username,
- repository_name=None,
+ repository_name=repository.name,
repository=repository,
+ metadata=None,
repository_metadata=repository_metadata )
repo_info_dicts.append( tool_shed_encode( repo_info_dict ) )
return dict( includes_tools=includes_tools,
@@ -1370,58 +1446,6 @@
if tool_version_dicts:
return to_json_string( tool_version_dicts )
return ''
- @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."""
- params = util.Params( kwd )
- message = util.restore_text( params.get( 'message', '' ) )
- status = params.get( 'status', 'done' )
- galaxy_url = kwd.get( 'galaxy_url', '' )
- name = params.get( 'name', None )
- owner = params.get( 'owner', None )
- changeset_revision = params.get( 'changeset_revision', None )
- repository = get_repository_by_name_and_owner( trans, name, owner )
- repo_dir = repository.repo_path( trans.app )
- repo = hg.repository( get_configured_ui(), repo_dir )
- # Default to the received changeset revision and ctx_rev.
- update_to_ctx = 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 )
- if changeset_revision == repository.tip( trans.app ):
- # If changeset_revision is the repository tip, there are no additional updates.
- return tool_shed_encode( update_dict )
- else:
- repository_metadata = 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 tool_shed_encode( update_dict )
- else:
- # The changeset_revision column in the repository_metadata table has been updated with a new changeset_revision value since the
- # 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:
- changeset_hash = str( repo.changectx( changeset ) )
- ctx = get_changectx_for_changeset( repo, changeset_hash )
- if update_to_changeset_hash:
- if get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_hash ):
- # We found a RepositoryMetadata record.
- if changeset_hash == repository.tip( trans.app ):
- # The current ctx is the repository tip, so use it.
- update_to_ctx = get_changectx_for_changeset( repo, changeset_hash )
- latest_changeset_revision = changeset_hash
- else:
- update_to_ctx = get_changectx_for_changeset( repo, update_to_changeset_hash )
- latest_changeset_revision = update_to_changeset_hash
- break
- 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[ 'changeset_revision' ] = str( latest_changeset_revision )
- update_dict[ 'ctx_rev' ] = str( update_to_ctx.rev() )
- return tool_shed_encode( update_dict )
def get_versions_of_tool( self, trans, repository, repository_metadata, guid ):
"""Return the tool lineage in descendant order for the received guid contained in the received repsitory_metadata.tool_versions."""
encoded_id = trans.security.encode_id( repository.id )
@@ -1783,7 +1807,6 @@
if repository_metadata:
# Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend.
repository_dependencies = get_repository_dependencies_for_changeset_revision( trans=trans,
- repo=repo,
repository=repository,
repository_metadata=repository_metadata,
toolshed_base_url=str( url_for( '/', qualified=True ) ).rstrip( '/' ),
@@ -1896,7 +1919,6 @@
metadata = repository_metadata.metadata
# Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend.
repository_dependencies = get_repository_dependencies_for_changeset_revision( trans=trans,
- repo=repo,
repository=repository,
repository_metadata=repository_metadata,
toolshed_base_url=str( url_for( '/', qualified=True ) ).rstrip( '/' ),
@@ -2418,7 +2440,6 @@
metadata = repository_metadata.metadata
# Get a dictionary of all repositories upon which the contents of the current repository_metadata record depend.
repository_dependencies = get_repository_dependencies_for_changeset_revision( trans=trans,
- repo=repo,
repository=repository,
repository_metadata=repository_metadata,
toolshed_base_url=str( url_for( '/', qualified=True ) ).rstrip( '/' ),
diff -r c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 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
@@ -561,6 +561,28 @@
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
return get_repository_file_contents( file_path )
+ @web.expose
+ @web.require_admin
+ def get_repository_dependencies( self, trans, repository_id, repository_name, repository_owner, changeset_revision ):
+ """
+ Send a request to the appropriate tool shed to retrieve the dictionary of repository dependencies defined for the received repository
+ name, owner and changeset revision. The received repository_id is the encoded id of the installed tool shed repository in Galaxy. We
+ need it so that we can derive the tool shed from which it was installed.
+ """
+ repository = get_installed_tool_shed_repository( trans, repository_id )
+ tool_shed_url = get_url_from_repository_tool_shed( trans.app, repository )
+ url = url_join( tool_shed_url,
+ 'repository/get_repository_dependencies?name=%s&owner=%s&changeset_revision=%s' % \
+ ( repository_name, repository_owner, changeset_revision ) )
+ response = urllib2.urlopen( url )
+ raw_text = response.read()
+ response.close()
+ if len( raw_text ) > 2:
+ text = json.from_json_string( tool_shed_decode( raw_text ) )
+ log.debug( text )
+ else:
+ text = ''
+ return text
def get_versions_of_tool( self, app, guid ):
tool_version = get_tool_version( app, guid )
return tool_version.get_version_ids( app, reverse=True )
@@ -1348,17 +1370,24 @@
repo_info_dict = kwd.get( 'repo_info_dict', None )
# The repo_info_dict should be encoded.
if not repo_info_dict:
- # This should only happen if the tool_shed_repository does not include any valid tools.
+ # Entering this if block used to happen only if the tool_shed_repository does not include any valid tools. After repository dependencies
+ # were introduced, it may never happen, but will keep the block just in case.
+ repository_dependencies = self.get_repository_dependencies( trans=trans,
+ repository_id=repository_id,
+ repository_name=tool_shed_repository.name,
+ repository_owner=tool_shed_repository.owner,
+ changeset_revision=tool_shed_repository.installed_changeset_revision )
repo = hg.repository( get_configured_ui(), path=os.path.abspath( tool_shed_repository.repo_path( trans.app ) ) )
repo_info_dict = create_repo_info_dict( trans=trans,
- repo=repo,
repository_clone_url=repository_clone_url,
changeset_revision=tool_shed_repository.installed_changeset_revision,
ctx_rev=ctx_rev,
repository_owner=tool_shed_repository.owner,
repository_name=tool_shed_repository.name,
repository=None,
- repository_metadata=None )
+ repository_metadata=None,
+ metadata=metadata,
+ repository_dependencies=repository_dependencies )
repo_info_dict = tool_shed_encode( repo_info_dict )
new_kwd = dict( includes_tool_dependencies=tool_shed_repository.includes_tool_dependencies,
includes_tools=tool_shed_repository.includes_tools,
@@ -1434,21 +1463,27 @@
@web.expose
@web.require_admin
def reselect_tool_panel_section( self, trans, **kwd ):
- repository = get_installed_tool_shed_repository( trans, kwd[ 'id' ] )
- metadata = repository.metadata
- tool_shed_url = get_url_from_repository_tool_shed( trans.app, repository )
- ctx_rev = get_ctx_rev( tool_shed_url, repository.name, repository.owner, repository.installed_changeset_revision )
- repository_clone_url = generate_clone_url_for_installed_repository( trans, repository )
- repo = hg.repository( get_configured_ui(), path=os.path.abspath( tool_shed_repository.repo_path( trans.app ) ) )
+ repository_id = kwd[ 'id' ]
+ tool_shed_repository = get_installed_tool_shed_repository( trans, repository_id )
+ metadata = tool_shed_repository.metadata
+ tool_shed_url = get_url_from_repository_tool_shed( trans.app, tool_shed_repository )
+ ctx_rev = get_ctx_rev( tool_shed_url, tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.installed_changeset_revision )
+ repository_clone_url = generate_clone_url_for_installed_repository( trans, tool_shed_repository )
+ repository_dependencies = self.get_repository_dependencies( trans=trans,
+ repository_id=repository_id,
+ repository_name=tool_shed_repository.name,
+ repository_owner=tool_shed_repository.owner,
+ changeset_revision=tool_shed_repository.installed_changeset_revision )
repo_info_dict = create_repo_info_dict( trans=trans,
- repo=repo,
repository_clone_url=repository_clone_url,
- changeset_revision=repository.installed_changeset_revision,
+ changeset_revision=tool_shed_repository.installed_changeset_revision,
ctx_rev=ctx_rev,
- repository_owner=repository.owner,
- repository_name=repository.name,
+ repository_owner=tool_shed_repository.owner,
+ repository_name=tool_shed_repository.name,
repository=None,
- repository_metadata=None )
+ repository_metadata=None,
+ metadata=metadata,
+ repository_dependencies=repository_dependencies )
# Get the location in the tool panel in which the tool was originally loaded.
if 'tool_panel_section' in metadata:
tool_panel_dict = metadata[ 'tool_panel_section' ]
@@ -1469,18 +1504,18 @@
no_changes_check_box = CheckboxField( 'no_changes', checked=True )
if original_section_name:
message = "The tools contained in your <b>%s</b> repository were last loaded into the tool panel section <b>%s</b>. " \
- % ( repository.name, original_section_name )
+ % ( tool_shed_repository.name, original_section_name )
message += "Uncheck the <b>No changes</b> check box and select a different tool panel section to load the tools in a "
message += "different section in the tool panel."
status = 'warning'
else:
- message = "The tools contained in your <b>%s</b> repository were last loaded into the tool panel outside of any sections. " % repository.name
+ message = "The tools contained in your <b>%s</b> repository were last loaded into the tool panel outside of any sections. " % tool_shed_repository.name
message += "Uncheck the <b>No changes</b> check box and select a tool panel section to load the tools into that section."
status = 'warning'
if metadata and 'readme_files' in metadata:
url = url_join( tool_shed_url,
'repository/get_readme_files?name=%s&owner=%s&changeset_revision=%s' % \
- ( repository.name, repository.owner, repository.installed_changeset_revision ) )
+ ( tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.installed_changeset_revision ) )
response = urllib2.urlopen( url )
raw_text = response.read()
response.close()
@@ -1508,7 +1543,7 @@
install_tool_dependencies_check_box_checked = True
install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=install_tool_dependencies_check_box_checked )
return trans.fill_template( '/admin/tool_shed_repository/reselect_tool_panel_section.mako',
- repository=repository,
+ repository=tool_shed_repository,
no_changes_check_box=no_changes_check_box,
original_section_name=original_section_name,
install_repository_dependencies_check_box=install_repository_dependencies_check_box,
diff -r c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 templates/admin/tool_shed_repository/common.mako
--- a/templates/admin/tool_shed_repository/common.mako
+++ b/templates/admin/tool_shed_repository/common.mako
@@ -159,7 +159,7 @@
def __str__( self ):
return str( self.count )
- readme_files_root_folder = containers_dict[ 'readme_files' ]
+ readme_files_root_folder = containers_dict.get( 'readme_files', None )
%>
%if readme_files_root_folder:
<p/>
diff -r c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 templates/admin/tool_shed_repository/reselect_tool_panel_section.mako
--- a/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako
+++ b/templates/admin/tool_shed_repository/reselect_tool_panel_section.mako
@@ -11,7 +11,7 @@
<div class="toolFormBody"><form name="reselect_tool_panel_section" id="reselect_tool_panel_section" action="${h.url_for( controller='admin_toolshed', action='reinstall_repository', id=trans.security.encode_id( repository.id ), repo_info_dict=encoded_repo_info_dict )}" method="post" ><div style="clear: both"></div>
- <% readme_files_dict = containers_dict[ 'readme_files' ] %>
+ <% readme_files_dict = containers_dict.get( 'readme_files', None ) %>
%if readme_files_dict:
<div class="form-row"><table class="colored" width="100%">
diff -r c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 templates/admin/tool_shed_repository/select_tool_panel_section.mako
--- a/templates/admin/tool_shed_repository/select_tool_panel_section.mako
+++ b/templates/admin/tool_shed_repository/select_tool_panel_section.mako
@@ -37,7 +37,7 @@
<div class="toolFormBody"><form name="select_tool_panel_section" id="select_tool_panel_section" action="${h.url_for( controller='admin_toolshed', action='prepare_for_install', tool_shed_url=tool_shed_url, encoded_repo_info_dicts=encoded_repo_info_dicts, includes_tools=includes_tools, includes_tool_dependencies=includes_tool_dependencies )}" method="post" ><div style="clear: both"></div>
- <% readme_files_dict = containers_dict[ 'readme_files' ] %>
+ <% readme_files_dict = containers_dict.get( 'readme_files', None ) %>
%if readme_files_dict:
<div class="form-row"><table class="colored" width="100%">
diff -r c8c181a904677adf0c9c65a1151848d9d2da16fb -r 3301ed8fea42b1067f88138573b7d716c3b631e5 templates/webapps/community/repository/common.mako
--- a/templates/webapps/community/repository/common.mako
+++ b/templates/webapps/community/repository/common.mako
@@ -467,13 +467,13 @@
has_readme_files = metadata and 'readme_files' in metadata
has_workflows = metadata and 'workflows' in metadata
- datatypes_root_folder = containers_dict[ 'datatypes' ]
- invalid_tools_root_folder = containers_dict[ 'invalid_tools' ]
- readme_files_root_folder = containers_dict[ 'readme_files' ]
- repository_dependencies_root_folder = containers_dict[ 'repository_dependencies' ]
- tool_dependencies_root_folder = containers_dict[ 'tool_dependencies' ]
- valid_tools_root_folder = containers_dict[ 'valid_tools' ]
- workflows_root_folder = containers_dict[ 'workflows' ]
+ datatypes_root_folder = containers_dict.get( 'datatypes', None )
+ invalid_tools_root_folder = containers_dict.get( 'invalid_tools', None )
+ readme_files_root_folder = containers_dict.get( 'readme_files', None )
+ repository_dependencies_root_folder = containers_dict.get( 'repository_dependencies', None )
+ tool_dependencies_root_folder = containers_dict.get( 'tool_dependencies', None )
+ valid_tools_root_folder = containers_dict.get( 'valid_tools', none )
+ workflows_root_folder = containers_dict.get( 'workflows', None )
has_contents = datatypes_root_folder or invalid_tools_root_folder or valid_tools_root_folder or workflows_root_folder
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/d9e2418fb00a/
changeset: d9e2418fb00a
user: jgoecks
date: 2012-12-11 22:47:54
summary: Trackster: when creating a visualization, default the view to the first chromosome.
affected #: 2 files
diff -r 376a3714dc1510d3a1405575fc2667b68a28a695 -r d9e2418fb00aefd0a8f65a4686dae4e8cd6cd16d static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -1190,7 +1190,7 @@
view.chrom_select.html(chrom_options);
view.chrom_start_index = result.start_index;
- chrom_data.resolve(result);
+ chrom_data.resolve(result.chrom_info);
},
error: function() {
alert("Could not load chroms for this dbkey:", view.dbkey);
diff -r 376a3714dc1510d3a1405575fc2667b68a28a695 -r d9e2418fb00aefd0a8f65a4686dae4e8cd6cd16d static/scripts/viz/trackster_ui.js
--- a/static/scripts/viz/trackster_ui.js
+++ b/static/scripts/viz/trackster_ui.js
@@ -188,7 +188,7 @@
var self = this,
view = new tracks.TracksterView(view_config);
view.editor = true;
- $.when( view.load_chroms_deferred ).then(function() {
+ $.when( view.load_chroms_deferred ).then(function(chrom_info) {
// Viewport config.
if (viewport_config) {
var
@@ -201,6 +201,10 @@
view.change_chrom(chrom, start, end);
}
}
+ else {
+ // No viewport, so use first chromosome.
+ view.change_chrom(chrom_info[0].chrom);
+ }
// Add drawables to view.
if (drawables_config) {
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.