[yum-commits] 3 commits - docs/repoquery.1 repoquery.py
skvidal at osuosl.org
skvidal at osuosl.org
Mon May 3 20:26:55 UTC 2010
docs/repoquery.1 | 2 ++
repoquery.py | 20 ++++++++++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
New commits:
commit 1c822e459ca547d037004fb45fc65ceed72bec85
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon May 3 16:26:57 2010 -0400
- allow querytags like yumdb_info.from_repo
- make ValueErrors if you hit a bad rpmtag a lot nicer - stop the traceback
- allow '.'s in fmt querys
diff --git a/repoquery.py b/repoquery.py
index f465b51..b7ac4d3 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -155,11 +155,12 @@ class pkgQuery:
# populated before calling pkg.returnSimple() ?!
try:
res = self.pkg.returnSimple(item)
- except KeyError:
+ except (KeyError, ValueError):
if item == "license":
res = ", ".join(self.pkg.licenses)
else:
- raise queryError("Invalid querytag '%s' for %s" % (item, self.classname))
+ raise queryError("Invalid querytag '%s' for %s: %s" % (item, self.classname, self.pkg))
+
if convert:
res = convert(res)
return res
@@ -200,7 +201,7 @@ class pkgQuery:
qf = qf.replace("\\n", "\n")
qf = qf.replace("\\t", "\t")
- pattern = re.compile('%([-\d]*?){([:\w]*?)}')
+ pattern = re.compile('%([-\d]*?){([:\.\w]*?)}')
fmt = re.sub(pattern, r'%(\2)\1s', qf)
return fmt % self
@@ -297,6 +298,12 @@ class instPkgQuery(pkgQuery):
def __getitem__(self, item):
if item in self.tagmap:
return self.pkg.tagByName(self.tagmap[item])
+ elif item.startswith('yumdb_info.'):
+ yumdb_item = item.split('.')[1]
+ try:
+ return getattr(self.pkg.yumdb_info, yumdb_item)
+ except AttributeError,e:
+ raise queryError("Invalid yumdb querytag '%s' for %s: %s" % (yumdb_item, self.classname, self.pkg))
else:
return pkgQuery.__getitem__(self, item)
commit 1185550c7bb03d7bbff1a8eb1420524e82d1d613
Merge: 2f856a9... 25834f6...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon May 3 15:50:16 2010 -0400
Merge branch 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum-utils
* 'master' of ssh://yum.baseurl.org/srv/projects/yum/git/yum-utils:
add missing import
catch yum exception in --orphans (rhbz #582039)
The protect-packages feature has been merged into core yum, removing it
make package-cleanup handle custom kernel with an '-' in the kernel release (rhbz #539651)
[fastestmirror] Bump version and update our changelog
[fastestmirror] Patch from Kris Ven to add a 'include_only' option
commit 2f856a902d000ec34fcf5783ae1b584c1f51c80b
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon May 3 15:48:33 2010 -0400
add --installed option - adds pkgnarrow='installed' and disables all repos
diff --git a/docs/repoquery.1 b/docs/repoquery.1
index e5ed8b7..7ac09ff 100644
--- a/docs/repoquery.1
+++ b/docs/repoquery.1
@@ -122,6 +122,8 @@ source RPMS.
.IP "\fB\-\-pkgnarrow=WHAT\fP"
Limit what packages are considered for the query. Valid values for WHAT are:
installed, available, recent, updates, extras, all and repository (default).
+.IP "\fB\-\-installed\fP"
+Restrict query ONLY to installed pkgs - disables all repos and only acts on rpmdb.
.IP "\fB\-\-show-dupes, \-\-show\-duplicates\fP"
Query all versions of package. By default only newest packages are
considered.
diff --git a/repoquery.py b/repoquery.py
index da0ce53..f465b51 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -671,6 +671,8 @@ def main(args):
help="set value of $releasever in yum config and repo files")
parser.add_option("--pkgnarrow", default="repos",
help="limit query to installed / available / recent / updates / extras / available + installed / repository (default) packages")
+ parser.add_option("--installed", action="store_true", default=False,
+ help="limit query to installed pkgs only")
parser.add_option("--show-duplicates", action="store_true",
dest="show_dupes",
help="show all versions of packages")
@@ -764,7 +766,10 @@ def main(args):
needgroup = 1
if opts.group:
needgroup = 1
-
+ if opts.installed:
+ opts.pkgnarrow = 'installed'
+ opts.disablerepos = ['*']
+
if opts.nevra or (len(pkgops) == 0 and len(sackops) == 0):
pkgops.append("queryformat")
More information about the Yum-commits
mailing list