]>
Commit | Line | Data |
---|---|---|
47a4cb89 MT |
1 | #!/usr/bin/python |
2 | ||
3 | import argparse | |
4 | import sys | |
5 | ||
6 | import packages | |
fa6d335b | 7 | import repository |
677ff42a | 8 | import server |
e9c20259 | 9 | import util |
47a4cb89 | 10 | |
18edfe75 | 11 | import pakfire.api as pakfire |
47a4cb89 MT |
12 | from constants import * |
13 | from i18n import _ | |
14 | ||
47a4cb89 | 15 | class Cli(object): |
47a4cb89 MT |
16 | def __init__(self): |
17 | self.parser = argparse.ArgumentParser( | |
18 | description = _("Pakfire command line interface."), | |
19 | ) | |
20 | ||
21 | self.parse_common_arguments() | |
22 | ||
23 | self.parser.add_argument("--instroot", metavar="PATH", | |
d2e26956 | 24 | default="/", |
47a4cb89 MT |
25 | help=_("The path where pakfire should operate in.")) |
26 | ||
27 | # Add sub-commands. | |
28 | self.sub_commands = self.parser.add_subparsers() | |
29 | ||
30 | self.parse_command_install() | |
5e87fa4f | 31 | self.parse_command_localinstall() |
a39fd08b | 32 | self.parse_command_remove() |
47a4cb89 MT |
33 | self.parse_command_info() |
34 | self.parse_command_search() | |
35 | self.parse_command_update() | |
fa6d335b | 36 | self.parse_command_provides() |
c1962d40 | 37 | self.parse_command_grouplist() |
ce2764c1 | 38 | self.parse_command_groupinstall() |
67bc4528 | 39 | self.parse_command_repolist() |
31267a64 | 40 | self.parse_command_clean() |
47a4cb89 MT |
41 | |
42 | # Finally parse all arguments from the command line and save them. | |
43 | self.args = self.parser.parse_args() | |
44 | ||
47a4cb89 | 45 | self.action2func = { |
5e87fa4f MT |
46 | "install" : self.handle_install, |
47 | "localinstall" : self.handle_localinstall, | |
a39fd08b | 48 | "remove" : self.handle_remove, |
5e87fa4f MT |
49 | "update" : self.handle_update, |
50 | "info" : self.handle_info, | |
51 | "search" : self.handle_search, | |
fa6d335b | 52 | "provides" : self.handle_provides, |
c1962d40 | 53 | "grouplist" : self.handle_grouplist, |
ce2764c1 | 54 | "groupinstall" : self.handle_groupinstall, |
67bc4528 | 55 | "repolist" : self.handle_repolist, |
31267a64 | 56 | "clean_all" : self.handle_clean_all, |
47a4cb89 MT |
57 | } |
58 | ||
7c8f2953 MT |
59 | @property |
60 | def pakfire_args(self): | |
6557ff4c MT |
61 | ret = { "mode" : "normal" } |
62 | ||
63 | if hasattr(self.args, "instroot"): | |
64 | ret["path"] = self.args.instroot | |
f9a012a8 MT |
65 | |
66 | if hasattr(self.args, "disable_repo"): | |
67 | ret["disable_repos"] = self.args.disable_repo | |
68 | ||
69 | if hasattr(self.args, "enable_repo"): | |
70 | ret["enable_repos"] = self.args.enable_repo | |
71 | ||
72 | return ret | |
7c8f2953 | 73 | |
47a4cb89 MT |
74 | def parse_common_arguments(self): |
75 | self.parser.add_argument("-v", "--verbose", action="store_true", | |
76 | help=_("Enable verbose output.")) | |
77 | ||
78 | self.parser.add_argument("-c", "--config", nargs="?", | |
79 | help=_("Path to a configuration file to load.")) | |
80 | ||
f781b1ab MT |
81 | self.parser.add_argument("--disable-repo", nargs="*", metavar="REPO", |
82 | help=_("Disable a repository temporarily.")) | |
83 | ||
f9a012a8 MT |
84 | self.parser.add_argument("--enabled-repo", nargs="*", metavar="REPO", |
85 | help=_("Enable a repository temporarily.")) | |
86 | ||
47a4cb89 MT |
87 | def parse_command_install(self): |
88 | # Implement the "install" command. | |
89 | sub_install = self.sub_commands.add_parser("install", | |
90 | help=_("Install one or more packages to the system.")) | |
91 | sub_install.add_argument("package", nargs="+", | |
92 | help=_("Give name of at least one package to install.")) | |
93 | sub_install.add_argument("action", action="store_const", const="install") | |
94 | ||
5e87fa4f MT |
95 | def parse_command_localinstall(self): |
96 | # Implement the "localinstall" command. | |
97 | sub_install = self.sub_commands.add_parser("localinstall", | |
98 | help=_("Install one or more packages from the filesystem.")) | |
99 | sub_install.add_argument("package", nargs="+", | |
100 | help=_("Give filename of at least one package.")) | |
101 | sub_install.add_argument("action", action="store_const", const="localinstall") | |
102 | ||
a39fd08b MT |
103 | def parse_command_remove(self): |
104 | # Implement the "remove" command. | |
105 | sub_remove = self.sub_commands.add_parser("remove", | |
106 | help=_("Remove one or more packages from the system.")) | |
107 | sub_remove.add_argument("package", nargs="+", | |
108 | help=_("Give name of at least one package to remove.")) | |
109 | sub_remove.add_argument("action", action="store_const", const="remove") | |
110 | ||
47a4cb89 MT |
111 | def parse_command_update(self): |
112 | # Implement the "update" command. | |
113 | sub_update = self.sub_commands.add_parser("update", | |
114 | help=_("Update the whole system or one specific package.")) | |
115 | sub_update.add_argument("package", nargs="*", | |
116 | help=_("Give a name of a package to update or leave emtpy for all.")) | |
117 | sub_update.add_argument("action", action="store_const", const="update") | |
118 | ||
119 | def parse_command_info(self): | |
120 | # Implement the "info" command. | |
121 | sub_info = self.sub_commands.add_parser("info", | |
122 | help=_("Print some information about the given package(s).")) | |
123 | sub_info.add_argument("package", nargs="+", | |
124 | help=_("Give at least the name of one package.")) | |
125 | sub_info.add_argument("action", action="store_const", const="info") | |
126 | ||
127 | def parse_command_search(self): | |
128 | # Implement the "search" command. | |
129 | sub_search = self.sub_commands.add_parser("search", | |
130 | help=_("Search for a given pattern.")) | |
131 | sub_search.add_argument("pattern", | |
132 | help=_("A pattern to search for.")) | |
133 | sub_search.add_argument("action", action="store_const", const="search") | |
134 | ||
fa6d335b MT |
135 | def parse_command_provides(self): |
136 | # Implement the "provides" command | |
137 | sub_provides = self.sub_commands.add_parser("provides", | |
138 | help=_("Get a list of packages that provide a given file or feature.")) | |
139 | sub_provides.add_argument("pattern", nargs="+", | |
140 | help=_("File or feature to search for.")) | |
141 | sub_provides.add_argument("action", action="store_const", const="provides") | |
142 | ||
c1962d40 MT |
143 | def parse_command_grouplist(self): |
144 | # Implement the "grouplist" command | |
145 | sub_grouplist = self.sub_commands.add_parser("grouplist", | |
146 | help=_("Get list of packages that belong to the given group.")) | |
147 | sub_grouplist.add_argument("group", nargs=1, | |
148 | help=_("Group name to search for.")) | |
149 | sub_grouplist.add_argument("action", action="store_const", const="grouplist") | |
150 | ||
ce2764c1 MT |
151 | def parse_command_groupinstall(self): |
152 | # Implement the "grouplist" command | |
153 | sub_groupinstall = self.sub_commands.add_parser("groupinstall", | |
154 | help=_("Install all packages that belong to the given group.")) | |
155 | sub_groupinstall.add_argument("group", nargs=1, | |
156 | help=_("Group name.")) | |
157 | sub_groupinstall.add_argument("action", action="store_const", const="groupinstall") | |
158 | ||
67bc4528 MT |
159 | def parse_command_repolist(self): |
160 | # Implement the "repolist" command | |
161 | sub_repolist = self.sub_commands.add_parser("repolist", | |
162 | help=_("List all currently enabled repositories.")) | |
163 | sub_repolist.add_argument("action", action="store_const", const="repolist") | |
ce2764c1 | 164 | |
31267a64 MT |
165 | def parse_command_clean(self): |
166 | sub_clean = self.sub_commands.add_parser("clean", help=_("Cleanup commands.")) | |
167 | ||
168 | sub_clean_commands = sub_clean.add_subparsers() | |
169 | ||
170 | self.parse_command_clean_all(sub_clean_commands) | |
171 | ||
172 | def parse_command_clean_all(self, sub_commands): | |
173 | sub_create = sub_commands.add_parser("all", | |
174 | help=_("Cleanup all temporary files.")) | |
175 | sub_create.add_argument("action", action="store_const", const="clean_all") | |
176 | ||
47a4cb89 MT |
177 | def run(self): |
178 | action = self.args.action | |
179 | ||
180 | if not self.action2func.has_key(action): | |
181 | raise | |
182 | ||
183 | try: | |
184 | func = self.action2func[action] | |
185 | except KeyError: | |
186 | raise # XXX catch and return better error message | |
187 | ||
188 | return func() | |
189 | ||
9afa5620 | 190 | def handle_info(self, long=False): |
7c8f2953 | 191 | pkgs = pakfire.info(self.args.package, **self.pakfire_args) |
47a4cb89 | 192 | |
7c8f2953 MT |
193 | for pkg in pkgs: |
194 | print pkg.dump(long=long) | |
47a4cb89 MT |
195 | |
196 | def handle_search(self): | |
7c8f2953 | 197 | pkgs = pakfire.search(self.args.pattern, **self.pakfire_args) |
47a4cb89 MT |
198 | |
199 | for pkg in pkgs: | |
200 | print pkg.dump(short=True) | |
201 | ||
202 | def handle_update(self): | |
7c8f2953 | 203 | pakfire.update(self.args.package, **self.pakfire_args) |
47a4cb89 | 204 | |
e0b99370 MT |
205 | def handle_install(self): |
206 | pakfire.install(self.args.package, **self.pakfire_args) | |
5e87fa4f MT |
207 | |
208 | def handle_localinstall(self): | |
e0b99370 | 209 | pakfire.localinstall(self.args.package, **self.pakfire_args) |
5e87fa4f | 210 | |
a39fd08b MT |
211 | def handle_remove(self): |
212 | pakfire.remove(self.args.package, **self.pakfire_args) | |
213 | ||
fa6d335b | 214 | def handle_provides(self): |
7c8f2953 | 215 | pkgs = pakfire.provides(self.args.pattern, **self.pakfire_args) |
fa6d335b MT |
216 | |
217 | for pkg in pkgs: | |
218 | print pkg.dump() | |
219 | ||
c1962d40 | 220 | def handle_grouplist(self): |
7c8f2953 | 221 | pkgs = pakfire.grouplist(self.args.group[0], **self.pakfire_args) |
c1962d40 MT |
222 | |
223 | for pkg in pkgs: | |
224 | print " * %s" % pkg | |
225 | ||
ce2764c1 | 226 | def handle_groupinstall(self): |
7c8f2953 | 227 | pakfire.groupinstall(self.args.group[0], **self.pakfire_args) |
ce2764c1 | 228 | |
67bc4528 | 229 | def handle_repolist(self): |
7c8f2953 | 230 | repos = pakfire.repo_list(**self.pakfire_args) |
67bc4528 | 231 | |
c605d735 | 232 | FORMAT = " %-20s %8s %12s %12s " |
67bc4528 | 233 | |
c605d735 | 234 | title = FORMAT % (_("Repository"), _("Enabled"), _("Priority"), _("Packages")) |
67bc4528 MT |
235 | print title |
236 | print "=" * len(title) # spacing line | |
237 | ||
238 | for repo in repos: | |
239 | # Skip the installed repository. | |
240 | if repo.name == "installed": | |
241 | continue | |
242 | ||
c605d735 | 243 | print FORMAT % (repo.name, repo.enabled, repo.priority, len(repo)) |
67bc4528 | 244 | |
31267a64 MT |
245 | def handle_clean_all(self): |
246 | print _("Cleaning up everything...") | |
247 | ||
248 | pakfire.clean_all(**self.pakfire_args) | |
249 | ||
47a4cb89 MT |
250 | |
251 | class CliBuilder(Cli): | |
252 | def __init__(self): | |
253 | self.parser = argparse.ArgumentParser( | |
254 | description = _("Pakfire builder command line interface."), | |
255 | ) | |
256 | ||
257 | self.parse_common_arguments() | |
258 | ||
259 | # Add sub-commands. | |
260 | self.sub_commands = self.parser.add_subparsers() | |
261 | ||
262 | self.parse_command_build() | |
263 | self.parse_command_dist() | |
264 | self.parse_command_info() | |
265 | self.parse_command_search() | |
266 | self.parse_command_shell() | |
267 | self.parse_command_update() | |
4fbd4216 | 268 | self.parse_command_provides() |
2c84aceb | 269 | self.parse_command_grouplist() |
67bc4528 | 270 | self.parse_command_repolist() |
31267a64 | 271 | self.parse_command_clean() |
47a4cb89 MT |
272 | |
273 | # Finally parse all arguments from the command line and save them. | |
274 | self.args = self.parser.parse_args() | |
275 | ||
47a4cb89 | 276 | self.action2func = { |
fa6d335b MT |
277 | "build" : self.handle_build, |
278 | "dist" : self.handle_dist, | |
279 | "update" : self.handle_update, | |
280 | "info" : self.handle_info, | |
281 | "search" : self.handle_search, | |
282 | "shell" : self.handle_shell, | |
4fbd4216 | 283 | "provides" : self.handle_provides, |
2c84aceb | 284 | "grouplist" : self.handle_grouplist, |
67bc4528 | 285 | "repolist" : self.handle_repolist, |
31267a64 | 286 | "clean_all" : self.handle_clean_all, |
47a4cb89 MT |
287 | } |
288 | ||
7c8f2953 MT |
289 | @property |
290 | def pakfire_args(self): | |
6557ff4c | 291 | ret = { "mode" : "builder" } |
f9a012a8 MT |
292 | |
293 | if hasattr(self.args, "disable_repo"): | |
294 | ret["disable_repos"] = self.args.disable_repo | |
295 | ||
296 | if hasattr(self.args, "enable_repo"): | |
297 | ret["enable_repos"] = self.args.enable_repo | |
298 | ||
299 | return ret | |
7c8f2953 | 300 | |
47a4cb89 MT |
301 | def parse_command_update(self): |
302 | # Implement the "update" command. | |
303 | sub_update = self.sub_commands.add_parser("update", | |
304 | help=_("Update the package indexes.")) | |
305 | sub_update.add_argument("action", action="store_const", const="update") | |
306 | ||
307 | def parse_command_build(self): | |
308 | # Implement the "build" command. | |
309 | sub_build = self.sub_commands.add_parser("build", | |
310 | help=_("Build one or more packages.")) | |
311 | sub_build.add_argument("package", nargs=1, | |
312 | help=_("Give name of at least one package to build.")) | |
313 | sub_build.add_argument("action", action="store_const", const="build") | |
314 | ||
315 | sub_build.add_argument("-a", "--arch", | |
316 | help=_("Build the package for the given architecture.")) | |
317 | sub_build.add_argument("--resultdir", nargs="?", | |
318 | help=_("Path were the output files should be copied to.")) | |
f22069bb MT |
319 | sub_build.add_argument("-m", "--mode", nargs="?", default="development", |
320 | help=_("Mode to run in. Is either 'release' or 'development' (default).")) | |
47a4cb89 MT |
321 | |
322 | def parse_command_shell(self): | |
323 | # Implement the "shell" command. | |
324 | sub_shell = self.sub_commands.add_parser("shell", | |
325 | help=_("Go into a shell.")) | |
042266f3 | 326 | sub_shell.add_argument("package", nargs="?", |
47a4cb89 MT |
327 | help=_("Give name of a package.")) |
328 | sub_shell.add_argument("action", action="store_const", const="shell") | |
329 | ||
330 | sub_shell.add_argument("-a", "--arch", | |
331 | help=_("Emulated architecture in the shell.")) | |
6ee3d6b9 MT |
332 | sub_shell.add_argument("-m", "--mode", nargs="?", default="development", |
333 | help=_("Mode to run in. Is either 'release' or 'development' (default).")) | |
47a4cb89 MT |
334 | |
335 | def parse_command_dist(self): | |
336 | # Implement the "dist" command. | |
337 | sub_dist = self.sub_commands.add_parser("dist", | |
338 | help=_("Generate a source package.")) | |
e412b8dc MT |
339 | sub_dist.add_argument("package", nargs="+", |
340 | help=_("Give name(s) of a package(s).")) | |
47a4cb89 MT |
341 | sub_dist.add_argument("action", action="store_const", const="dist") |
342 | ||
343 | sub_dist.add_argument("--resultdir", nargs="?", | |
344 | help=_("Path were the output files should be copied to.")) | |
345 | ||
9afa5620 MT |
346 | def handle_info(self): |
347 | Cli.handle_info(self, long=True) | |
348 | ||
47a4cb89 | 349 | def handle_build(self): |
47a4cb89 MT |
350 | # Get the package descriptor from the command line options |
351 | pkg = self.args.package[0] | |
352 | ||
353 | # Check, if we got a regular file | |
354 | if os.path.exists(pkg): | |
355 | pkg = os.path.abspath(pkg) | |
356 | ||
47a4cb89 | 357 | else: |
7c8f2953 | 358 | raise FileNotFoundError, pkg |
47a4cb89 | 359 | |
7c8f2953 MT |
360 | # Create distribution configuration from command line. |
361 | distro_config = { | |
362 | "arch" : self.args.arch, | |
363 | } | |
364 | ||
f22069bb MT |
365 | pakfire.build(pkg, builder_mode=self.args.mode, distro_config=distro_config, |
366 | resultdirs=[self.args.resultdir,], shell=True, **self.pakfire_args) | |
47a4cb89 MT |
367 | |
368 | def handle_shell(self): | |
042266f3 MT |
369 | pkg = None |
370 | ||
47a4cb89 | 371 | # Get the package descriptor from the command line options |
042266f3 | 372 | if self.args.package: |
ad1b844f | 373 | pkg = self.args.package |
47a4cb89 | 374 | |
7c8f2953 MT |
375 | # Check, if we got a regular file |
376 | if os.path.exists(pkg): | |
377 | pkg = os.path.abspath(pkg) | |
47a4cb89 | 378 | |
7c8f2953 MT |
379 | else: |
380 | raise FileNotFoundError, pkg | |
47a4cb89 | 381 | |
7c8f2953 MT |
382 | # Create distribution configuration from command line. |
383 | distro_config = { | |
384 | "arch" : self.args.arch, | |
385 | } | |
47a4cb89 | 386 | |
6ee3d6b9 MT |
387 | pakfire.shell(pkg, builder_mode=self.args.mode, |
388 | distro_config=distro_config, **self.pakfire_args) | |
47a4cb89 MT |
389 | |
390 | def handle_dist(self): | |
e412b8dc MT |
391 | # Get the packages from the command line options |
392 | pkgs = [] | |
47a4cb89 | 393 | |
e412b8dc MT |
394 | for pkg in self.args.package: |
395 | # Check, if we got a regular file | |
396 | if os.path.exists(pkg): | |
397 | pkg = os.path.abspath(pkg) | |
7c8f2953 | 398 | pkgs.append(pkg) |
47a4cb89 | 399 | |
e412b8dc | 400 | else: |
7c8f2953 MT |
401 | raise FileNotFoundError, pkg |
402 | ||
6519843a MT |
403 | pakfire.dist(pkgs, resultdirs=[self.args.resultdir,], |
404 | **self.pakfire_args) | |
47a4cb89 | 405 | |
c605d735 MT |
406 | def handle_provides(self): |
407 | pkgs = pakfire.provides(self.args.pattern, **self.pakfire_args) | |
408 | ||
409 | for pkg in pkgs: | |
410 | print pkg.dump(long=True) | |
411 | ||
47a4cb89 | 412 | |
9613a111 | 413 | class CliRepo(Cli): |
92806f47 MT |
414 | def __init__(self): |
415 | self.parser = argparse.ArgumentParser( | |
9613a111 | 416 | description = _("Pakfire repo command line interface."), |
92806f47 MT |
417 | ) |
418 | ||
419 | self.parse_common_arguments() | |
420 | ||
421 | # Add sub-commands. | |
422 | self.sub_commands = self.parser.add_subparsers() | |
423 | ||
424 | self.parse_command_repo() | |
425 | ||
426 | # Finally parse all arguments from the command line and save them. | |
427 | self.args = self.parser.parse_args() | |
428 | ||
92806f47 MT |
429 | self.action2func = { |
430 | "repo_create" : self.handle_repo_create, | |
431 | } | |
432 | ||
6557ff4c MT |
433 | @property |
434 | def pakfire_args(self): | |
435 | ret = { "mode" : "repo" } | |
436 | ||
437 | return ret | |
438 | ||
92806f47 MT |
439 | def parse_command_repo(self): |
440 | sub_repo = self.sub_commands.add_parser("repo", | |
441 | help=_("Repository management commands.")) | |
442 | ||
443 | sub_repo_commands = sub_repo.add_subparsers() | |
444 | ||
445 | self.parse_command_repo_create(sub_repo_commands) | |
446 | ||
447 | def parse_command_repo_create(self, sub_commands): | |
448 | sub_create = sub_commands.add_parser("create", | |
449 | help=_("Create a new repository index.")) | |
450 | sub_create.add_argument("path", nargs=1, help=_("Path to the packages.")) | |
451 | sub_create.add_argument("inputs", nargs="+", help=_("Path to input packages.")) | |
452 | sub_create.add_argument("action", action="store_const", const="repo_create") | |
453 | ||
fa6d335b MT |
454 | def handle_repo_create(self): |
455 | path = self.args.path[0] | |
456 | ||
7c8f2953 | 457 | pakfire.repo_create(path, self.args.inputs, **self.pakfire_args) |
9613a111 MT |
458 | |
459 | ||
460 | class CliMaster(Cli): | |
677ff42a MT |
461 | def __init__(self): |
462 | self.parser = argparse.ArgumentParser( | |
463 | description = _("Pakfire master command line interface."), | |
464 | ) | |
465 | ||
466 | self.parse_common_arguments() | |
467 | ||
468 | # Add sub-commands. | |
469 | self.sub_commands = self.parser.add_subparsers() | |
470 | ||
471 | self.parse_command_update() | |
472 | ||
473 | # Finally parse all arguments from the command line and save them. | |
474 | self.args = self.parser.parse_args() | |
475 | ||
7c8f2953 | 476 | self.master = server.master.Master() |
677ff42a MT |
477 | |
478 | self.action2func = { | |
479 | "update" : self.handle_update, | |
480 | } | |
481 | ||
6557ff4c MT |
482 | @property |
483 | def pakfire_args(self): | |
484 | ret = { "mode" : "master" } | |
485 | ||
486 | return ret | |
487 | ||
677ff42a MT |
488 | def parse_command_update(self): |
489 | # Implement the "update" command. | |
490 | sub_update = self.sub_commands.add_parser("update", | |
491 | help=_("Update the sources.")) | |
492 | sub_update.add_argument("action", action="store_const", const="update") | |
493 | ||
494 | def handle_update(self): | |
495 | self.master.update_sources() | |
9613a111 MT |
496 | |
497 | ||
3ad4bb5a | 498 | class CliServer(Cli): |
677ff42a MT |
499 | def __init__(self): |
500 | self.parser = argparse.ArgumentParser( | |
3ad4bb5a | 501 | description = _("Pakfire server command line interface."), |
677ff42a MT |
502 | ) |
503 | ||
504 | self.parse_common_arguments() | |
505 | ||
506 | # Add sub-commands. | |
507 | self.sub_commands = self.parser.add_subparsers() | |
508 | ||
a52f536c | 509 | self.parse_command_build() |
677ff42a | 510 | self.parse_command_keepalive() |
8276111d | 511 | self.parse_command_repoupdate() |
677ff42a MT |
512 | |
513 | # Finally parse all arguments from the command line and save them. | |
514 | self.args = self.parser.parse_args() | |
515 | ||
3ad4bb5a | 516 | self.server = server.Server() |
677ff42a MT |
517 | |
518 | self.action2func = { | |
8276111d MT |
519 | "build" : self.handle_build, |
520 | "keepalive" : self.handle_keepalive, | |
521 | "repoupdate" : self.handle_repoupdate, | |
677ff42a MT |
522 | } |
523 | ||
6557ff4c MT |
524 | @property |
525 | def pakfire_args(self): | |
526 | ret = { "mode" : "server" } | |
527 | ||
528 | return ret | |
529 | ||
a52f536c MT |
530 | def parse_command_build(self): |
531 | # Implement the "build" command. | |
532 | sub_keepalive = self.sub_commands.add_parser("build", | |
533 | help=_("Request a build job from the server.")) | |
534 | sub_keepalive.add_argument("action", action="store_const", const="build") | |
535 | ||
677ff42a MT |
536 | def parse_command_keepalive(self): |
537 | # Implement the "keepalive" command. | |
538 | sub_keepalive = self.sub_commands.add_parser("keepalive", | |
539 | help=_("Send a keepalive to the server.")) | |
540 | sub_keepalive.add_argument("action", action="store_const", | |
541 | const="keepalive") | |
542 | ||
8276111d MT |
543 | def parse_command_repoupdate(self): |
544 | # Implement the "repoupdate" command. | |
545 | sub_repoupdate = self.sub_commands.add_parser("repoupdate", | |
546 | help=_("Update all repositories.")) | |
547 | sub_repoupdate.add_argument("action", action="store_const", | |
548 | const="repoupdate") | |
549 | ||
677ff42a | 550 | def handle_keepalive(self): |
3ad4bb5a | 551 | self.server.update_info() |
9613a111 | 552 | |
a52f536c | 553 | def handle_build(self): |
3ad4bb5a | 554 | self.server.build_job() |
8276111d MT |
555 | |
556 | def handle_repoupdate(self): | |
557 | self.server.update_repositories() |