While using the ascii-tree output format, I found it helpful to support
the --queryformat option to allow customized output using QUERYTAGS.
---
 repoquery.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/repoquery.py b/repoquery.py
index 2eb7834..6217b4b 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -263,7 +263,7 @@ class pkgQuery:
             pattern = re.compile('%([-\d]*?){([:\.\w]*?)}')
             fmt = re.sub(pattern, r'%(\2)\1s', qf)
             self._translated_qf[self.qf] = fmt
-        return self._translated_qf[self.qf] % self
+        return self._translated_qf[self.qf] % kw.get('pkg', self)
 
     def fmt_requires(self, **kw):
         if self.yb.options.output in ("ascii-tree", "dot-tree"):
@@ -325,12 +325,11 @@ class pkgQuery:
         print "%s%s [%s]" % (indent, str(req), str(val))
 
     # These are common helpers for the --tree-* options...
-    @staticmethod
-    def _tree_print_req(req, val, level):
+    def _tree_print_req(self, req, val, level):
         indent = ''
         if level:
             indent = ' |  ' * (level - 1) + ' \_  '
-        print "%s%s [%s]" % (indent, str(req), str(val))
+        print "%s%s [%s]" % (indent, self.fmt_queryformat(pkg=req), str(val))
     def _tree_pkg2uniq(self, pkg):
         """ Turn a pkg into a "unique" req."""
         if self.yb and self.yb.conf.showdupesfromrepos:
-- 
1.7.7.5

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to