summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-13 13:35:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-14 08:21:00 +0100
commit8ebe7be3d9494c3467b5533091bf6832030aad99 (patch)
treef7b483590c2dd75cfeed99dd8479068cdbafbadb
parentaf5b3f3510d3faa0e570be4b4997e9abcad5a805 (diff)
downloadpoky-8ebe7be3d9494c3467b5533091bf6832030aad99.tar.gz
bitbake.conf/package: Collapse PKGDATA_DIR into a single machine specific directory
Currently we have a hierarchy of pkgdata directories and the code has to put together a search path and look through each in turn until it finds the data it needs. This has lead to a number of hardcoded paths and file globing which is unpredictable and undesirable. Worse, certain tricks that should be easy like a GL specific package architecture become problematic with the curretn search paths. With the modern sstate code, we can do better and construct a single pkgdata directory for each machine in just the same way as we do for the sysroot. This is already tried and well tested. With such a single directory, all the code that iterated through multiple pkgdata directories and simply be removed and give a significant simplification of the code. Even existing build directories adapt to the change well since the package contents doesn't change, just the location they're installed to and the stamp for them. The only complication is the we need a different shlibs directory for each multilib. These are only used by package.bbclass and the simple fix is to add MLPREFIX to the shlib directory name. This means the multilib packages will repackage and the sstate checksum will change but an existing build directory will adapt to the changes safely. It is close to release however I believe the benefits this patch give us are worth consideration for inclusion and give us more options for dealing with problems like the GL one. It also sets the ground work well for shlibs improvements in 1.6. (From OE-Core rev: 1b8e4abd2d9c0901d38d89d0f944fe1ffd019379) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/allarch.bbclass4
-rw-r--r--meta/classes/buildhistory.bbclass2
-rw-r--r--meta/classes/cross-canadian.bbclass5
-rw-r--r--meta/classes/image.bbclass2
-rw-r--r--meta/classes/license.bbclass3
-rw-r--r--meta/classes/multilib.bbclass1
-rw-r--r--meta/classes/package.bbclass14
-rw-r--r--meta/classes/package_rpm.bbclass2
-rw-r--r--meta/classes/packageinfo.bbclass35
-rw-r--r--meta/conf/bitbake.conf2
-rw-r--r--meta/conf/multilib.conf1
-rw-r--r--meta/lib/oe/packagedata.py43
-rw-r--r--meta/recipes-devtools/gcc/gcc-common.inc4
-rwxr-xr-xscripts/oe-pkgdata-util36
14 files changed, 49 insertions, 105 deletions
diff --git a/meta/classes/allarch.bbclass b/meta/classes/allarch.bbclass
index 8669470e60..5e13a5b8a8 100644
--- a/meta/classes/allarch.bbclass
+++ b/meta/classes/allarch.bbclass
@@ -2,6 +2,10 @@
2# This class is used for architecture independent recipes/data files (usally scripts) 2# This class is used for architecture independent recipes/data files (usally scripts)
3# 3#
4 4
5# Expand STAGING_DIR_HOST since for cross-canadian/native/nativesdk, this will
6# point elsewhere after these changes.
7STAGING_DIR_HOST := "${STAGING_DIR_HOST}"
8
5PACKAGE_ARCH = "all" 9PACKAGE_ARCH = "all"
6 10
7python () { 11python () {
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 080f2c79b3..3da03c8485 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -340,7 +340,7 @@ buildhistory_get_installed() {
340 cat $pkgcache | while read pkg pkgfile pkgarch 340 cat $pkgcache | while read pkg pkgfile pkgarch
341 do 341 do
342 for vendor in ${TARGET_VENDOR} ${MULTILIB_VENDORS} ; do 342 for vendor in ${TARGET_VENDOR} ${MULTILIB_VENDORS} ; do
343 size=`oe-pkgdata-util read-value ${TMPDIR}/pkgdata $vendor-${TARGET_OS} "PKGSIZE" ${pkg}_${pkgarch}` 343 size=`oe-pkgdata-util read-value ${PKGDATA_DIR} "PKGSIZE" ${pkg}_${pkgarch}`
344 if [ "$size" != "" ] ; then 344 if [ "$size" != "" ] ; then
345 echo "$size $pkg" >> $1/installed-package-sizes.tmp 345 echo "$size $pkg" >> $1/installed-package-sizes.tmp
346 fi 346 fi
diff --git a/meta/classes/cross-canadian.bbclass b/meta/classes/cross-canadian.bbclass
index 87dd9948e7..c22be1a030 100644
--- a/meta/classes/cross-canadian.bbclass
+++ b/meta/classes/cross-canadian.bbclass
@@ -31,7 +31,6 @@ STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${
31TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR}/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}" 31TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR}/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}"
32 32
33PATH_append = ":${TMPDIR}/sysroots/${HOST_ARCH}/${bindir_cross}" 33PATH_append = ":${TMPDIR}/sysroots/${HOST_ARCH}/${bindir_cross}"
34PKGDATA_DIR = "${TMPDIR}/pkgdata/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}"
35PKGHIST_DIR = "${TMPDIR}/pkghistory/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/" 34PKGHIST_DIR = "${TMPDIR}/pkghistory/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/"
36 35
37HOST_ARCH = "${SDK_ARCH}" 36HOST_ARCH = "${SDK_ARCH}"
@@ -89,10 +88,6 @@ FILES_${PN}-dbg += "${prefix}/.debug \
89export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${layout_libdir}/pkgconfig" 88export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${layout_libdir}/pkgconfig"
90export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" 89export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
91 90
92# Cross-canadian packages need to pull in nativesdk dynamic libs
93SHLIBSDIRS = "${TMPDIR}/pkgdata/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/shlibs/ ${TMPDIR}/pkgdata/all-${HOST_VENDOR}-${HOST_OS}/shlibs/"
94SHLIBSDIR = "${TMPDIR}/pkgdata/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/shlibs/"
95
96do_populate_sysroot[stamp-extra-info] = "" 91do_populate_sysroot[stamp-extra-info] = ""
97 92
98USE_NLS = "${SDKUSE_NLS}" 93USE_NLS = "${SDKUSE_NLS}"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index f1e62f1454..889547a441 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -484,7 +484,7 @@ rootfs_install_complementary() {
484 # Use the magic script to do all the work for us :) 484 # Use the magic script to do all the work for us :)
485 : > ${WORKDIR}/complementary_pkgs.txt 485 : > ${WORKDIR}/complementary_pkgs.txt
486 for vendor in '${TARGET_VENDOR}' ${MULTILIB_VENDORS} ; do 486 for vendor in '${TARGET_VENDOR}' ${MULTILIB_VENDORS} ; do
487 oe-pkgdata-util glob ${TMPDIR}/pkgdata $vendor-${TARGET_OS} ${WORKDIR}/installed_pkgs.txt "$GLOBS" >> ${WORKDIR}/complementary_pkgs.txt 487 oe-pkgdata-util glob ${PKGDATA_DIR} ${WORKDIR}/installed_pkgs.txt "$GLOBS" >> ${WORKDIR}/complementary_pkgs.txt
488 done 488 done
489 489
490 # Install the packages, if any 490 # Install the packages, if any
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 621c1b2f55..0160313e2e 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -28,8 +28,7 @@ license_create_manifest() {
28 fi 28 fi
29 touch ${LICENSE_MANIFEST} 29 touch ${LICENSE_MANIFEST}
30 for pkg in ${INSTALLED_PKGS}; do 30 for pkg in ${INSTALLED_PKGS}; do
31 # not the best way to do this but licenses are not arch dependant iirc 31 filename=`ls ${PKGDATA_DIR}/runtime-reverse/${pkg}| head -1`
32 filename=`ls ${TMPDIR}/pkgdata/*/runtime-reverse/${pkg}| head -1`
33 pkged_pn="$(sed -n 's/^PN: //p' ${filename})" 32 pkged_pn="$(sed -n 's/^PN: //p' ${filename})"
34 33
35 # check to see if the package name exists in the manifest. if so, bail. 34 # check to see if the package name exists in the manifest. if so, bail.
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
index dac160e17e..9503096245 100644
--- a/meta/classes/multilib.bbclass
+++ b/meta/classes/multilib.bbclass
@@ -47,7 +47,6 @@ python multilib_virtclass_handler () {
47 47
48 e.data.setVar("MLPREFIX", variant + "-") 48 e.data.setVar("MLPREFIX", variant + "-")
49 e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False)) 49 e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
50 e.data.setVar("SHLIBSDIR_virtclass-multilib-" + variant ,e.data.getVar("SHLIBSDIR", False) + "/" + variant)
51 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override) 50 e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
52 51
53 # Expand the WHITELISTs with multilib prefix 52 # Expand the WHITELISTs with multilib prefix
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 599df246f0..fbb68391b9 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1304,17 +1304,8 @@ python package_do_filedeps() {
1304 d.setVar("FILERPROVIDESFLIST_" + pkg, " ".join(provides_files[pkg])) 1304 d.setVar("FILERPROVIDESFLIST_" + pkg, " ".join(provides_files[pkg]))
1305} 1305}
1306 1306
1307def getshlibsdirs(d): 1307SHLIBSDIRS = "${PKGDATA_DIR}/${MLPREFIX}shlibs"
1308 dirs = [] 1308SHLIBSWORKDIR = "${PKGDESTWORK}/${MLPREFIX}shlibs"
1309 triplets = (d.getVar("PKGTRIPLETS") or "").split()
1310 for t in triplets:
1311 dirs.append("${TMPDIR}/pkgdata/" + t + "/shlibs/")
1312 return " ".join(dirs)
1313getshlibsdirs[vardepsexclude] = "PKGTRIPLETS"
1314
1315SHLIBSDIRS = "${@getshlibsdirs(d)}"
1316SHLIBSDIR = "${TMPDIR}/pkgdata/${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/shlibs"
1317SHLIBSWORKDIR = "${PKGDESTWORK}/shlibs"
1318 1309
1319python package_do_shlibs() { 1310python package_do_shlibs() {
1320 import re, pipes 1311 import re, pipes
@@ -1953,6 +1944,7 @@ do_packagedata[sstate-name] = "packagedata"
1953do_packagedata[sstate-inputdirs] = "${PKGDESTWORK}" 1944do_packagedata[sstate-inputdirs] = "${PKGDESTWORK}"
1954do_packagedata[sstate-outputdirs] = "${PKGDATA_DIR}" 1945do_packagedata[sstate-outputdirs] = "${PKGDATA_DIR}"
1955do_packagedata[sstate-lockfile-shared] = "${PACKAGELOCK}" 1946do_packagedata[sstate-lockfile-shared] = "${PACKAGELOCK}"
1947do_packagedata[stamp-extra-info] = "${MACHINE}"
1956 1948
1957python do_packagedata_setscene () { 1949python do_packagedata_setscene () {
1958 sstate_setscene(d) 1950 sstate_setscene(d)
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 2a7e1642f8..fd861e980d 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -109,7 +109,7 @@ translate_smart_to_oe() {
109 fi 109 fi
110 # Workaround for bug 3565 110 # Workaround for bug 3565
111 # Simply look to see if we know of a package with that name, if not try again! 111 # Simply look to see if we know of a package with that name, if not try again!
112 filename=`ls ${TMPDIR}/pkgdata/*/runtime-reverse/$new_pkg 2>/dev/null | head -n 1` 112 filename=`ls ${PKGDATA_DIR}/runtime-reverse/$new_pkg 2>/dev/null | head -n 1`
113 if [ -n "$filename" ] ; then 113 if [ -n "$filename" ] ; then
114 found=1 114 found=1
115 break 115 break
diff --git a/meta/classes/packageinfo.bbclass b/meta/classes/packageinfo.bbclass
index 42fcd04150..7d60ace1dc 100644
--- a/meta/classes/packageinfo.bbclass
+++ b/meta/classes/packageinfo.bbclass
@@ -1,27 +1,20 @@
1python packageinfo_handler () { 1python packageinfo_handler () {
2 import oe.packagedata 2 import oe.packagedata
3 pkginfolist = [] 3 pkginfolist = []
4 tmpdir = e.data.getVar('TMPDIR', True) 4
5 target_vendor = e.data.getVar('TARGET_VENDOR', True) 5 pkgdata_dir = e.data.getVar("PKGDATA_DIR", True) + '/runtime/'
6 target_os = e.data.getVar('TARGET_OS', True) 6 if os.path.exists(pkgdata_dir):
7 package_archs = e.data.getVar('PACKAGE_ARCHS', True) 7 for root, dirs, files in os.walk(pkgdata_dir):
8 packaging = e.data.getVar('PACKAGE_CLASSES', True).split()[0].split('_')[1] 8 for pkgname in files:
9 deploy_dir = e.data.getVar('DEPLOY_DIR', True) + '/' + packaging 9 if pkgname.endswith('.packaged'):
10 10 pkgname = pkgname[:-9]
11 for arch in package_archs.split(): 11 pkgdatafile = root + pkgname
12 pkgdata_dir = tmpdir + '/pkgdata/' + arch + target_vendor + '-' + target_os + '/runtime/' 12 try:
13 if os.path.exists(pkgdata_dir): 13 sdata = oe.packagedata.read_pkgdatafile(pkgdatafile)
14 for root, dirs, files in os.walk(pkgdata_dir): 14 sdata['PKG'] = pkgname
15 for pkgname in files: 15 pkginfolist.append(sdata)
16 if pkgname.endswith('.packaged'): 16 except Exception as e:
17 pkgname = pkgname[:-9] 17 bb.warn("Failed to read pkgdata file %s: %s: %s" % (pkgdatafile, e.__class__, str(e)))
18 pkgdatafile = root + pkgname
19 try:
20 sdata = oe.packagedata.read_pkgdatafile(pkgdatafile)
21 sdata['PKG'] = pkgname
22 pkginfolist.append(sdata)
23 except Exception as e:
24 bb.warn("Failed to read pkgdata file %s: %s: %s" % (pkgdatafile, e.__class__, str(e)))
25 bb.event.fire(bb.event.PackageInfo(pkginfolist), e.data) 18 bb.event.fire(bb.event.PackageInfo(pkginfolist), e.data)
26} 19}
27 20
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 9eed72ad3f..58d0c206b7 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -382,7 +382,7 @@ DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb"
382DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}" 382DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}"
383DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools" 383DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools"
384 384
385PKGDATA_DIR = "${TMPDIR}/pkgdata/${MULTIMACH_TARGET_SYS}" 385PKGDATA_DIR = "${STAGING_DIR_HOST}/pkgdata"
386 386
387################################################################## 387##################################################################
388# SDK variables. 388# SDK variables.
diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf
index 9ff06cc768..733236d6bb 100644
--- a/meta/conf/multilib.conf
+++ b/meta/conf/multilib.conf
@@ -8,6 +8,7 @@ MULTILIBS ??= "multilib:lib32"
8 8
9STAGING_DIR_HOST = "${STAGING_DIR}/${MLPREFIX}${MACHINE}" 9STAGING_DIR_HOST = "${STAGING_DIR}/${MLPREFIX}${MACHINE}"
10STAGING_DIR_TARGET = "${STAGING_DIR}/${MLPREFIX}${MACHINE}" 10STAGING_DIR_TARGET = "${STAGING_DIR}/${MLPREFIX}${MACHINE}"
11PKGDATA_DIR = "${STAGING_DIR}/${MACHINE}/pkgdata"
11 12
12INHERIT += "multilib_global" 13INHERIT += "multilib_global"
13 14
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 14c38bdc0f..cd5f0445f5 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -23,21 +23,7 @@ def read_pkgdatafile(fn):
23 23
24 return pkgdata 24 return pkgdata
25 25
26def all_pkgdatadirs(d):
27 dirs = []
28 triplets = (d.getVar("PKGMLTRIPLETS") or "").split()
29 for t in triplets:
30 dirs.append(t + "/runtime/")
31 return dirs
32
33def get_subpkgedata_fn(pkg, d): 26def get_subpkgedata_fn(pkg, d):
34 dirs = all_pkgdatadirs(d)
35
36 pkgdata = d.expand('${TMPDIR}/pkgdata/')
37 for dir in dirs:
38 fn = pkgdata + dir + pkg
39 if os.path.exists(fn):
40 return fn
41 return d.expand('${PKGDATA_DIR}/runtime/%s' % pkg) 27 return d.expand('${PKGDATA_DIR}/runtime/%s' % pkg)
42 28
43def has_subpkgdata(pkg, d): 29def has_subpkgdata(pkg, d):
@@ -70,29 +56,24 @@ def read_subpkgdata_dict(pkg, d):
70def _pkgmap(d): 56def _pkgmap(d):
71 """Return a dictionary mapping package to recipe name.""" 57 """Return a dictionary mapping package to recipe name."""
72 58
73 target_os = d.getVar("TARGET_OS", True) 59 pkgdatadir = d.getVar("PKGDATA_DIR", True)
74 target_vendor = d.getVar("TARGET_VENDOR", True)
75 basedir = os.path.dirname(d.getVar("PKGDATA_DIR", True))
76
77 dirs = ("%s%s-%s" % (arch, target_vendor, target_os)
78 for arch in d.getVar("PACKAGE_ARCHS", True).split())
79 60
80 pkgmap = {} 61 pkgmap = {}
81 for pkgdatadir in (os.path.join(basedir, sys) for sys in dirs): 62 try:
63 files = os.listdir(pkgdatadir)
64 except OSError:
65 bb.warn("No files in %s?" % pkgdatadir)
66 files = []
67
68 for pn in filter(lambda f: not os.path.isdir(os.path.join(pkgdatadir, f)), files):
82 try: 69 try:
83 files = os.listdir(pkgdatadir) 70 pkgdata = read_pkgdatafile(os.path.join(pkgdatadir, pn))
84 except OSError: 71 except OSError:
85 continue 72 continue
86 73
87 for pn in filter(lambda f: not os.path.isdir(os.path.join(pkgdatadir, f)), files): 74 packages = pkgdata.get("PACKAGES") or ""
88 try: 75 for pkg in packages.split():
89 pkgdata = read_pkgdatafile(os.path.join(pkgdatadir, pn)) 76 pkgmap[pkg] = pn
90 except OSError:
91 continue
92
93 packages = pkgdata.get("PACKAGES") or ""
94 for pkg in packages.split():
95 pkgmap[pkg] = pn
96 77
97 return pkgmap 78 return pkgmap
98 79
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index d20be9f8ff..062ccc7c03 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -60,10 +60,6 @@ def get_tune_parameters(tune, d):
60 60
61get_tune_parameters[vardepsexclude] = "AVAILTUNES" 61get_tune_parameters[vardepsexclude] = "AVAILTUNES"
62 62
63# We really need HOST_SYS here for some packages and TARGET_SYS for others.
64# For now, libgcc is most important so we fix for that - RP.
65SHLIBSDIR = "${STAGING_DIR_TARGET}/shlibs"
66
67DEBIANNAME_${MLPREFIX}libgcc = "libgcc1" 63DEBIANNAME_${MLPREFIX}libgcc = "libgcc1"
68 64
69MIRRORS =+ "\ 65MIRRORS =+ "\
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index c63f87d7e6..dcdfe25dfd 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -41,17 +41,13 @@ def usage():
41 41
42 42
43def glob(args): 43def glob(args):
44 if len(args) < 4: 44 if len(args) < 3:
45 usage() 45 usage()
46 sys.exit(1) 46 sys.exit(1)
47 47
48 pkgdata_dir = args[0] 48 pkgdata_dir = args[0]
49 target_suffix = args[1] 49 pkglist_file = args[1]
50 pkglist_file = args[2] 50 globs = args[2].split()
51 globs = args[3].split()
52
53 if target_suffix.startswith("-"):
54 target_suffix = target_suffix[1:]
55 51
56 skipregex = re.compile("-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-") 52 skipregex = re.compile("-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-")
57 53
@@ -63,7 +59,6 @@ def glob(args):
63 continue 59 continue
64 pkg = fields[0] 60 pkg = fields[0]
65 arch = fields[1] 61 arch = fields[1]
66 multimach_target_sys = "%s-%s" % (arch, target_suffix)
67 62
68 # Skip packages for which there is no point applying globs 63 # Skip packages for which there is no point applying globs
69 if skipregex.search(pkg): 64 if skipregex.search(pkg):
@@ -86,9 +81,9 @@ def glob(args):
86 81
87 # Define some functions 82 # Define some functions
88 def revpkgdata(pkgn): 83 def revpkgdata(pkgn):
89 return os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkgn) 84 return os.path.join(pkgdata_dir, "runtime-reverse", pkgn)
90 def fwdpkgdata(pkgn): 85 def fwdpkgdata(pkgn):
91 return os.path.join(pkgdata_dir, multimach_target_sys, "runtime", pkgn) 86 return os.path.join(pkgdata_dir, "runtime", pkgn)
92 def readpn(pkgdata_file): 87 def readpn(pkgdata_file):
93 pn = "" 88 pn = ""
94 with open(pkgdata_file, 'r') as f: 89 with open(pkgdata_file, 'r') as f:
@@ -156,17 +151,13 @@ def glob(args):
156 print("\n".join(mappedpkgs)) 151 print("\n".join(mappedpkgs))
157 152
158def read_value(args): 153def read_value(args):
159 if len(args) < 4: 154 if len(args) < 3:
160 usage() 155 usage()
161 sys.exit(1) 156 sys.exit(1)
162 157
163 pkgdata_dir = args[0] 158 pkgdata_dir = args[0]
164 target_suffix = args[1] 159 var = args[1]
165 var = args[2] 160 packages = args[2].split()
166 packages = args[3].split()
167
168 if target_suffix.startswith("-"):
169 target_suffix = target_suffix[1:]
170 161
171 def readvar(pkgdata_file, var): 162 def readvar(pkgdata_file, var):
172 val = "" 163 val = ""
@@ -177,23 +168,16 @@ def read_value(args):
177 return val 168 return val
178 169
179 if debug: 170 if debug:
180 print "read-value('%s', '%s', '%s' '%s'" % (pkgdata_dir, target_suffix, var, packages) 171 print "read-value('%s', '%s' '%s'" % (pkgdata_dir, var, packages)
181 for package in packages: 172 for package in packages:
182 pkg_split = package.split('_') 173 pkg_split = package.split('_')
183 pkg_name = pkg_split[0] 174 pkg_name = pkg_split[0]
184 pkg_arch = '_'.join(pkg_split[1:]) 175 pkg_arch = '_'.join(pkg_split[1:])
185 if debug: 176 if debug:
186 print "package: name: '%s', arch: '%s'" % (pkg_name, pkg_arch) 177 print "package: name: '%s', arch: '%s'" % (pkg_name, pkg_arch)
187 multimach_target_sys = "%s-%s" % (pkg_arch, target_suffix) 178 revlink = os.path.join(pkgdata_dir, "runtime-reverse", pkg_name)
188 revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name)
189 if debug: 179 if debug:
190 print(revlink) 180 print(revlink)
191 if not os.path.exists(revlink):
192 # [YOCTO #4227] try to drop -gnueabi from TARGET_OS
193 multimach_target_sys = '-'.join(multimach_target_sys.split('-')[:-1])
194 revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name)
195 if debug:
196 print(revlink)
197 if os.path.exists(revlink): 181 if os.path.exists(revlink):
198 mappedpkg = os.path.basename(os.readlink(revlink)) 182 mappedpkg = os.path.basename(os.readlink(revlink))
199 qvar = var 183 qvar = var