1 import click
2 from coprs.logic import coprs_logic
3
4
5 from commands.create_chroot import create_chroot_function
6 from commands.rawhide_to_release import (
7 option_retry_forked,
8 rawhide_to_release_function,
9 )
10
11
12 @click.command()
13 @click.argument(
14 "fedora_version",
15 type=int
16 )
17 @option_retry_forked
18 @click.option(
19 "--dist-git-branch", "-b", "branch",
20 help="Branch name for this set of new chroots"
21 )
23 """
24 Branch fedora-rawhide-* chroots to fedora-N* and execute rawhide-to-release
25 on them
26 """
27 branch_fedora_function(fedora_version, retry_forked, branch)
28
31 """
32 Logic for branch_fedora, separated for the purpose of unit-testing.
33 """
34 rawhide_chroots = coprs_logic.MockChrootsLogic.get_from_name(
35 "fedora-rawhide",
36 active_only=True,
37 noarch=True).all()
38
39 chroot_pairs = {
40 'fedora-{}-{}'.format(fedora_version, rch.arch):
41 'fedora-rawhide-{}'.format(rch.arch)
42 for rch in rawhide_chroots
43 }
44
45 create_chroot_function(chroot_pairs.keys(), branch, False)
46
47 for new_chroot, rawhide_chroot in chroot_pairs.items():
48 rawhide_to_release_function(rawhide_chroot, new_chroot, retry_forked)
49