a ufR@sTddlZddlZddlZddlZddlZddZddZddZdd Zd d Z dS) NcCs|d|}||vrtj|rDtdtjdd|dddgdd nf||}td |z"tjdd|d d d|gdd Wn.tjytd |dtdYn0| |ztjdd|d|dgdd Wn&tjytdtdYn0dS)a Clone a missing git repository and checkout a specific version tag. :param workdir: path to where all data (git, build, install) is stored :param prefix: git url prefix (e.g. "https://gerrit.osmocom.org/") :param cache_git_fetch: list of repositories that have already been fetched in this run of osmo-depcheck :param repository: Osmocom git repository name (e.g. "libosmo-abis") :param version: "master" or a version tag like "0.11.0" /git/zFetching tags...git-CZfetchz--tagsz-qT)checkzCloning git repo: z/gitZclonez NOTE: if 'zo' is part of a git repository with a different name, please add it to the mapping in 'config.py' and try again.Zcheckoutz6ERROR: git checkout failed! Invalid version specified?N) ospathexistsprint subprocessrunZCalledProcessErrorsysexitappend)workdirprefixcache_git_fetch repositoryversionZrepodirZurlr\/home/osmocom-build/jenkins/workspace/Osmocom-depcheck/scripts/osmo-depcheck/dependencies.py git_clone s4      rc Cst||i}t}t|rtt|\}}||=||vrBqtd|d|t|||||t ||} | | || d||<q|S)a+ Generate the dependency graph of an Osmocom program by cloning the git repository, parsing the "configure.ac" file, and recursing. :param workdir: path to where all data (git, build, install) is stored :param prefix: git url prefix (e.g. "https://gerrit.osmocom.org/") :param cache_git_fetch: list of repositories that have already been fetched in this run of osmo-depcheck :param initial: the first program to look at (e.g. "osmo-bts") :param rev: the git revision to check out ("master", "0.1.0", ...) :returns: a dictionary like the following: {"osmo-bts": {"version": "master", "depends": {"libosmocore": "0.11.0", "libosmo-abis": "0.5.0"}}, "libosmocore": {"version": "0.11.0", "depends": {}}, "libosmo-abis": {"version": "0.5.0", "depends": {"libosmocore": "0.11.0"}} z Looking at :)rdepends) collections OrderedDictlennextiteritemsr rparseZ configure_acupdate) rrrinitialrevstackretprogramrrrrrgenerate6s  r'cCsNtd|D]8\}}|d}|d}td|d|dt|qdS)z^ Print the whole dependency graph. :param depends: return value from generate() above zDependency graph:rr * rz depends: N)r rstr)rr&datarrrr print_dict`s r+cCs8|d|}tjdd|dddgdtjd}|jS) a Get the last release string by asking git for the latest tag. :param workdir: path to where all data (git, build, install) is stored :param repository: Osmocom git repository name (e.g. "libosmo-abis") :returns: the latest git tag (e.g. "1.0.2") rrrZdescribez --abbrev=0masterT)rstdout)r r PIPEr-decoderstrip)rrdirZcompleterrrgit_latest_tagks r2cCs|td|D]f\}}|dD]P\}}t||}||kr@q$td|d|dd|d|d|dq$qd S) z Print dependencies tied to an old release tag :param workdir: path to where all data (git, build, install) is stored :param depends: return value from generate() above zDependencies on old releases:rr(rrz -> z (latest: )N)r rr2)rrr&r*ZdependrZlatestrrr print_oldws& r4) rrr r r rr'r+r2r4rrrrs)*