summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-06-20 19:08:19 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-23 15:59:39 +0100
commitc2ce3573fb2816cd2023a56b364fae4c0f4455ae (patch)
tree52d7579d636c6ad19de96b6af398dc7fa956ad77
parent3dbe49b13e7513e449f13515591d02a7d2f560ae (diff)
downloadopenembedded-core-c2ce3573fb2816cd2023a56b364fae4c0f4455ae.tar.gz
openembedded-core-c2ce3573fb2816cd2023a56b364fae4c0f4455ae.tar.bz2
openembedded-core-c2ce3573fb2816cd2023a56b364fae4c0f4455ae.zip
classes/package_rpm.bbclass: Change the way the PV is transformed
There were some odd instances where the PKGV could not be loaded in the old way. Change to verify that PKGV exists before attempting to retrieve the value from the key. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-rw-r--r--meta/classes/package_rpm.bbclass23
1 files changed, 18 insertions, 5 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 9a854f3834..2cc57424c7 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -318,8 +318,20 @@ python write_specfile () {
import textwrap
import oe.packagedata
- # We need to change '-' in a version field to '+'
- # This needs to be done BEFORE the mapping_rename_hook
+ # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
+ # This format is similar to OE, however there are restrictions on the
+ # characters that can be in a field. In the Version field, "-"
+ # characters are not allowed. "-" is allowed in the Release field.
+ #
+ # We translate the "-" in the version to a "+", by loading the PKGV
+ # from the dependent recipe, replacing the - with a +, and then using
+ # that value to do a replace inside of this recipe's dependencies.
+ # This preserves the "-" separator between the version and release, as
+ # well as any "-" characters inside of the release field.
+ #
+ # All of this has to happen BEFORE the mapping_rename_hook as
+ # after renaming we cannot look up the dependencies in the packagedata
+ # store.
def translate_vers(varname, d):
depends = bb.data.getVar(varname, d, True)
if depends:
@@ -330,9 +342,10 @@ python write_specfile () {
if dep and ver:
if '-' in ver:
subd = oe.packagedata.read_subpkgdata_dict(dep, d)
- pv = subd['PKGV']
- reppv = pv.replace('-', '+')
- ver = ver.replace(pv, reppv)
+ if 'PKGV' in subd:
+ pv = subd['PKGV']
+ reppv = pv.replace('-', '+')
+ ver = ver.replace(pv, reppv)
newdeps_dict[dep] = ver
depends = bb.utils.join_deps(newdeps_dict)
bb.data.setVar(varname, depends.strip(), d)