diff --git a/TODO b/TODO index 9ae02ee2..1dffff54 100644 --- a/TODO +++ b/TODO @@ -75,8 +75,8 @@ Legend: - extend XML specs to support that - cross-platform building support - non-interactive use - - query - - list of installed packages (eray) + / query + + list of installed packages (eray) - comar OM information (Provides) + easy package preparation + convert ebuild to pisi diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index c6170108..8859cf7a 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -11,6 +11,7 @@ def cmdObject(cmd, fail=False): "build": Build, "info": Info, "install": Install, + "list-installed": ListInstalled, "remove": Remove, "index": Index, "updatedb": UpdateDB} @@ -29,7 +30,7 @@ class Command(object): """generic help string for any command""" def __init__(self): # now for the real parser - self.parser = OptionParser(usage="", + self.parser = OptionParser(usage=usage_text, version="%prog " + pisi.__version__) self.options() self.parser = commonopts(self.parser) @@ -176,6 +177,18 @@ class Index(Command): print 'Indexing only a single directory supported' return +class ListInstalled(Command): + """list-installed: print a list of all installed packages + usage: list-installed """ + + def __init__(self): + super(ListInstalled, self).__init__() + + def run(self): + from pisi.installdb import installdb + for pkg in installdb.list_installed(): + print pkg + class UpdateDB(Command): """updatedb: update source and package databases""" def __init__(self): diff --git a/pisi/cli/common.py b/pisi/cli/common.py index 2c5018b7..efd3bfe8 100644 --- a/pisi/cli/common.py +++ b/pisi/cli/common.py @@ -7,6 +7,7 @@ build index info install +list-installed remove updatedb diff --git a/pisi/cli/pisicli.py b/pisi/cli/pisicli.py index 88d07d70..303d4087 100644 --- a/pisi/cli/pisicli.py +++ b/pisi/cli/pisicli.py @@ -9,10 +9,6 @@ import pisi.operations from pisi.purl import PUrl from common import * from commands import * -# globals - - - class ParserError(Exception): pass @@ -47,7 +43,6 @@ class PisiCLI(object): self.die() cmd = self.parser.rargs[0] - #print '*', cmd self.command = cmdObject(cmd) if not self.command: print "Unrecognized command: ", cmd diff --git a/pisi/operations.py b/pisi/operations.py index 9e02b300..c502710b 100644 --- a/pisi/operations.py +++ b/pisi/operations.py @@ -104,6 +104,5 @@ def build(pspecfile, authInfo=None): fs = SourceFetcher(url, authInfo) url.uri = fs.fetch_all() - # don't do the real job here. this is just a CLI! pb = PisiBuild(url.uri) pb.build()