def guess_build(): release = guess.osrelease() builds = guess.builds(release) if builds: build_tag = builds[0][1].replace('cbs/', '') return build_tag return None
def guess_build(build_id): release = guess.osrelease() builds = guess.builds(release) for name, bs in builds: if bs.startswith('koji'): build = rdoupdate.core.Build(id=build_id, repo=release, dist=name, source='koji') return build return None
def copr_check(release=None, dist=None): osdist = guess.osdist() if osdist == 'RHOS': helpers.confirm("Look like you're trying to build RHOS package in " "public copr.\nProceed anyway?") if not release: raise exception.CantGuess(what='release', why="Specify with -r/--release") if not dist: builds = guess.builds(release=release) for dist_, src in builds: if src.startswith('copr/jruzicka'): dist = dist_ log.info("Autodetected dist: %s" % dist) break if not dist: raise exception.CantGuess(what='dist', why="Specify with -d/--dist") return {'dist': dist}
def update_rdoinfo_check(update): fail_msg = None warn = False rls = defaultdict(set) for b in update.builds: rls[b.repo].add(b) log.info("Checking update using rdoinfo...".format( t=log.term)) for r, builds in rls.items(): rbuilds = guess.builds(r) rbuilds_ = list(rbuilds) if not rbuilds: msg = 'Unknown OpenStack release: %s' % r log.warn(msg) if not fail_msg: fail_msg = msg continue for b in builds: found = False for dist_, src_ in rbuilds: if b.dist == dist_: found = True rbuilds_ = filter(lambda x: x[0] != b.dist, rbuilds_) break if not found: msg = 'Unexpected %s build: %s' % (r, b.dist) log.warn(msg) if not fail_msg: fail_msg = msg for dist_, src_ in rbuilds_: log.info('Missing %s build: %s' % (r, dist_)) warn = True if fail_msg: raise exception.UpdateCheckFailed(fail=fail_msg) if warn: helpers.confirm("Submit anyway?")