]> git.ipfire.org Git - pakfire.git/blob - python/pakfire/api.py
Merge branch 'signatures'
[pakfire.git] / python / pakfire / api.py
1 #!/usr/bin/python
2 ###############################################################################
3 # #
4 # Pakfire - The IPFire package management system #
5 # Copyright (C) 2011 Pakfire development team #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 import base
23 import client
24
25 from errors import *
26
27 Pakfire = base.Pakfire
28
29 def install(requires, **pakfire_args):
30 pakfire = Pakfire(**pakfire_args)
31
32 return pakfire.install(requires)
33
34 def resolvdep(pkgs, **pakfire_args):
35 pakfire = Pakfire(**pakfire_args)
36
37 return pakfire.resolvdep(pkgs)
38
39 def localinstall(files, **pakfire_args):
40 pakfire = Pakfire(**pakfire_args)
41
42 return pakfire.localinstall(files)
43
44 def reinstall(pkgs, **pakfire_args):
45 pakfire = Pakfire(**pakfire_args)
46
47 return pakfire.reinstall(pkgs)
48
49 def remove(what, **pakfire_args):
50 pakfire = Pakfire(**pakfire_args)
51
52 return pakfire.remove(what)
53
54 def update(pkgs, check=False, excludes=None, allow_vendorchange=False, allow_archchange=False, **pakfire_args):
55 pakfire = Pakfire(**pakfire_args)
56
57 return pakfire.update(pkgs, check=check, excludes=excludes,
58 allow_vendorchange=allow_vendorchange, allow_archchange=allow_archchange)
59
60 def downgrade(pkgs, allow_vendorchange=False, allow_archchange=False, **pakfire_args):
61 pakfire = Pakfire(**pakfire_args)
62
63 return pakfire.downgrade(pkgs,
64 allow_vendorchange=allow_vendorchange, allow_archchange=allow_archchange)
65
66 def info(patterns, **pakfire_args):
67 # Create pakfire instance.
68 pakfire = Pakfire(**pakfire_args)
69
70 return pakfire.info(patterns)
71
72 def search(pattern, **pakfire_args):
73 # Create pakfire instance.
74 pakfire = Pakfire(**pakfire_args)
75
76 return pakfire.search(pattern)
77
78 def groupinstall(group, **pakfire_args):
79 pakfire = Pakfire(**pakfire_args)
80
81 return pakfire.groupinstall(group)
82
83 def grouplist(group, **pakfire_args):
84 pakfire = Pakfire(**pakfire_args)
85
86 return pakfire.grouplist(group)
87
88 def _build(pkg, resultdir, **kwargs):
89 pakfire = Pakfire(mode="builder", **kwargs)
90
91 return pakfire._build(pkg, resultdir, **kwargs)
92
93 def build(pkg, **kwargs):
94 return Pakfire.build(pkg, **kwargs)
95
96 def shell(pkg, **kwargs):
97 return Pakfire.shell(pkg, **kwargs)
98
99 def dist(pkg, resultdir, **pakfire_args):
100 pakfire = Pakfire(**pakfire_args)
101
102 return pakfire.dist(pkg, resultdir)
103
104 def provides(patterns, **pakfire_args):
105 # Create pakfire instance.
106 pakfire = Pakfire(**pakfire_args)
107
108 return pakfire.provides(patterns)
109
110 def requires(patterns, **pakfire_args):
111 # Create pakfire instance.
112 pakfire = Pakfire(**pakfire_args)
113
114 return pakfire.requires(requires)
115
116 def repo_create(path, input_paths, key_id=None, type="binary", **pakfire_args):
117 pakfire = Pakfire(**pakfire_args)
118
119 return pakfire.repo_create(path, input_paths, key_id=key_id, type=type)
120
121 def repo_list(**pakfire_args):
122 pakfire = Pakfire(**pakfire_args)
123
124 return pakfire.repo_list()
125
126 def clean_all(**pakfire_args):
127 pakfire = Pakfire(**pakfire_args)
128
129 return pakfire.clean_all()
130
131 def check(**pakfire_args):
132 pakfire = Pakfire(**pakfire_args)
133
134 return pakfire.check()
135
136 # Cache functions
137 def cache_create(**pakfire_args):
138 return Pakfire.cache_create(**pakfire_args)
139
140
141 # Key functions.
142
143 def key_init(**pakfire_args):
144 pakfire = Pakfire(**pakfire_args)
145
146 return pakfire.keyring.init()
147
148 def key_generate(realname, email, **pakfire_args):
149 pakfire = Pakfire(**pakfire_args)
150
151 return pakfire.keyring.gen_key(realname, email)
152
153 def key_import(keyfile, **pakfire_args):
154 pakfire = Pakfire(**pakfire_args)
155
156 return pakfire.keyring.import_key(keyfile)
157
158 def key_export(keyid, keyfile, **pakfire_args):
159 pakfire = Pakfire(**pakfire_args)
160
161 return pakfire.keyring.export_key(keyid, keyfile)
162
163 def key_delete(keyid, **pakfire_args):
164 pakfire = Pakfire(**pakfire_args)
165
166 return pakfire.keyring.delete_key(keyid)
167
168 def key_list(**pakfire_args):
169 pakfire = Pakfire(**pakfire_args)
170
171 return pakfire.keyring.list_keys()