* pisi lu -c component. Ones again this is not recursive.
pisi api is the next big thing to work on :) pisi api is next thing to work on.
This commit is contained in:
+15
-5
@@ -1306,20 +1306,30 @@ Lists the packages that will be upgraded.
|
|||||||
buildno_opts(self, group)
|
buildno_opts(self, group)
|
||||||
group.add_option("-l", "--long", action="store_true",
|
group.add_option("-l", "--long", action="store_true",
|
||||||
default=False, help=_("show in long format"))
|
default=False, help=_("show in long format"))
|
||||||
|
group.add_option("-c", "--component", action="store",
|
||||||
|
default=None, help=_("list upgradable packages under given component"))
|
||||||
group.add_option("-i", "--install-info", action="store_true",
|
group.add_option("-i", "--install-info", action="store_true",
|
||||||
default=False, help=_("show detailed install info"))
|
default=False, help=_("show detailed install info"))
|
||||||
self.parser.add_option_group(group)
|
self.parser.add_option_group(group)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.init(database = True, write = False)
|
self.init(database = True, write = False)
|
||||||
list = pisi.api.list_upgradable()
|
upgradable_pkgs = pisi.api.list_upgradable()
|
||||||
if not list:
|
|
||||||
|
component = ctx.get_option('component')
|
||||||
|
if component:
|
||||||
|
#FIXME: pisi api is insufficient to do this
|
||||||
|
from sets import Set as set
|
||||||
|
component_pkgs = ctx.componentdb.get_component(component, None).packages
|
||||||
|
upgradable_pkgs = list(set(upgradable_pkgs) & set(component_pkgs))
|
||||||
|
|
||||||
|
if not upgradable_pkgs:
|
||||||
ctx.ui.info(_('No packages to upgrade.'))
|
ctx.ui.info(_('No packages to upgrade.'))
|
||||||
list.sort()
|
|
||||||
|
upgradable_pkgs.sort()
|
||||||
if self.options.install_info:
|
if self.options.install_info:
|
||||||
ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date'))
|
ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date'))
|
||||||
print '========================================================================'
|
print '========================================================================'
|
||||||
for pkg in list:
|
for pkg in upgradable_pkgs:
|
||||||
package = ctx.packagedb.get_package(pkg, pisi.itembyrepodb.installed)
|
package = ctx.packagedb.get_package(pkg, pisi.itembyrepodb.installed)
|
||||||
inst_info = ctx.installdb.get_info(pkg)
|
inst_info = ctx.installdb.get_info(pkg)
|
||||||
if self.options.long:
|
if self.options.long:
|
||||||
|
|||||||
Reference in New Issue
Block a user