'Return the installed and missing repository dependencies for a tool shed repository that has a record
in the Galaxy database, but may or may not be installed.  In this case, the repository dependencies are
associated with the repository in the database.  Do not include a repository dependency if it is required
only to compile a tool dependency defined for the dependent repository since these special kinds of repository
dependencies are really a dependency of the dependent repository\'s contained tool dependency, and only
if that tool dependency requires compilation.'

def get_installed_and_missing_repository_dependencies(self, repository):

    missing_repository_dependencies = {}
    installed_repository_dependencies = {}
    has_repository_dependencies = repository.has_repository_dependencies
    if has_repository_dependencies:
        metadata = repository.metadata
        installed_rd_tups = []
        missing_rd_tups = []
        for tsr in repository.repository_dependencies:
            prior_installation_required = self.set_prior_installation_required(repository, tsr)
            only_if_compiling_contained_td = self.set_only_if_compiling_contained_td(repository, tsr)
            rd_tup = [tsr.tool_shed, tsr.name, tsr.owner, tsr.changeset_revision, prior_installation_required, only_if_compiling_contained_td, tsr.id, tsr.status]
            if (tsr.status == self.app.install_model.ToolShedRepository.installation_status.INSTALLED):
                installed_rd_tups.append(rd_tup)
            elif repository.missing_tool_dependencies:
                if (not self.repository_dependency_needed_only_for_compiling_tool_dependency(repository, tsr)):
                    missing_rd_tups.append(rd_tup)
            else:
                missing_rd_tups.append(rd_tup)
        if (installed_rd_tups or missing_rd_tups):
            repository_dependencies = metadata.get('repository_dependencies', {})
            description = repository_dependencies.get('description', None)
            root_key = container_util.generate_repository_dependencies_key_for_repository(repository.tool_shed, repository.name, repository.owner, repository.installed_changeset_revision, prior_installation_required, only_if_compiling_contained_td)
            if installed_rd_tups:
                installed_repository_dependencies['root_key'] = root_key
                installed_repository_dependencies[root_key] = installed_rd_tups
                installed_repository_dependencies['description'] = description
            if missing_rd_tups:
                missing_repository_dependencies['root_key'] = root_key
                missing_repository_dependencies[root_key] = missing_rd_tups
                missing_repository_dependencies['description'] = description
    return (installed_repository_dependencies, missing_repository_dependencies)
