createrepo/__init__.py createrepo/yumbased.py

[email protected] (Seth Vidal)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 createrepo/__init__.py |   18 ++++++++++++++----
 createrepo/yumbased.py |    2 ++
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 3af3197ed1b42c829f0d6fb8bff9503056eb45a0
Author: Seth Vidal <[email protected]>
Date:   Mon Mar 3 10:58:52 2008 -0500

    exclude rpmlib requires from metadata b/c they are silly
    store them in the repomd.xml per-repo so we have them if we ever actually need them

diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index e91cf85..7c46346 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -104,7 +104,8 @@ class MetaDataGenerator:
         self.ts = rpmUtils.transaction.initReadOnlyTransaction()
         self.pkgcount = 0
         self.files = []
-        
+        self.rpmlib_reqs = {}
+                
         if not self.conf.directory and not self.conf.directories:
             raise MDError, "No directory given on which to run."
         
@@ -394,9 +395,12 @@ class MetaDataGenerator:
         po.crp_cachedir = self.conf.cachedir
         po.crp_baseurl = baseurl
         po.crp_reldir = reldir
-
+        for r in po.requires_print:
+            if r.startswith('rpmlib('):
+                self.rpmlib_reqs[r] = 1
+           
         if po.checksum in (None, ""):
-            raise MDError, "No Package ID found for package %s, not going to add it" % e
+            raise MDError, "No Package ID found for package %s, not going to add it" % po
         
         return po
 
@@ -677,7 +681,13 @@ class MetaDataGenerator:
         if self.conf.groupfile is not None:
             self.addArbitraryMetadata(self.conf.groupfile, 'group_gz', reporoot)
             self.addArbitraryMetadata(self.conf.groupfile, 'group', reporoot, compress=False)            
-
+        
+        if self.rpmlib_reqs:
+            rpmlib = reporoot.newChild(None, 'rpmlib_requirements', None)
+            for r in self.rpmlib_reqs.keys():
+                req  = rpmlib.newChild(None, 'requires', r)
+                
+            
         # save it down
         try:
             repodoc.saveFormatFileEnc(repofilepath, 'UTF-8', 1)
diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
index 17af4e6..58d2405 100644
--- a/createrepo/yumbased.py
+++ b/createrepo/yumbased.py
@@ -338,6 +338,8 @@ class CreateRepoPackage(YumLocalPackage):
 
         if mylist: msg = "\n    <rpm:requires>\n"
         for (name, flags, (e,v,r),pre) in mylist:
+            if name.startswith('rpmlib('):
+                continue
             prcostring = '''      <rpm:entry name="%s"''' % name
             if flags:
                 prcostring += ''' flags="%s"''' % flags
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.