Emerge component support
This commit is contained in:
+14
-3
@@ -43,6 +43,8 @@ You can also give the name of a component.
|
|||||||
|
|
||||||
group = optparse.OptionGroup(self.parser, _("emerge options"))
|
group = optparse.OptionGroup(self.parser, _("emerge options"))
|
||||||
super(Emerge, self).add_options(group)
|
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",
|
group.add_option("--ignore-file-conflicts", action="store_true",
|
||||||
default=False, help=_("Ignore file conflicts"))
|
default=False, help=_("Ignore file conflicts"))
|
||||||
group.add_option("--ignore-package-conflicts", action="store_true",
|
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)
|
self.parser.add_option_group(group)
|
||||||
|
|
||||||
def run(self):
|
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()
|
self.help()
|
||||||
return
|
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'):
|
if ctx.get_option('output_dir'):
|
||||||
ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir)
|
ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir)
|
||||||
else:
|
else:
|
||||||
ctx.ui.info(_('Outputting binary packages in the package cache.'))
|
ctx.ui.info(_('Outputting binary packages in the package cache.'))
|
||||||
ctx.config.options.output_dir = ctx.config.cached_packages_dir()
|
ctx.config.options.output_dir = ctx.config.cached_packages_dir()
|
||||||
|
|
||||||
pisi.api.emerge(self.args)
|
pisi.api.emerge(sources)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user