[equo] add "equo query list installed <repository>" as per bug 3324

This commit is contained in:
Fabio Erculiani
2012-05-14 14:49:35 +02:00
parent 755b2612fe
commit 361302c48e
4 changed files with 23 additions and 9 deletions

View File

@@ -207,7 +207,7 @@ help_opts = [
(2, 'installed', 1, _('search a package into the local database')),
(2, 'license', 2, _('show packages owning the provided licenses')),
(2, 'list', 2, _('list packages based on the chosen parameter below')),
(3, 'installed', 2, _('list installed packages')),
(3, 'installed [repo]', 2, _('list installed packages')),
(4, '--by-user', 2, _('only packages installed by user')),
(3, 'available [repos]', 1, _('list available packages')),
(2, 'mimetype', 1, _('search packages able to handle given mimetypes')),

View File

@@ -173,7 +173,12 @@ def query(options):
elif cmd == "list":
mylistopts = options[1:]
if len(mylistopts) > 0:
if mylistopts[0] == "installed":
lopt, instopts = mylistopts[0], mylistopts[1:]
if lopt == "installed":
repoid = None
if instopts:
repoid = instopts[0]
def by_user_filter(pkg_match):
pkg_id, pkg_repo = pkg_match
@@ -182,16 +187,25 @@ def query(options):
pkg_id)
return source_id == etpConst['install_sources']['user']
def by_repoid_filter(pkg_match):
pkg_id, pkg_repo = pkg_match
repo_db = etp_client.open_repository(pkg_repo)
inst_pkg_repo = repo_db.getInstalledPackageRepository(
pkg_id)
return inst_pkg_repo == repoid
filter_func = None
if "--by-user" in mylistopts:
if "--by-user" == repoid:
filter_func = by_user_filter
elif repoid:
filter_func = by_repoid_filter
rc_status = list_packages(etp_client,
etp_client.installed_repository(),
filter_func = filter_func)
elif mylistopts[0] == "available" and len(mylistopts) > 1:
repoid = mylistopts[1]
elif lopt == "available" and len(instopts) > 0:
repoid = instopts[0]
if repoid in etp_client.repositories():
repo_dbconn = etp_client.open_repository(repoid)
rc_status = list_packages(etp_client, repo_dbconn)

View File

@@ -678,7 +678,7 @@ list packages based on the chosen parameter below
=over
=item [3] B<installed>
=item [3] B<installed> [repo]
list installed packages

View File

@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "EQUO 1"
.TH EQUO 1 "2012-05-09" "perl v5.12.4" "Entropy"
.TH EQUO 1 "2012-05-14" "perl v5.12.4" "Entropy"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -625,8 +625,8 @@ show packages owning the provided licenses
.IX Item "[2] list"
list packages based on the chosen parameter below
.RS 4
.IP "[3] \fBinstalled\fR" 4
.IX Item "[3] installed"
.IP "[3] \fBinstalled\fR [repo]" 4
.IX Item "[3] installed [repo]"
list installed packages
.RS 4
.IP "[4] \fB\-\-by\-user\fR" 4