idempotent KojiBuilder implementation of rida/builder.py

- Allows to call build() and connect() multiple times. This needs to be
  followed by allowing to resubmit module build tasks in REST.
- rename buildroot_add_repo() to buildroot_add_repos() (input data is artifacts)

Signed-off-by: Lubos Kocman <lkocman@redhat.com>
Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Lubos Kocman
2016-08-12 20:44:11 +02:00
committed by Nils Philippsen
parent dd0b60dcdd
commit 68e32ee8c7
6 changed files with 156 additions and 93 deletions

View File

@@ -93,31 +93,28 @@ def testbuildroot():
# Do a locally namespaced import here to avoid importing py2-only libs in a
# py3 runtime.
from rida.builder import KojiModuleBuilder, Builder
from rida.builder import KojiModuleBuilder #, Builder
cfg = Config()
cfg.koji_profile = "koji"
cfg.koji_config = "/etc/rida/koji.conf"
cfg.koji_arches = ["x86_64", "i686"]
mb = KojiModuleBuilder(module="testmodule-1.0", config=cfg) # or By using Builder
mb = KojiModuleBuilder(module="testmodule-1.0", config=cfg, tag="testmodule-1.0") # or By using Builder
# mb = Builder(module="testmodule-1.0", backend="koji", config=cfg)
resume = False
mb.buildroot_connect()
mb.buildroot_add_repos(["fakemodulebuild-1.0-0",])
srpm_path = mb.get_disttag_srpm("testmodule-1.0")
task_id = mb.build(artifact_name="module-build-macros", source=srpm_path)
#task_id = mb.build(artifact_name="fedora-release",
# source="git://pkgs.fedoraproject.org/rpms/fedora-release?#b1d65f349dca2f597b278a4aad9e41fb0aa96fc9")
#mb.buildroot_add_artifacts(["fedora-release-24-2", ]) # just example with disttag macro
#mb.buildroot_ready(artifact="fedora-release-24-2")
new_task_id = mb.build(artifact_name="module-build-macros", source=srpm_path)
if not resume:
mb.buildroot_prep()
mb.buildroot_add_dependency(["f24"])
mb.buildroot_ready()
task_id = mb.build(artifact_name="fedora-release",
source="git://pkgs.fedoraproject.org/rpms/fedora-release?#b1d65f349dca2f597b278a4aad9e41fb0aa96fc9")
mb.buildroot_add_artifacts(["fedora-release-24-2", ]) # just example with disttag macro
mb.buildroot_ready(artifact="fedora-release-24-2")
else:
mb.buildroot_resume()
assert new_task_id == task_id, "Component was already built. Expected same task_id (%s != %s). Fix it!" % (new_task_id, task_id)
task_id = mb.build(artifact_name="fedora-release",
source="git://pkgs.fedoraproject.org/rpms/fedora-release?#b1d65f349dca2f597b278a4aad9e41fb0aa96fc9")
@manager.command