package_deb.bbclass, cross-canadian.bbclass: DPKG_ARCH mapping function

Have DPKG_ARCH set by directly invoking a mapping function, rather
than using an anonymous Python function modify the variable under
the hood, so we can have proper handling of overrides.

Also bring in some additional mappings to Debian architecture names
that weren't being handled.

(From OE-Core rev: 8d042ea4e755cb0bb28b88333e10e04ec4e86a36)

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Matt Madison 2016-01-06 04:21:33 -08:00 committed by Richard Purdie
parent 72e69328b3
commit 9ea7428e67
2 changed files with 26 additions and 11 deletions

View File

@ -103,7 +103,7 @@ HOST_LD_ARCH = "${SDK_LD_ARCH}"
HOST_AS_ARCH = "${SDK_AS_ARCH}"
#assign DPKG_ARCH
DPKG_ARCH = "${SDK_ARCH}"
DPKG_ARCH = "${@debian_arch_map(d.getVar('SDK_ARCH', True), '')}"
CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
CFLAGS = "${BUILDSDK_CFLAGS}"

View File

@ -6,7 +6,7 @@ inherit package
IMAGE_PKGTYPE ?= "deb"
DPKG_ARCH ?= "${TARGET_ARCH}"
DPKG_ARCH ?= "${@debian_arch_map(d.getVar('TARGET_ARCH', True), d.getVar('TUNE_FEATURES', True))}"
PKGWRITEDIRDEB = "${WORKDIR}/deploy-debs"
@ -14,6 +14,28 @@ APTCONF_TARGET = "${WORKDIR}"
APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}"
def debian_arch_map(arch, tune):
tune_features = tune.split()
if arch in ["i586", "i686"]:
return "i386"
if arch == "x86_64":
if "mx32" in tune_features:
return "x32"
return "amd64"
if arch.startswith("mips"):
endian = ["el", ""]["bigendian" in tune_features]
if "n64" in tune_features:
return "mips64" + endian
if "n32" in tune_features:
return "mipsn32" + endian
return "mips" + endian
if arch == "powerpc":
return arch + ["", "spe"]["spe" in tune_features]
if arch == "aarch64":
return "arm64"
if arch == "arm":
return arch + ["el", "hf"]["callconvention-hard" in tune_features]
return arch
#
# install a bunch of packages using apt
# the following shell variables needs to be set before calling this func:
@ -288,6 +310,8 @@ python do_package_deb () {
cleanupcontrol(root)
bb.utils.unlockfile(lf)
}
# Indirect references to these vars
do_package_write_deb[vardeps] += "PKGV PKGR PKGV DESCRIPTION SECTION PRIORITY MAINTAINER DPKG_ARCH PN HOMEPAGE"
# Otherwise allarch packages may change depending on override configuration
do_package_deb[vardepsexclude] = "OVERRIDES"
@ -311,15 +335,6 @@ python () {
deps = ' dpkg-native:do_populate_sysroot virtual/fakeroot-native:do_populate_sysroot'
d.appendVarFlag('do_package_write_deb', 'depends', deps)
d.setVarFlag('do_package_write_deb', 'fakeroot', "1")
# Map TARGET_ARCH to Debian's ideas about architectures
darch = d.getVar('DPKG_ARCH', True)
if darch in ["x86", "i486", "i586", "i686", "pentium"]:
d.setVar('DPKG_ARCH', 'i386')
elif darch == "x86_64":
d.setVar('DPKG_ARCH', 'amd64')
elif darch == "arm":
d.setVar('DPKG_ARCH', 'armel')
}
python do_package_write_deb () {