1 import click
2 from coprs.logic import coprs_logic
3
4 from commands.create_chroot import create_chroot_function
5 from commands.rawhide_to_release import rawhide_to_release_function
6
7
8 @click.command()
9 @click.argument(
10 "fedora_version",
11 type=int
12 )
13 @click.option(
14 "--retry-forked/--no-retry-forked",
15 default=False,
16 help=(
17 "Generate actions for backend also for already forked builds, useful "
18 "e.g. when previous run of this command failed."
19 )
20 )
21 @click.option(
22 "--dist-git-branch", "-b", "branch",
23 help="Branch name for this set of new chroots"
24 )
26 """
27 Branch fedora-rawhide-* chroots to fedora-N* and execute rawhide-to-release
28 on them
29 """
30 rawhide_chroots = coprs_logic.MockChrootsLogic.get_from_name(
31 "fedora-rawhide",
32 active_only=True,
33 noarch=True).all()
34
35 chroot_pairs = {
36 'fedora-{}-{}'.format(fedora_version, rch.arch):
37 'fedora-rawhide-{}'.format(rch.arch)
38 for rch in rawhide_chroots
39 }
40
41 create_chroot_function(chroot_pairs.keys(), branch, False)
42
43 for new_chroot, rawhide_chroot in chroot_pairs.items():
44 rawhide_to_release_function(rawhide_chroot, new_chroot, retry_forked)
45