本文整理匯總了Python中buildservice.BuildService.getTargetRepo方法的典型用法代碼示例。如果您正苦於以下問題:Python BuildService.getTargetRepo方法的具體用法?Python BuildService.getTargetRepo怎麽用?Python BuildService.getTargetRepo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類buildservice.BuildService
的用法示例。
在下文中一共展示了BuildService.getTargetRepo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ParticipantHandler
# 需要導入模塊: from buildservice import BuildService [as 別名]
# 或者: from buildservice.BuildService import getTargetRepo [as 別名]
class ParticipantHandler(object):
"""Participant class as defined by the SkyNET API."""
def __init__(self):
self.oscrc = None
self.obs = None
def handle_wi_control(self, ctrl):
"""Job control thread."""
pass
def handle_lifecycle_control(self, ctrl):
"""Participant control thread."""
if ctrl.message == "start":
if ctrl.config.has_option("obs", "oscrc"):
self.oscrc = ctrl.config.get("obs", "oscrc")
def setup_obs(self, namespace):
"""Setup the Buildservice instance
Using namespace as an alias to the apiurl.
"""
self.obs = BuildService(oscrc=self.oscrc, apiurl=namespace)
def build_trial_results(self, wid):
"""Main function to get new failures related to a build trial."""
wid.result = False
if not wid.fields.msg:
wid.fields.msg = []
target_prj = wid.fields.project
build_in_prj = wid.params.build_in
exclude_repos = wid.fields.exclude_repos or []
exclude_archs = wid.fields.exclude_archs or []
new_failures = set()
for target_repo in self.obs.getProjectRepositories(target_prj):
if target_repo in exclude_repos:
continue
archs = self.obs.getRepositoryArchs(target_prj, target_repo)
archs = [arch for arch in archs if arch not in exclude_archs]
# Get the repository of the build trial which builds against the
# required target repo in the target prj
build_in_repo = self.obs.getTargetRepo(build_in_prj, target_prj,
target_repo, archs)
# Get trial build results
trial_results = self.obs.getRepoResults(build_in_prj, build_in_repo)
# Get destination results
orig_results = self.obs.getRepoResults(target_prj, target_repo)
# compare them and return new failures
new_failures.update(get_new_failures(trial_results, orig_results,
archs))
if len(new_failures):
wid.fields.msg.append("During the trial build in %s, %s failed to"\
" build for one of the archs : %s" %
(build_in_prj, " ".join(new_failures),
" ".join(archs)))
wid.fields.new_failures = list(new_failures)
else:
wid.fields.msg.append("Trial build of packages in %s successful" %
build_in_prj)
wid.result = True
def handle_wi(self, wid):
"""Actual job thread."""
self.setup_obs(wid.fields.ev.namespace)
self.build_trial_results(wid)