diff --git a/pisi/cli/emerge.py b/pisi/cli/emerge.py index 8b2d01ac..f4d5e60f 100644 --- a/pisi/cli/emerge.py +++ b/pisi/cli/emerge.py @@ -43,6 +43,8 @@ You can also give the name of a component. group = optparse.OptionGroup(self.parser, _("emerge options")) super(Emerge, self).add_options(group) + group.add_option("-c", "--component", action="store", + default=None, help=_("Emerge available packages under given component")) group.add_option("--ignore-file-conflicts", action="store_true", default=False, help=_("Ignore file conflicts")) group.add_option("--ignore-package-conflicts", action="store_true", @@ -52,15 +54,24 @@ You can also give the name of a component. self.parser.add_option_group(group) def run(self): - if not self.args: + self.init(database = True) + + component = ctx.get_option('component') + if not self.args and not component: self.help() return - self.init(database = True) + if component: + componentdb = pisi.db.componentdb.ComponentDB() + sources = componentdb.get_union_sources(component, walk=True) + else: + sources = self.args + if ctx.get_option('output_dir'): ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting binary packages in the package cache.')) ctx.config.options.output_dir = ctx.config.cached_packages_dir() - pisi.api.emerge(self.args) + pisi.api.emerge(sources) +