def koji_pkgs2archsigs(kapi, pkgs, filter=None): if len(pkgs) > _koji_max_query: ret = [] for i in range(0, len(pkgs), _koji_max_query): npkgs = pkgs[i:i + _koji_max_query] ret.extend(koji_pkgs2archsigs(kapi, npkgs, filter)) return ret if filter is None: filter = lambda x: False kapi.multicall = True for pkg in pkgs: kapi.listRPMs(buildID=pkg._koji_build_id) ret = [] results = kapi.multiCall() for ([rpms], bpkg) in zip(results, pkgs): for rpm in rpms: epoch = spkg.epochnum2epoch(rpm['epoch']) pkg = spkg.nvr2pkg(rpm['nvr'], arch=rpm['arch'], epoch=epoch) pkg._koji_rpm_id = rpm['id'] pkg._koji_build_id = bpkg._koji_build_id if filter(pkg): continue ret.append(pkg) koji_archpkgs2sigs(kapi, ret) return ret
def _koji_buildinfo2pkg(kapi, binfo): epoch = spkg.epochnum2epoch(binfo['epoch']) pkg = spkg.nvr2pkg(binfo['nvr'], epoch=epoch) pkg._koji_build_id = binfo['build_id'] if 'task_id' in binfo: pkg._koji_task_id = binfo['task_id'] pkg._kapi = kapi return pkg
def koji_pkgs2archsigs(kapi, pkgs): if len(pkgs) > _koji_max_query: ret = [] for i in range(0, len(pkgs), _koji_max_query): ret.extend(koji_pkgs2archsigs(kapi, pkgs[i:i + _koji_max_query])) return ret kapi.multicall = True for pkg in pkgs: kapi.listRPMs(buildID=pkg._koji_build_id) ret = [] results = kapi.multiCall() for ([rpms], bpkg) in zip(results, pkgs): for rpm in rpms: epoch = spkg.epochnum2epoch(rpm['epoch']) pkg = spkg.nvr2pkg(rpm['nvr'], epoch=epoch) pkg.arch = rpm['arch'] pkg._koji_rpm_id = rpm['id'] pkg._koji_build_id = bpkg._koji_build_id ret.append(pkg) koji_archpkgs2sigs(kapi, ret) return ret