commit:     cc0b45fde4d333bd62da9988bc35418cd383c9ee
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 03:41:54 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 03:44:38 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=cc0b45fd

equery meta: Fix missing description when not in metadata.xml

Add description property to Package class.
If no description in metadata.xml, get the description from the ebuild.

Bug: https://bugs.gentoo.org/447538

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/equery/meta.py | 2 ++
 pym/gentoolkit/package.py     | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 2e8dc36..124f59b 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -331,6 +331,8 @@ def call_format_functions(best_match, matches):
 
     if QUERY_OPTS["description"]:
         desc = best_match.metadata.descriptions()
+        if not desc:
+            desc = best_match.description
         print_sequence(format_list(desc))
 
     if QUERY_OPTS["useflags"]:

diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py
index 92bc3a3..1110bf5 100644
--- a/pym/gentoolkit/package.py
+++ b/pym/gentoolkit/package.py
@@ -437,6 +437,15 @@ class Package(CPV):
         )
         return self.cpv not in unmasked
 
+    @property
+    def description(self):
+        """Returns the DESCRIPTION from the ebuild
+
+        @rtype: list
+        """
+
+        return portage.db[portage.root]["porttree"].dbapi.aux_get(self.cpv, 
["DESCRIPTION"])
+
 
 class PackageFormatter:
     """When applied to a L{gentoolkit.package.Package} object, determine the

Reply via email to