def main(repo_type, rosdistro_name): index = get_index(get_index_url()) if repo_type == 'doc': try: distro_file = get_doc_file(index, rosdistro_name) except RuntimeError as e: print("Could not load doc file for distro '%s': %s" % (rosdistro_name, e), file=sys.stderr) return False if repo_type == 'source': try: distro_file = get_source_file(index, rosdistro_name) except RuntimeError as e: print("Could not load source file for distro '%s': %s" % (rosdistro_name, e), file=sys.stderr) return False for repo_name in sorted(distro_file.repositories.keys()): sys.stdout.write('.') sys.stdout.flush() repo = distro_file.repositories[repo_name] try: if (repo.type == 'git'): check_git_repo(repo.url, repo.version) elif (repo.type == 'hg'): check_hg_repo(repo.url, repo.version) elif (repo.type == 'svn'): check_svn_repo(repo.url, repo.version) else: print() print("Unknown type '%s' for repository '%s'" % (repo.type, repo.name), file=sys.stderr) except RuntimeError as e: print() print("Could not fetch repository '%s': %s (%s) [%s]" % (repo.name, repo.url, repo.version, e), file=sys.stderr) print() return True
def load_configuration(ros_distro, repo_name): if ros_distro == 'fuerte': return load_configuration_fuerte(ros_distro, repo_name) from rosdistro import get_doc_file, get_index, get_index_url index = get_index(get_index_url()) doc_file = get_doc_file(index, ros_distro) repo_data = _get_repo_data(doc_file, repo_name) doc_conf = [repo_data] repo = doc_file.repositories[repo_name] depends = getattr(repo, 'depends', []) depends_conf = [] for dep_name in depends: try: repo_data = _get_repo_data(doc_file, dep_name) except BuildException: raise BuildException('Could not find a dependent repository "%s" of "%s" in doc file' % (dep_name, repo_name)) depends_conf.append(repo_data) return (doc_conf, depends_conf)
def test_get_doc_file(): url = 'file://' + FILES_DIR + '/index_v2.yaml' i = get_index(url) doc_file = get_doc_file(i, 'foo') _validate_doc_file(doc_file)