summaryrefslogtreecommitdiffstats
path: root/meta/classes/base.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard@ted.(none)>2009-01-25 17:14:57 +0000
committerRichard Purdie <richard@ted.(none)>2009-02-05 23:54:11 +0000
commitc2c16bced84f488622467ae31e60aa07253b24cf (patch)
treeca3c4e1eedf70ae51c33f61a347f46ded6eba843 /meta/classes/base.bbclass
parent0903f6a455ff194a49ebbdb6bf1a6c03eeb970a2 (diff)
downloadpoky-c2c16bced84f488622467ae31e60aa07253b24cf.tar.gz
base.bbclass: Move package metadata handling functions into their own class file
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r--meta/classes/base.bbclass82
1 files changed, 0 insertions, 82 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 5f83af1fa3..0a5facf6e3 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -955,88 +955,6 @@ def explode_deps(s):
955 r.append(i) 955 r.append(i)
956 return r 956 return r
957 957
958def packaged(pkg, d):
959 import os, bb
960 return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK)
961
962def read_pkgdatafile(fn):
963 pkgdata = {}
964
965 def decode(str):
966 import codecs
967 c = codecs.getdecoder("string_escape")
968 return c(str)[0]
969
970 import os
971 if os.access(fn, os.R_OK):
972 import re
973 f = file(fn, 'r')
974 lines = f.readlines()
975 f.close()
976 r = re.compile("([^:]+):\s*(.*)")
977 for l in lines:
978 m = r.match(l)
979 if m:
980 pkgdata[m.group(1)] = decode(m.group(2))
981
982 return pkgdata
983
984def get_subpkgedata_fn(pkg, d):
985 import bb, os
986 archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ")
987 archs.reverse()
988 pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d)
989 targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d)
990 for arch in archs:
991 fn = pkgdata + arch + targetdir + pkg
992 if os.path.exists(fn):
993 return fn
994 return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d)
995
996def has_subpkgdata(pkg, d):
997 import bb, os
998 return os.access(get_subpkgedata_fn(pkg, d), os.R_OK)
999
1000def read_subpkgdata(pkg, d):
1001 import bb
1002 return read_pkgdatafile(get_subpkgedata_fn(pkg, d))
1003
1004def has_pkgdata(pn, d):
1005 import bb, os
1006 fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
1007 return os.access(fn, os.R_OK)
1008
1009def read_pkgdata(pn, d):
1010 import bb
1011 fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
1012 return read_pkgdatafile(fn)
1013
1014python read_subpackage_metadata () {
1015 import bb
1016 data = read_pkgdata(bb.data.getVar('PN', d, 1), d)
1017
1018 for key in data.keys():
1019 bb.data.setVar(key, data[key], d)
1020
1021 for pkg in bb.data.getVar('PACKAGES', d, 1).split():
1022 sdata = read_subpkgdata(pkg, d)
1023 for key in sdata.keys():
1024 bb.data.setVar(key, sdata[key], d)
1025}
1026
1027
1028#
1029# Collapse FOO_pkg variables into FOO
1030#
1031def read_subpkgdata_dict(pkg, d):
1032 import bb
1033 ret = {}
1034 subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d))
1035 for var in subd:
1036 newvar = var.replace("_" + pkg, "")
1037 ret[newvar] = subd[var]
1038 return ret
1039
1040# Make sure MACHINE isn't exported 958# Make sure MACHINE isn't exported
1041# (breaks binutils at least) 959# (breaks binutils at least)
1042MACHINE[unexport] = "1" 960MACHINE[unexport] = "1"