def deps(archive, source, dsc): deps = dsc['Build-Depends'] data = { "Build-Depends": Block(dsc['Build-Depends']).to_dict() } return data def cayley(el, data, component, package, version): if el is None: el = "" data = data['Build-Depends'] relations = data.get("relations", []) for relation in relations: targets = relation.get("targets", []) for target in targets: package_bd = target.get("package") el += "<{package}> <{relation}> <{target}> .\r\n".format( package=package, relation="build_depends", target=package_bd, ) return el archive.amap(10, "unstable", "main", deps) data = archive.reduce("main", cayley) with open("build-depends", "w") as fd: fd.write(data)
archive = Archive("http://192.168.1.50/debian") def canidate(archive, source, dsc): with source.unpack(): trove_python3 = False if os.path.exists("setup.py"): buf = open("setup.py", "r").read() if "Programming Language :: Python :: 3" in buf: trove_python3 = True has_python2_module = False has_python3_module = False for (name, *foo) in filter(lambda x: x != [], (x.strip().split() for x in source.source.get('Package-List', "").split("\n"))): if name.startswith("python-"): has_python2_module = True if name.startswith("python3-"): has_python3_module = True return { "has_python2_module": has_python2_module, "has_python3_module": has_python3_module, "trove_python3": trove_python3, "canidate": trove_python3 is True and has_python3_module is False } def is_python(source): return source.source['Section'] == "python" archive.amap(10, "unstable", "main", canidate, filter=is_python)
from dionysus.archive import Archive from dep3.parse import get_headers import os archive = Archive("http://192.168.1.50/debian") def flatten(path): for root, dirs, files in os.walk(path): for dpath in dirs: yield from flatten(os.path.join(root, dpath)) yield from (os.path.join(root, x) for x in files) def report(path): with open(path, 'rb') as fd: if path.endswith(".patch") or path.endswith(".diff"): return get_headers(fd) def patch(archive, source, dsc): print(source.source) with source.unpack(): return { "dep3": list(map(report, flatten("debian/patches"))) } archive.amap(10, "unstable", "main", patch)