Re: [PATCH] adding rpm lookup by pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patch applied, and some test cases written. Only change I had to make was handling the case of
arch=None (gpg-pubkey packages do this).

Sorry for the delay, was lost in the moderation queue.

Adrian


Pradeep Kilambi wrote:
---
 func/minion/modules/rpms.py |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/func/minion/modules/rpms.py b/func/minion/modules/rpms.py
index ae26cb4..b0f8bba 100644
--- a/func/minion/modules/rpms.py
+++ b/func/minion/modules/rpms.py
@@ -42,3 +42,26 @@ class RpmModule(func_module.FuncModule):
             else:
                 results.append([name, epoch, version, release, arch])
         return results
+
+    def glob(self, pattern, flatten=True):
+        """
+        Return a list of installed packages that match a pattern
+        """
+        ts = rpm.TransactionSet()
+        mi = ts.dbMatch()
+        results = []
+        if not mi:
+ return + mi.pattern('name', rpm.RPMMIRE_GLOB, pattern)
+        for hdr in mi:
+            name = hdr['name']
+            epoch = (hdr['epoch'] or 0)
+            version = hdr['version']
+            release = hdr['release']
+            arch = hdr['arch']
+            if flatten:
+                results.append("%s %s %s %s %s" % (name, epoch, version,
+                                                       release, arch))
+            else:
+                results.append([name, epoch, version, release, arch])
+        return results

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux