コード例 #1
0
def submit_build(session, package, arch_override=None):
    """
    Submits a scratch-build to Koji for given package.

    :param session: KoscheiBackendSession
    :param package: A package for which to submit build
    :param arch_override: optional list of architectures that will be used intead of
                          Koji's default
    :return:
    """
    assert package.collection.latest_repo_id
    build = Build(package_id=package.id, state=Build.RUNNING)
    name = package.name
    build_opts = {}
    if arch_override:
        build_opts['arch_override'] = ' '.join(arch_override)
    # on secondary Koji, collections SRPMs are taken from secondary, primary
    # needs to be able to build from relative URL constructed against
    # secondary (internal redirect)
    srpm_res = koji_util.get_last_srpm(
        session.secondary_koji_for(package.collection),
        package.collection.dest_tag,
        name,
        relative=True
    )
    if srpm_res:
        srpm, srpm_url = srpm_res
        if session.build_from_repo_id:
            target = None
            build.repo_id = package.collection.latest_repo_id
            build_opts.update({'repo_id': build.repo_id})
        else:
            target = package.collection.target
        # priorities are reset after the build is done
        # - the reason for that is that the build might be canceled and we want
        # the priorities to be retained in that case
        build.task_id = koji_util.koji_scratch_build(
            session.koji('primary'),
            target,
            name,
            srpm_url,
            build_opts,
        )
        build.started = datetime.now()
        build.epoch = srpm['epoch']
        build.version = srpm['version']
        build.release = srpm['release']
        session.db.add(build)
        session.db.flush()
        return build
コード例 #2
0
ファイル: __init__.py プロジェクト: msimacek/koschei
def submit_build(session, package, arch_override=None):
    """
    Submits a scratch-build to Koji for given package.

    :param session: KoscheiBackendSession
    :param package: A package for which to submit build
    :param arch_override: optional list of architectures that will be used intead of
                          Koji's default
    :return:
    """
    assert package.collection.latest_repo_id
    build = Build(package_id=package.id, state=Build.RUNNING)
    name = package.name
    build_opts = {}
    if arch_override:
        build_opts['arch_override'] = ' '.join(arch_override)
    # on secondary Koji, collections SRPMs are taken from secondary, primary
    # needs to be able to build from relative URL constructed against
    # secondary (internal redirect)
    srpm_res = koji_util.get_last_srpm(
        session.secondary_koji_for(package.collection),
        package.collection.dest_tag,
        name,
        relative=True
    )
    if srpm_res:
        srpm, srpm_url = srpm_res
        if session.build_from_repo_id:
            target = None
            build.repo_id = package.collection.latest_repo_id
            build_opts.update({'repo_id': build.repo_id})
        else:
            target = package.collection.target
        # priorities are reset after the build is done
        # - the reason for that is that the build might be canceled and we want
        # the priorities to be retained in that case
        build.task_id = koji_util.koji_scratch_build(
            session.koji('primary'),
            target,
            name,
            srpm_url,
            build_opts,
        )
        build.started = datetime.now()
        build.epoch = srpm['epoch']
        build.version = srpm['version']
        build.release = srpm['release']
        session.db.add(build)
        session.db.flush()
        return build
コード例 #3
0
ファイル: __init__.py プロジェクト: W3SS/koschei
 def submit_build(self, package):
     build = Build(package_id=package.id, state=Build.RUNNING)
     name = package.name
     build_opts = {}
     if package.arch_override:
         build_opts = {'arch_override': package.arch_override}
     tag = package.collection.target_tag
     # SRPMs are taken from secondary, primary needs to be able to build
     # from relative URL constructed against secondary (internal redirect)
     srpm_res = koji_util.get_last_srpm(self.koji_sessions['secondary'], tag, name)
     if srpm_res:
         srpm, srpm_url = srpm_res
         package.manual_priority = 0
         build.task_id = koji_util.koji_scratch_build(self.koji_sessions['primary'],
                                                      tag, name, srpm_url, build_opts)
         build.started = datetime.now()
         build.epoch = srpm['epoch']
         build.version = srpm['version']
         build.release = srpm['release']
         self.db.add(build)
         self.db.flush()
         self.flush_depchanges(build)
         return build
コード例 #4
0
ファイル: __init__.py プロジェクト: W3SS/koschei
 def submit_build(self, package):
     build = Build(package_id=package.id, state=Build.RUNNING)
     name = package.name
     build_opts = {}
     if package.arch_override:
         build_opts = {'arch_override': package.arch_override}
     tag = package.collection.target_tag
     # SRPMs are taken from secondary, primary needs to be able to build
     # from relative URL constructed against secondary (internal redirect)
     srpm_res = koji_util.get_last_srpm(self.koji_sessions['secondary'],
                                        tag, name)
     if srpm_res:
         srpm, srpm_url = srpm_res
         package.manual_priority = 0
         build.task_id = koji_util.koji_scratch_build(
             self.koji_sessions['primary'], tag, name, srpm_url, build_opts)
         build.started = datetime.now()
         build.epoch = srpm['epoch']
         build.version = srpm['version']
         build.release = srpm['release']
         self.db.add(build)
         self.db.flush()
         self.flush_depchanges(build)
         return build