示例#1
0
    def get_module_dependency_latest(self, name, stream, visited=None):
        visited = visited or set()
        version_dependencies = set()

        try:
            repo_module = self[name]
            repo_module_stream = repo_module[stream]
            repo_module_version = repo_module_stream.latest()
            version_dependencies.add(repo_module_version)

            for requires_name, requires_streams in \
                    repo_module_version.requires().items():
                for requires_stream in requires_streams:
                    if requires_stream[0] == '-':
                        continue
                    requires_ns = "{}:{}".format(requires_name,
                                                 requires_stream)
                    if requires_ns in visited:
                        continue
                    visited.add(requires_ns)
                    version_dependencies.update(
                        self.get_module_dependency_latest(
                            requires_name, requires_stream, visited))
        except KeyError as e:
            logger.debug(e)

        return version_dependencies
示例#2
0
    def get_excludes(self, name):
        excludes = set()
        repos = set()
        version_dependencies = set()

        try:
            repo_module = self[name]
            for repo_module_stream in repo_module.values():
                if repo_module.conf.enabled._get() and \
                        repo_module.conf.stream._get() == repo_module_stream.stream or \
                        repo_module.defaults.peek_default_stream() == repo_module_stream.stream:
                    continue

                for repo_module_version in repo_module_stream.values():
                    version_dependencies.add(repo_module_version)
        except KeyError as e:
            logger.debug(e)

        for dependency in version_dependencies:
            repos.add(dependency.repo)
            excludes.update(dependency.artifacts())

        return excludes, repos