1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/155be7ce7910/ Changeset: 155be7ce7910 User: greg Date: 2014-05-21 21:37:27 Summary: Add appropriate entries into the Tool Shed's repository registry for newly created repositories and undeleted and undeprecated repositories. Affected #: 5 files
diff -r a769e22480662ec5d1205816bd162b6cfa6649f7 -r 155be7ce7910c2effb12fff904390401bdd7976b 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 @@ -31,12 +31,6 @@ from tool_shed.galaxy_install import repository_util import tool_shed.galaxy_install.grids.admin_toolshed_grids as admin_toolshed_grids
-import pkg_resources - -pkg_resources.require( 'elementtree' ) -from elementtree import ElementTree -from elementtree.ElementTree import Element - log = logging.getLogger( __name__ )
diff -r a769e22480662ec5d1205816bd162b6cfa6649f7 -r 155be7ce7910c2effb12fff904390401bdd7976b lib/galaxy/webapps/tool_shed/controllers/admin.py --- a/lib/galaxy/webapps/tool_shed/controllers/admin.py +++ b/lib/galaxy/webapps/tool_shed/controllers/admin.py @@ -367,6 +367,9 @@ repository.deleted = False trans.sa_session.add( repository ) trans.sa_session.flush() + if not repository.deprecated: + # Update the repository registry. + trans.app.repository_registry.add_entry( repository ) count += 1 undeleted_repositories += " %s" % repository.name if count:
diff -r a769e22480662ec5d1205816bd162b6cfa6649f7 -r 155be7ce7910c2effb12fff904390401bdd7976b 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 @@ -1053,6 +1053,8 @@ if mark_deprecated: message = 'The repository <b>%s</b> has been marked as deprecated.' % repository.name else: + # Update the repository registry. + trans.app.repository_registry.add_entry( repository ) message = 'The repository <b>%s</b> has been marked as not deprecated.' % repository.name trans.response.send_redirect( web.url_for( controller='repository', action='browse_repositories',
diff -r a769e22480662ec5d1205816bd162b6cfa6649f7 -r 155be7ce7910c2effb12fff904390401bdd7976b lib/tool_shed/repository_registry.py --- a/lib/tool_shed/repository_registry.py +++ b/lib/tool_shed/repository_registry.py @@ -40,6 +40,29 @@ self.load_viewable_repositories_and_suites_by_category() self.load_repository_and_suite_tuples()
+ def add_entry( self, repository ): + if repository: + is_valid = self.is_valid( repository ) + for rca in repository.categories: + category = rca.category + category_name = str( category.name ) + self.viewable_repositories_and_suites_by_category[ category_name ] += 1 + if is_valid: + self.viewable_valid_repositories_and_suites_by_category[ category_name ] += 1 + if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: + self.viewable_suites_by_category[ category_name ] += 1 + if is_valid: + self.viewable_valid_suites_by_category[ category_name ] += 1 + certified_level_one_tuple = self.get_certified_level_one_tuple( repository ) + latest_installable_changeset_revision, is_level_one_certified = certified_level_one_tuple + if is_level_one_certified: + self.certified_level_one_viewable_repositories_and_suites_by_category[ category_name ] += 1 + if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: + self.certified_level_one_viewable_suites_by_category[ category_name ] += 1 + self.load_repository_and_suite_tuple( repository ) + if is_level_one_certified: + self.load_certified_level_one_repository_and_suite_tuple( repository ) + def get_certified_level_one_clause_list( self ): certified_level_one_tuples = [] clause_list = [] @@ -60,7 +83,9 @@ """ Return True if the latest installable changeset_revision of the received repository is level one certified. """ - if repository.deleted: + if repository is None: + return ( None, False ) + if repository.deleted or repository.deprecated: return ( None, False ) repo = hg_util.get_repo_for_repository( self.app, repository=repository, repo_path=None, create=False ) # Get the latest installable changeset revision since that is all that is currently configured for testing. @@ -126,33 +151,46 @@ return tuple in self.certified_level_one_repository_and_suite_tuples return False
+ def is_valid( self, repository ): + if repository and not repository.deleted and not repository.deprecated and repository.downloadable_revisions: + return True + return False + + def load_certified_level_one_repository_and_suite_tuple( self, repository ): + # The received repository has been determined to be level one certified. + name = str( repository.name ) + owner = str( repository.user.username ) + tip_changeset_hash = repository.tip( self.app ) + if tip_changeset_hash != suc.INITIAL_CHANGELOG_HASH: + certified_level_one_tuple = ( name, owner, tip_changeset_hash ) + if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: + self.certified_level_one_suite_tuples.append( certified_level_one_tuple ) + else: + self.certified_level_one_repository_and_suite_tuples.append( certified_level_one_tuple ) + + def load_repository_and_suite_tuple( self, repository ): + name = str( repository.name ) + owner = str( repository.user.username ) + for repository_metadata in repository.metadata_revisions: + changeset_revision = str( repository_metadata.changeset_revision ) + tuple = ( name, owner, changeset_revision ) + self.repository_and_suite_tuples.append( tuple ) + if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: + self.suite_tuples.append( tuple ) + def load_repository_and_suite_tuples( self ): # Load self.certified_level_one_repository_and_suite_tuples and self.certified_level_one_suite_tuples. for repository in self.sa_session.query( model.Repository ) \ .join( model.RepositoryMetadata.table ) \ .filter( or_( *self.certified_level_one_clause_list ) ) \ .join( model.User.table ): - name = str( repository.name ) - owner = str( repository.user.username ) - tip_changeset_hash = repository.tip( self.app ) - certified_level_one_tuple = ( name, owner, tip_changeset_hash ) - if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: - self.certified_level_one_suite_tuples.append( certified_level_one_tuple ) - else: - self.certified_level_one_repository_and_suite_tuples.append( certified_level_one_tuple ) + self.load_certified_level_one_repository_and_suite_tuple( repository ) # Load self.repository_and_suite_tuples and self.suite_tuples for repository in self.sa_session.query( model.Repository ) \ .filter( and_( model.Repository.table.c.deleted == False, model.Repository.table.c.deprecated == False ) ) \ .join( model.User.table ): - name = str( repository.name ) - owner = str( repository.user.username ) - for repository_metadata in repository.metadata_revisions: - changeset_revision = str( repository_metadata.changeset_revision ) - tuple = ( name, owner, changeset_revision ) - self.repository_and_suite_tuples.append( tuple ) - if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: - self.suite_tuples.append( tuple ) + self.load_repository_and_suite_tuple( repository )
def load_viewable_repositories_and_suites_by_category( self ): # Clear all dictionaries just in case they were previously loaded. @@ -165,40 +203,39 @@ self.viewable_valid_repositories_and_suites_by_category = {} self.viewable_valid_suites_by_category = {} for category in self.sa_session.query( model.Category ): + category_name = str( category.name ) if category not in self.certified_level_one_viewable_repositories_and_suites_by_category: - self.certified_level_one_viewable_repositories_and_suites_by_category[ str( category.name ) ] = 0 + self.certified_level_one_viewable_repositories_and_suites_by_category[ category_name ] = 0 if category not in self.certified_level_one_viewable_suites_by_category: - self.certified_level_one_viewable_suites_by_category[ str( category.name ) ] = 0 + self.certified_level_one_viewable_suites_by_category[ category_name ] = 0 if category not in self.viewable_repositories_and_suites_by_category: - self.viewable_repositories_and_suites_by_category[ str( category.name ) ] = 0 + self.viewable_repositories_and_suites_by_category[ category_name ] = 0 if category not in self.viewable_suites_by_category: - self.viewable_suites_by_category[ str( category.name ) ] = 0 + self.viewable_suites_by_category[ category_name ] = 0 if category not in self.viewable_valid_repositories_and_suites_by_category: - self.viewable_valid_repositories_and_suites_by_category[ str( category.name ) ] = 0 + self.viewable_valid_repositories_and_suites_by_category[ category_name ] = 0 if category not in self.viewable_valid_suites_by_category: - self.viewable_valid_suites_by_category[ str( category.name ) ] = 0 + self.viewable_valid_suites_by_category[ category_name ] = 0 for rca in category.repositories: repository = rca.repository - if repository.downloadable_revisions: - is_valid = True - else: - is_valid = False - encoded_repository_id = self.app.security.encode_id( repository.id ) - tip_changeset_hash = repository.tip( self.app ) - repository_metadata = suc.get_repository_metadata_by_changeset_revision( self.app, - encoded_repository_id, - tip_changeset_hash ) - self.viewable_repositories_and_suites_by_category[ str( category.name ) ] += 1 - if is_valid: - self.viewable_valid_repositories_and_suites_by_category[ str( category.name ) ] += 1 - if repository.type in [ rt_util.REPOSITORY_SUITE_DEFINITION ]: - self.viewable_suites_by_category[ str( category.name ) ] += 1 + if not repository.deleted and not repository.deprecated: + is_valid = self.is_valid( repository ) + encoded_repository_id = self.app.security.encode_id( repository.id ) + tip_changeset_hash = repository.tip( self.app ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( self.app, + encoded_repository_id, + tip_changeset_hash ) + self.viewable_repositories_and_suites_by_category[ category_name ] += 1 if is_valid: - self.viewable_valid_suites_by_category[ str( category.name ) ] += 1 - if self.is_level_one_certified( repository_metadata ): - self.certified_level_one_viewable_repositories_and_suites_by_category[ str( category.name ) ] += 1 + self.viewable_valid_repositories_and_suites_by_category[ category_name ] += 1 if repository.type in [ rt_util.REPOSITORY_SUITE_DEFINITION ]: - self.certified_level_one_viewable_suites_by_category[ str( category.name ) ] += 1 + self.viewable_suites_by_category[ category_name ] += 1 + if is_valid: + self.viewable_valid_suites_by_category[ category_name ] += 1 + if self.is_level_one_certified( repository_metadata ): + self.certified_level_one_viewable_repositories_and_suites_by_category[ category_name ] += 1 + if repository.type in [ rt_util.REPOSITORY_SUITE_DEFINITION ]: + self.certified_level_one_viewable_suites_by_category[ category_name ] += 1
@property def sa_session( self ):
diff -r a769e22480662ec5d1205816bd162b6cfa6649f7 -r 155be7ce7910c2effb12fff904390401bdd7976b lib/tool_shed/util/repository_maintenance_util.py --- a/lib/tool_shed/util/repository_maintenance_util.py +++ b/lib/tool_shed/util/repository_maintenance_util.py @@ -93,6 +93,8 @@ flush_needed = True if flush_needed: trans.sa_session.flush() + # Update the repository registry. + trans.app.repository_registry.add_entry( repository ) message = "Repository <b>%s</b> has been created." % str( repository.name ) return repository, message
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.
galaxy-commits@lists.galaxyproject.org