File yum-3.2.25-suse-missing-tags.patch of Package yum

--- yum/packages.py.orig	2010-04-09 12:26:43.000000000 +0200
+++ yum/packages.py	2010-04-12 12:24:00.000000000 +0200
@@ -897,7 +899,9 @@
         msg += self._dump_pco('provides')
         msg += self._dump_requires()
         msg += self._dump_pco('conflicts')         
-        msg += self._dump_pco('obsoletes')         
+        msg += self._dump_pco('obsoletes')
+        msg += self._dump_suggests_and_recommends()
+        msg += self._dump_enhances_and_supplements()
         msg += self._dump_files(True)
         msg += """\n  </format>"""
         return msg
@@ -968,7 +972,111 @@
 
     def _requires_with_pre(self):
         raise NotImplementedError()
-                    
+   
+    # Rather than trying to stuff enhances, suggests, supplements and recommends
+    # into yum like the other tags, I'll save my sanity and just do it by hand. 
+    def _dump_suggests_and_recommends(self):
+        msg = ""
+        suggests = ""
+        recommends = ""
+        names = self.hdr[rpm.RPMTAG_SUGGESTSNAME]
+        if not names:
+            return msg
+
+        if type(names).__name__ != 'list':
+            names = [names]
+
+        flags = self.hdr[rpm.RPMTAG_SUGGESTSFLAGS]
+        if type(flags).__name__ != 'list':
+            flags = [flags]
+        
+        versions = self.hdr[rpm.RPMTAG_SUGGESTSVERSION]
+        if type(versions).__name__ != 'list':
+             versions = [versions]
+
+        for i in range(len(names)):
+            name = names[i]
+            if name.startswith('rpmlib('):
+                continue
+            flag = flags[i]
+            flagstr = flagToString(flag)
+            (e,v,r) = stringToVersion(versions[i])
+            entry = '''      <rpm:entry name="%s"''' % misc.to_xml(name, attrib=True)
+            if flagstr:
+                entry += ''' flags="%s"''' % misc.to_xml(flagstr, attrib=True)
+                if e:
+                    entry += ''' epoch="%s"''' % misc.to_xml(e, attrib=True)
+                if v:
+                    entry += ''' ver="%s"''' % misc.to_xml(v, attrib=True)
+                if r:
+                    entry += ''' rel="%s"''' % misc.to_xml(r, attrib=True)
+            entry += "/>\n"
+            if flag & rpm.RPMSENSE_STRONG:
+                recommends += entry
+            else:
+                suggests += entry
+        if suggests:
+            msg += "\n    <rpm:suggests>\n"
+            msg += suggests
+            msg += "    </rpm:suggests>\n"
+        if recommends:
+            msg += "\n    <rpm:recommends>\n"
+            msg += recommends
+            msg += "    </rpm:recommends>\n"
+ 
+        return msg
+
+    def _dump_enhances_and_supplements(self):
+        msg = ""
+        enhances = ""
+        supplements = ""
+        names = self.hdr[rpm.RPMTAG_ENHANCESNAME]
+        if not names:
+            return msg
+        if type(names).__name__ != 'list':
+            names = [names]
+
+        flags = self.hdr[rpm.RPMTAG_ENHANCESFLAGS]
+        if type(flags).__name__ != 'list':
+            flags = [flags]
+
+        versions = self.hdr[rpm.RPMTAG_ENHANCESVERSION]
+        if type(versions).__name__ != 'list':
+             versions = [versions]
+
+        for i in range(len(names)):
+            name = names[i]
+            if name.startswith('rpmlib('):
+                continue
+            flag = flags[i]
+            flagstr = flagToString(flag)
+            (e,v,r) = stringToVersion(versions[i])
+            entry = '''      <rpm:entry name="%s"''' % misc.to_xml(name, attrib=True)
+            if flagstr:
+                entry += ''' flags="%s"''' % misc.to_xml(flagstr, attrib=True)
+                if e:
+                    entry += ''' epoch="%s"''' % misc.to_xml(e, attrib=True)
+                if v:
+                    entry += ''' ver="%s"''' % misc.to_xml(v, attrib=True)
+                if r:
+                    entry += ''' rel="%s"''' % misc.to_xml(r, attrib=True)
+            entry += "/>\n"
+            if flag & rpm.RPMSENSE_STRONG:
+                supplements += entry
+            else:
+                enhances += entry
+        if supplements:
+            msg += "\n    <rpm:supplements>\n"
+            msg += supplements
+            msg += "    </rpm:supplements>\n"
+        if enhances:
+            msg += "\n    <rpm:enhances>\n"
+            msg += enhances
+            msg += "    </rpm:enhances>\n"
+
+        return msg
+
+
     def _dump_requires(self):
         """returns deps in format"""
         mylist = self._requires_with_pre()
openSUSE Build Service is sponsored by