File yum-3.2.25-license-to-confirm.patch of Package yum

--- yum/packages.py.orig	2010-04-09 12:26:43.000000000 +0200
+++ yum/packages.py	2010-04-09 13:24:51.000000000 +0200
@@ -34,6 +34,8 @@
 import Errors
 import errno
 import struct
+import glob
+
 from constants import *
 
 import urlparse
@@ -1015,6 +1017,23 @@
     def xml_dump_primary_metadata(self):
         msg = """\n<package type="rpm">"""
         msg += misc.to_unicode(self._dump_base_items())
+        eulas = glob.glob("%s.eula.*" % self.localPkg())
+        if eulas is not None:
+            for eula in eulas:
+                match = re.match("(.*eula)\.(.*)", eula)
+                lang = match.group(2)
+
+                eulaContent = None
+
+                try:
+                    fd = open(eula, "r")
+                    eulaContent = fd.read()
+                    fd.close()
+                except IOError:
+                    raise MDError, "Failed read contents of %s" % eula
+
+                if eulaContent is not None:
+                    msg += """<suse:license-to-confirm lang="%s">%s</suse:license-to-confirm>""" % (lang, unicode(eulaContent, "utf-8"))
         msg += misc.to_unicode(self._dump_format_items())
         msg += """\n</package>"""
         return misc.to_utf8(msg)
openSUSE Build Service is sponsored by