diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-10-09 21:24:38 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-05-20 17:41:24 +0100 |
commit | e6858627ab087f2f25ebbd6c4422eeae35f3b0ac (patch) | |
tree | b0a3762bbb1de3e192222c84c2df6b23e3741ae2 /meta/classes | |
parent | 4df212e9c2a1dd7c80d180fd13b67e9f2799d3e1 (diff) | |
download | openembedded-core-e6858627ab087f2f25ebbd6c4422eeae35f3b0ac.tar.gz openembedded-core-e6858627ab087f2f25ebbd6c4422eeae35f3b0ac.tar.bz2 openembedded-core-e6858627ab087f2f25ebbd6c4422eeae35f3b0ac.zip |
Move packagedata code into oe.packagedata (sync from OE)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/package.bbclass | 4 | ||||
-rw-r--r-- | meta/classes/package_rpm.bbclass | 3 | ||||
-rw-r--r-- | meta/classes/packagedata.bbclass | 68 |
3 files changed, 9 insertions, 66 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 4eb349d431..2c6d30ccd8 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -295,7 +295,9 @@ def runstrip(file, elftype, d): # def get_package_mapping (pkg, d): - data = read_subpkgdata(pkg, d) + import oe.packagedata + + data = oe.packagedata.read_subpkgdata(pkg, d) key = "PKG_%s" % pkg if key in data: diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index b86356de2e..1d8c686330 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -316,6 +316,7 @@ package_install_internal_rpm () { 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 @@ -328,7 +329,7 @@ python write_specfile () { ver = depends_dict[dep] if dep and ver: if '-' in ver: - subd = read_subpkgdata_dict(dep, d) + subd = oe.packagedata.read_subpkgdata_dict(dep, d) pv = subd['PV'] reppv = pv.replace('-', '+') ver = ver.replace(pv, reppv) diff --git a/meta/classes/packagedata.bbclass b/meta/classes/packagedata.bbclass index 86f18a9e96..bf051feea8 100644 --- a/meta/classes/packagedata.bbclass +++ b/meta/classes/packagedata.bbclass @@ -1,73 +1,13 @@ -def packaged(pkg, d): - return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK) - -def read_pkgdatafile(fn): - pkgdata = {} - - def decode(str): - import codecs - c = codecs.getdecoder("string_escape") - return c(str)[0] - - if os.access(fn, os.R_OK): - import re - f = file(fn, 'r') - lines = f.readlines() - f.close() - r = re.compile("([^:]+):\s*(.*)") - for l in lines: - m = r.match(l) - if m: - pkgdata[m.group(1)] = decode(m.group(2)) - - return pkgdata - -def get_subpkgedata_fn(pkg, d): - archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ") - archs.reverse() - pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d) - targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d) - for arch in archs: - fn = pkgdata + arch + targetdir + pkg - if os.path.exists(fn): - return fn - return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d) - -def has_subpkgdata(pkg, d): - return os.access(get_subpkgedata_fn(pkg, d), os.R_OK) - -def read_subpkgdata(pkg, d): - return read_pkgdatafile(get_subpkgedata_fn(pkg, d)) - -def has_pkgdata(pn, d): - fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) - return os.access(fn, os.R_OK) - -def read_pkgdata(pn, d): - fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) - return read_pkgdatafile(fn) - python read_subpackage_metadata () { - data = read_pkgdata(bb.data.getVar('PN', d, 1), d) + import oe.packagedata + + data = oe.packagedata.read_pkgdata(bb.data.getVar('PN', d, 1), d) for key in data.keys(): bb.data.setVar(key, data[key], d) for pkg in bb.data.getVar('PACKAGES', d, 1).split(): - sdata = read_subpkgdata(pkg, d) + sdata = oe.packagedata.read_subpkgdata(pkg, d) for key in sdata.keys(): bb.data.setVar(key, sdata[key], d) } - - -# -# Collapse FOO_pkg variables into FOO -# -def read_subpkgdata_dict(pkg, d): - ret = {} - subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d)) - for var in subd: - newvar = var.replace("_" + pkg, "") - ret[newvar] = subd[var] - return ret - |