Package commands :: Module create_chroot
[hide private]
[frames] | no frames]

Source Code for Module commands.create_chroot

 1  from flask_script import Command, Option 
 2  from coprs import exceptions 
 3  from coprs import db 
 4  from coprs.helpers import chroot_to_branch 
 5  from coprs.logic import coprs_logic 
 6   
 7   
8 -class ChrootCommand(Command):
9
10 - def print_invalid_format(self, chroot_name):
11 print( 12 "{0} - invalid chroot format, must be '{release}-{version}-{arch}'." 13 .format(chroot_name))
14
15 - def print_already_exists(self, chroot_name):
16 print("{0} - already exists.".format(chroot_name))
17
18 - def print_doesnt_exist(self, chroot_name):
19 print("{0} - chroot doesn\"t exist.".format(chroot_name))
20 21 option_list = ( 22 Option("chroot_names", 23 help="Chroot name, e.g. fedora-18-x86_64.", 24 nargs="+"), 25 )
26 27
28 -class CreateChrootCommand(ChrootCommand):
29 30 "Creates a mock chroot in DB" 31
32 - def __init__(self):
33 self.option_list += ( 34 Option( 35 "--dist-git-branch", 36 "-b", 37 dest="branch", 38 help="Branch name for this set of new chroots"), 39 Option( 40 "--deactivated", 41 action="store_true", 42 help="Activate the chroot later, manually by `alter_chroot`" 43 ), 44 )
45
46 - def run(self, chroot_names, branch=None, deactivated=False):
60