Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:cthiel1
createrepo
createrepo-license-to-confirm.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File createrepo-license-to-confirm.patch of Package createrepo
--- dumpMetadata.py +++ dumpMetadata.py @@ -18,6 +18,7 @@ # $Id$ +import glob import os import rpm import exceptions @@ -629,7 +630,7 @@ -def generateXML(doc, node, formatns, rpmObj, sumtype): +def generateXML(doc, node, formatns, susens, rpmObj, sumtype): """takes an xml doc object and a package metadata entry node, populates a package node with the md information""" ns = node.ns() @@ -663,6 +664,27 @@ if rpmObj.localurl is not None: location.newProp('xml:base', rpmObj.localurl) location.newProp('href', rpmObj.relativepath) + + eulas = glob.glob("%s.eula.*" % os.path.join(rpmObj.options['basedir'], rpmObj.relativepath)) + 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: + eulaNode = pkgNode.newChild(susens, 'license-to-confirm', None) + eulaNode.newProp('lang', lang) + eulaNode.addContent(utf8String(eulaContent)) + format = pkgNode.newChild(ns, 'format', None) for tag in ['license', 'vendor', 'group', 'buildhost', 'sourcerpm']: value = rpmObj.tagByName(tag) --- genpkgmetadata.py +++ genpkgmetadata.py @@ -181,11 +181,12 @@ self.baseroot = self.basedoc.newChild(None, "metadata", None) basens = self.baseroot.newNs('http://linux.duke.edu/metadata/common', None) self.formatns = self.baseroot.newNs('http://linux.duke.edu/metadata/rpm', 'rpm') + self.susens = self.baseroot.newNs('http://novell.com/package/metadata/suse/common', 'suse') self.baseroot.setNs(basens) basefilepath = os.path.join(self.cmds['outputdir'], self.cmds['tempdir'], self.cmds['primaryfile']) self.basefile = _gzipOpen(basefilepath, 'w') self.basefile.write('<?xml version="1.0" encoding="UTF-8"?>\n') - self.basefile.write('<metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="%s">\n' % + self.basefile.write('<metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" xmlns:suse="http://novell.com/package/metadata/suse/common" packages="%s">\n' % self.pkgcount) def _setupFilelists(self): @@ -223,7 +224,7 @@ errorprint('\n%s - %s' % (e, file)) return None try: - basenode = dumpMetadata.generateXML(self.basedoc, self.baseroot, self.formatns, mdobj, self.cmds['sumtype']) + basenode = dumpMetadata.generateXML(self.basedoc, self.baseroot, self.formatns, self.susens, mdobj, self.cmds['sumtype']) except dumpMetadata.MDError, e: errorprint(_('\nAn error occurred creating primary metadata: %s') % e) return None
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor