commit/galaxy-central: greg: Remove appropriate entries from the Tool Shed's new repository registry for repositories that have been marked deprecated or deleted.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e8f2c4f3e8c8/ Changeset: e8f2c4f3e8c8 User: greg Date: 2014-05-21 21:57:54 Summary: Remove appropriate entries from the Tool Shed's new repository registry for repositories that have been marked deprecated or deleted. Affected #: 3 files diff -r 155be7ce7910c2effb12fff904390401bdd7976b -r e8f2c4f3e8c8ed63a99254a50ceb18fc33c52080 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 @@ -171,6 +171,8 @@ repository.deleted = True trans.sa_session.add( repository ) trans.sa_session.flush() + # Update the repository registry. + trans.app.repository_registry.remove_entry( repository ) count += 1 deleted_repositories += " %s " % repository.name if count: diff -r 155be7ce7910c2effb12fff904390401bdd7976b -r e8f2c4f3e8c8ed63a99254a50ceb18fc33c52080 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 @@ -1051,6 +1051,8 @@ trans.sa_session.add( repository ) trans.sa_session.flush() if mark_deprecated: + # Update the repository registry. + trans.app.repository_registry.remove_entry( repository ) message = 'The repository <b>%s</b> has been marked as deprecated.' % repository.name else: # Update the repository registry. diff -r 155be7ce7910c2effb12fff904390401bdd7976b -r e8f2c4f3e8c8ed63a99254a50ceb18fc33c52080 lib/tool_shed/repository_registry.py --- a/lib/tool_shed/repository_registry.py +++ b/lib/tool_shed/repository_registry.py @@ -17,6 +17,7 @@ class Registry( object ): def __init__( self, app ): + log.debug( "Loading the repository registry..." ) self.app = app self.certified_level_one_clause_list = self.get_certified_level_one_clause_list() # The following lists contain tuples like ( repository.name, repository.user.username, changeset_revision ) @@ -164,9 +165,11 @@ 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 ) + if certified_level_one_tuple not in self.certified_level_one_suite_tuples: + 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 ) + if certified_level_one_tuple not in self.certified_level_one_repository_and_suite_tuples: + 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 ) @@ -174,9 +177,11 @@ 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 tuple not in self.repository_and_suite_tuples: + self.repository_and_suite_tuples.append( tuple ) if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: - self.suite_tuples.append( tuple ) + if tuple not in self.suite_tuples: + 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. @@ -237,6 +242,55 @@ if repository.type in [ rt_util.REPOSITORY_SUITE_DEFINITION ]: self.certified_level_one_viewable_suites_by_category[ category_name ] += 1 + def remove_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.unload_repository_and_suite_tuple( repository ) + if is_level_one_certified: + self.unload_certified_level_one_repository_and_suite_tuple( repository ) + @property def sa_session( self ): return self.app.model.context.current + + def unload_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: + if certified_level_one_tuple in self.certified_level_one_suite_tuples: + self.certified_level_one_suite_tuples.remove( certified_level_one_tuple ) + else: + if certified_level_one_tuple in self.certified_level_one_repository_and_suite_tuples: + self.certified_level_one_repository_and_suite_tuples.remove( certified_level_one_tuple ) + + def unload_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 ) + if tuple in self.repository_and_suite_tuples: + self.repository_and_suite_tuples.remove( tuple ) + if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: + if tuple in self.suite_tuples: + self.suite_tuples.remove( tuple ) 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