1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 """ Bodhi Initialization """
19
20 from os.path import isfile
21 from turbogears import config, update_config
22 from turbogears.database import PackageHub
23
24 hub = PackageHub("bodhi")
25 __connection__ = hub
26
27 releases = (
28 {
29 'name' : 'F7',
30 'long_name' : 'Fedora 7',
31 'dist_tag' : 'dist-fc7',
32 'id_prefix' : 'FEDORA'
33 },
34 )
35
46
48 """
49 Add packages that should suggest a reboot. Other than these packages, we
50 add a package to the database when its first update is added to the system
51 """
52 from bodhi.model import Package
53 for pkg in config.get('reboot_pkgs').split():
54 Package(name=pkg, suggest_reboot=True)
55
64
66 """ Load the appropriate configuration so we can get at the values """
67 configfile = 'prod.cfg'
68 if not isfile(configfile):
69 configfile = 'dev.cfg'
70 update_config(configfile=configfile, modulename='bodhi.config')
71
72
73
74
75 if __name__ == '__main__':
76 print "Initializing Bodhi\n"
77 load_config()
78 hub.begin()
79 clean_tables()
80 import_releases()
81 import_rebootpkgs()
82 hub.commit()
83