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 "--dist-git-branch", "-b", "branch",
15 help="Branch name for this set of new chroots"
16 )
18 """
19 Branch fedora-rawhide-* chroots to fedora-N* and execute rawhide-to-release
20 on them
21 """
22 rawhide_chroots = coprs_logic.MockChrootsLogic.get_from_name(
23 "fedora-rawhide",
24 active_only=True,
25 noarch=True).all()
26
27 chroot_pairs = {
28 'fedora-{}-{}'.format(fedora_version, rch.arch):
29 'fedora-rawhide-{}'.format(rch.arch)
30 for rch in rawhide_chroots
31 }
32
33 create_chroot_function(chroot_pairs.keys(), branch, True)
34
35 for new_chroot, rawhide_chroot in chroot_pairs.items():
36 rawhide_to_release_function(rawhide_chroot, new_chroot)
37