| |
@@ -17,13 +17,22 @@
|
| |
"dest_chroot",
|
| |
required=True
|
| |
)
|
| |
- def rawhide_to_release(rawhide_chroot, dest_chroot):
|
| |
+ @click.option(
|
| |
+ "--retry-forked/--no-retry-forked",
|
| |
+ default=False,
|
| |
+ help=(
|
| |
+ "Generate actions for backend also for already forked builds, useful "
|
| |
+ "e.g. when previous run of this command failed."
|
| |
+ )
|
| |
+ )
|
| |
+ def rawhide_to_release(rawhide_chroot, dest_chroot, retry_forked):
|
| |
"""
|
| |
Branching
|
| |
"""
|
| |
- return rawhide_to_release_function(rawhide_chroot, dest_chroot)
|
| |
+ return rawhide_to_release_function(rawhide_chroot, dest_chroot,
|
| |
+ retry_forked)
|
| |
|
| |
- def rawhide_to_release_function(rawhide_chroot, dest_chroot):
|
| |
+ def rawhide_to_release_function(rawhide_chroot, dest_chroot, retry_forked):
|
| |
mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(dest_chroot).first()
|
| |
if not mock_chroot:
|
| |
print("Given chroot does not exist. Please run:")
|
| |
@@ -79,8 +88,10 @@
|
| |
continue
|
| |
|
| |
for build in fork_builds:
|
| |
- if mock_chroot in build.chroots:
|
| |
- # forked chroot already exists, from previous run?
|
| |
+ chroot_exists = mock_chroot in build.chroots
|
| |
+
|
| |
+ if chroot_exists and not retry_forked:
|
| |
+ # this build should already be forked
|
| |
continue
|
| |
|
| |
# rbc means rawhide_build_chroot (we needed short variable)
|
| |
@@ -89,13 +100,17 @@
|
| |
if rbc.mock_chroot == mock_rawhide_chroot:
|
| |
break
|
| |
|
| |
- dest_build_chroot = models.BuildChroot(**rbc.to_dict())
|
| |
- dest_build_chroot.mock_chroot_id = mock_chroot.id
|
| |
- dest_build_chroot.mock_chroot = mock_chroot
|
| |
- dest_build_chroot.status = StatusEnum("forked")
|
| |
- db.session.add(dest_build_chroot)
|
| |
-
|
| |
- data['builds'].append(build.result_dir)
|
| |
+ if not chroot_exists:
|
| |
+ # forked chroot may already exists, e.g. from prevoius
|
| |
+ # 'rawhide-to-release-run'
|
| |
+ dest_build_chroot = models.BuildChroot(**rbc.to_dict())
|
| |
+ dest_build_chroot.mock_chroot_id = mock_chroot.id
|
| |
+ dest_build_chroot.mock_chroot = mock_chroot
|
| |
+ dest_build_chroot.status = StatusEnum("forked")
|
| |
+ db.session.add(dest_build_chroot)
|
| |
+
|
| |
+ if rbc.result_dir:
|
| |
+ data['builds'].append(rbc.result_dir)
|
| |
|
| |
if len(data["builds"]):
|
| |
actions_logic.ActionsLogic.send_rawhide_to_release(data)
|
| |