[Rpm-metadata] [PATCH] Filter rpm files to pkglist, when in split media mode. BZ 646644

James Antill james at and.org
Mon Sep 10 19:39:07 UTC 2012


---
 createrepo/__init__.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index d2e2039..6495e85 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -1307,6 +1307,19 @@ class SplitMetaDataGenerator(MetaDataGenerator):
                     thisdir = os.path.join(self.conf.basedir, mydir)
 
             filematrix[mydir] = self.getFileList(thisdir, '.rpm')
+
+            #  pkglist is a bit different for split media, as we have to know
+            # which dir. it belongs to. So we walk the dir. and then filter.
+            # We could be faster by not walking the dir. ... but meh.
+            if self.conf.pkglist:
+                pkglist = set(self.conf.pkglist)
+                pkgs = []
+                for fname in filematrix[mydir]:
+                    if fname not in pkglist:
+                        continue
+                    pkgs.append(fname)
+                filematrix[mydir] = pkgs
+
             self.trimRpms(filematrix[mydir])
             self.pkgcount += len(filematrix[mydir])
 
-- 
1.7.6.5



More information about the Rpm-metadata mailing list