From: Michael Tremer Date: Tue, 22 Mar 2011 11:40:47 +0000 (+0100) Subject: Add groupinstall command. X-Git-Tag: 0.9.3~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ce2764c14374f4a5d2abb489e58ee6803df4c30f;p=pakfire.git Add groupinstall command. --- diff --git a/pakfire/__init__.py b/pakfire/__init__.py index 267e13f9a..901680ec4 100644 --- a/pakfire/__init__.py +++ b/pakfire/__init__.py @@ -263,6 +263,11 @@ class Pakfire(object): repo.save() + def groupinstall(self, group): + pkgs = self.grouplist(group) + + self.install(pkgs) + def grouplist(self, group): pkgs = self.repos.get_by_group(group) diff --git a/pakfire/cli.py b/pakfire/cli.py index c30363102..517b76c85 100644 --- a/pakfire/cli.py +++ b/pakfire/cli.py @@ -52,6 +52,7 @@ class Cli(object): self.parse_command_update() self.parse_command_provides() self.parse_command_grouplist() + self.parse_command_groupinstall() # Finally parse all arguments from the command line and save them. self.args = self.parser.parse_args() @@ -71,6 +72,7 @@ class Cli(object): "search" : self.handle_search, "provides" : self.handle_provides, "grouplist" : self.handle_grouplist, + "groupinstall" : self.handle_groupinstall, } def parse_common_arguments(self): @@ -139,6 +141,15 @@ class Cli(object): help=_("Group name to search for.")) sub_grouplist.add_argument("action", action="store_const", const="grouplist") + def parse_command_groupinstall(self): + # Implement the "grouplist" command + sub_groupinstall = self.sub_commands.add_parser("groupinstall", + help=_("Install all packages that belong to the given group.")) + sub_groupinstall.add_argument("group", nargs=1, + help=_("Group name.")) + sub_groupinstall.add_argument("action", action="store_const", const="groupinstall") + + def run(self): action = self.args.action @@ -200,6 +211,9 @@ class Cli(object): for pkg in pkgs: print " * %s" % pkg + def handle_groupinstall(self): + self.pakfire.groupinstall(self.args.group[0]) + class CliBuilder(Cli): def __init__(self):