package_rpm.bbclass: Fix problems with package version with '-' in the version (replace with '+'), improve the Requires and Recommends generation code

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5129 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie 2008-09-03 14:49:22 +00:00
parent 5d24ea892f
commit 6269c57167
1 changed files with 26 additions and 6 deletions

View File

@ -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)
}