当前位置: 首页>>代码示例>>Python>>正文


Python BuildService.getProjectRepositories方法代码示例

本文整理汇总了Python中buildservice.BuildService.getProjectRepositories方法的典型用法代码示例。如果您正苦于以下问题:Python BuildService.getProjectRepositories方法的具体用法?Python BuildService.getProjectRepositories怎么用?Python BuildService.getProjectRepositories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在buildservice.BuildService的用法示例。


在下文中一共展示了BuildService.getProjectRepositories方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ParticipantHandler

# 需要导入模块: from buildservice import BuildService [as 别名]
# 或者: from buildservice.BuildService import getProjectRepositories [as 别名]
class ParticipantHandler(object):
    """ Participant class as defined by the SkyNET API """
    def __init__(self):
        self.reposerver = ""
        self.ksstore = ""
        self.oscrc = ""
        self.namespace = 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":
            self.reposerver = ctrl.config.get("build_ks", "reposerver")
            self.ksstore = ctrl.config.get("build_ks", "ksstore")
            if ctrl.config.has_option("obs", "oscrc"):
                self.oscrc = ctrl.config.get("obs", "oscrc")

    def get_repositories(self, wid, project):
        if not (wid.fields.ev and wid.fields.ev.namespace):
            raise RuntimeError("Missing field: ev.namespace")
        if self.obs is None or self.namespace != wid.fields.ev.namespace:
            self.namespace = wid.fields.ev.namespace
            self.obs = BuildService(oscrc=self.oscrc, apiurl=self.namespace)

        try:
            repositories = self.obs.getProjectRepositories(project)
        except HTTPError, exobj:
            if exobj.code == 404:
                raise RuntimeError("Project %s not found in OBS" % project)
            raise
        return repositories
开发者ID:MeeGoIntegration,项目名称:imager,代码行数:37,代码来源:build_ks.py

示例2: get_repositories

# 需要导入模块: from buildservice import BuildService [as 别名]
# 或者: from buildservice.BuildService import getProjectRepositories [as 别名]
 def get_repositories(self, wid, project):
     if not wid.fields.ev or not wid.fields.ev.namespace:
         raise RuntimeError("Missing field: ev.namespace")
     obs = BuildService(oscrc=self.oscrc, apiurl=wid.fields.ev.namespace)
     try:
         repositories = obs.getProjectRepositories(project)
     except HTTPError, exobj:
         if exobj.code == 404:
             raise RuntimeError("Project %s not found in OBS" % project)
         raise
开发者ID:henriksa,项目名称:imager,代码行数:12,代码来源:build_ks.py

示例3: ParticipantHandler

# 需要导入模块: from buildservice import BuildService [as 别名]
# 或者: from buildservice.BuildService import getProjectRepositories [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_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 = []

        if wid.params.project:
            prj = wid.params.project
        else:
            prj = wid.fields.project

        if wid.params.packages:
            pkgs = wid.params.package
        else:
            pkgs = wid.fields.packages or []

        if wid.params.exclude_repos:
            exclude_repos = wid.params.exclude_repos
        else:
            exclude_repos = wid.fields.exclude_repos or []

        if wid.params.exclude_archs:
            exclude_archs = wid.params.exclude_archs
        else:
            exclude_archs = wid.fields.exclude_archs or []

        failures = set()
        for repo in self.obs.getProjectRepositories(prj):
            if repo in exclude_repos:
                continue
            archs = self.obs.getRepositoryArchs(prj, repo)
            archs = [arch for arch in archs if arch not in exclude_archs]
            # Get results
            results = self.obs.getRepoResults(prj, repo)
            failures.update(get_failures(results, archs))

        #filter results
        if pkgs:
            failures = failures & set(pkgs)

        if len(failures):
            wid.fields.msg.append("%s failed to"\
                                  " build in %s" %
                                  (" ".join(failures), prj))
            wid.fields.failures = list(failures)

    def handle_wi(self, wid):
        """Actual job thread."""

        self.setup_obs(wid.fields.ev.namespace)
        self.build_results(wid)
开发者ID:MeeGoIntegration,项目名称:boss-standard-workflow,代码行数:80,代码来源:get_build_results.py

示例4: ParticipantHandler

# 需要导入模块: from buildservice import BuildService [as 别名]
# 或者: from buildservice.BuildService import getProjectRepositories [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)
开发者ID:d0b3rm4n,项目名称:boss-standard-workflow,代码行数:76,代码来源:get_build_trial_results.py

示例5: ParticipantHandler

# 需要导入模块: from buildservice import BuildService [as 别名]
# 或者: from buildservice.BuildService import getProjectRepositories [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 check_trial(self, prj, targets, acts, exc):

        exclude_repos, exclude_archs = exc

        new_failures = set()
        old_failures = set()
        for target_prj in targets:
            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]
                print 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(prj, target_repo)
                # Get destination results
                orig_results = self.obs.getRepoResults(target_prj, target_repo)
                # compare them and return new failures
                comparison = get_new_failures(trial_results, orig_results, archs, acts)
                new_failures.update(comparison[0])
                old_failures.update(comparison[1])

        return new_failures - old_failures

    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 = []

        exclude_repos = wid.fields.exclude_repos or []
        exclude_archs = wid.fields.exclude_archs or []

        trial_project = wid.fields.build_trial.project
        trial_subprjs = wid.fields.build_trial.as_dict().get('subprojects', {})

        subtargets = list(itertools.chain.from_iterable(trial_subprjs.values()))
        actions = [act for act in wid.fields.ev.actions if act["targetproject"] not in subtargets]
        targets = [act["targetproject"] for act in actions]

        messages = []
        all_fails = []

        fails = self.check_trial(trial_project, targets, actions, exc=(exclude_repos, exclude_archs))
        if fails:
            all_fails.extend(fails)
            wid.fields.msg.append("During the trial build in %s, %s failed to"\
                                  " build" %
                                  (trial_project, " ".join(fails)))
        else:
            wid.fields.msg.append("Trial build of packages in %s successful" % trial_project)

        for trial_sub, subtargets in trial_subprjs.items():
            subactions = [act for act in wid.fields.ev.actions if act["targetproject"] in subtargets]
            fails = self.check_trial(trial_sub, subtargets, subactions, exc=(exclude_repos, exclude_archs))
            if fails:
                all_fails.extend(fails)
                wid.fields.msg.append("During the trial build in %s, %s failed to build" %
                                      (trial_sub, " ".join(fails)))
            else:
                wid.fields.msg.append("Trial build of packages in %s successful" % trial_sub)


        if all_fails:
            wid.fields.new_failures = all_fails
        else:
            wid.result = True

    def handle_wi(self, wid):
#.........这里部分代码省略.........
开发者ID:MeeGoIntegration,项目名称:boss-standard-workflow,代码行数:103,代码来源:get_build_trial_results.py


注:本文中的buildservice.BuildService.getProjectRepositories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。