diff options
-rw-r--r-- | meta/classes/package_rpm.bbclass | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 5945c047b..22604d256 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -14,9 +14,14 @@ RPM="rpm ${RPMOPTS}" python write_specfile() { from bb import data, build import sys + + version = bb.data.getVar('PV', d, 1) + version = version.replace('-', '+') + bb.data.setVar('RPMPV', version, d) + out_vartranslate = { "PKG": "Name", - "PV": "Version", + "RPMPV": "Version", "PR": "Release", "DESCRIPTION": "%description", "ROOT": "BuildRoot", @@ -71,9 +76,24 @@ python write_specfile() { fd.write("AutoReqProv: no\n") bb.build.exec_func("mapping_rename_hook", d) - rdepends = " ".join(bb.utils.explode_deps(bb.data.getVar('RDEPENDS', d, True) or "")) - if rdepends: - fd.write("Requires: %s\n" % rdepends) + rdepends = bb.utils.explode_dep_versions(bb.data.getVar('RDEPENDS', d, True) or "") + for dep in rdepends: + ver = rdepends[dep] + if dep and ver: + ver = ver.replace('-', '+') + fd.write("Requires: %s %s\n" % (dep, ver)) + elif dep: + fd.write("Requires: %s\n" % (dep)) + + rdepends = bb.utils.explode_dep_versions(bb.data.getVar('RRECOMMENDS', d, True) or "") + for dep in rdepends: + ver = rdepends[dep] + if dep and ver: + ver = ver.replace('-', '+') + fd.write("Recommends: %s %s\n" % (dep, ver)) + elif dep: + fd.write("Recommends: %s\n" % (dep)) + fd.write("Summary\t: .\n") for var in out_vartranslate.keys(): @@ -99,8 +119,8 @@ python write_specfile() { bb.build.exec_func('BUILDSPEC', d) # move the rpm into the pkgoutdir - rpm = bb.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d) - outrpm = bb.data.expand('${DEPLOY_DIR_RPM}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d) + rpm = bb.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${RPMPV}-${PR}.${TARGET_ARCH}.rpm', d) + outrpm = bb.data.expand('${DEPLOY_DIR_RPM}/${PKG}-${RPMPV}-${PR}.${TARGET_ARCH}.rpm', d) bb.movefile(rpm, outrpm) } |