From 767d9ca544c9c5bce686d8924619d9ab2385d8e8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 17 Jul 2008 20:49:48 +0000 Subject: Merge multimachine class into bitbake.conf and create singlemachine.bbclass as a backwards compatibility option git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4858 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- meta/classes/base.bbclass | 60 +++++++++++++++++++++++--------------- meta/classes/multimachine.bbclass | 30 ------------------- meta/classes/singlemachine.bbclass | 15 ++++++++++ meta/conf/bitbake.conf | 11 ++++--- meta/conf/distro/poky.conf | 2 +- 5 files changed, 60 insertions(+), 58 deletions(-) delete mode 100644 meta/classes/multimachine.bbclass create mode 100644 meta/classes/singlemachine.bbclass diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 17935fe9a..60a69e24f 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -997,10 +997,12 @@ def base_after_parse(d): depends = depends + " shasum-native:do_populate_staging" bb.data.setVarFlag('do_fetch', 'depends', depends, d) + # 'multimachine' handling mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1) - old_arch = bb.data.getVar('PACKAGE_ARCH', d, 1) - if (old_arch == mach_arch): - # Nothing to do + pkg_arch = bb.data.getVar('PACKAGE_ARCH', d, 1) + + if (pkg_arch == mach_arch): + # Already machine specific - nothing further to do return # @@ -1008,26 +1010,38 @@ def base_after_parse(d): # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0 # override = bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) - if override == '0': - return - - paths = [] - for p in [ "${PF}", "${P}", "${PN}", "files", "" ]: - path = bb.data.expand(os.path.join("${FILE_DIRNAME}", p, "${MACHINE}"), d) - if os.path.isdir(path): - paths.append(path) - if len(paths) == 0: - return - - for s in srcuri.split(): - if not s.startswith("file://"): - continue - local = bb.data.expand(bb.fetch.localpath(s, d), d) - for mp in paths: - if local.startswith(mp): - #bb.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch)) - bb.data.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}", d) - return + if override != '0': + paths = [] + for p in [ "${PF}", "${P}", "${PN}", "files", "" ]: + path = bb.data.expand(os.path.join("${FILE_DIRNAME}", p, "${MACHINE}"), d) + if os.path.isdir(path): + paths.append(path) + if len(paths) != 0: + for s in srcuri.split(): + if not s.startswith("file://"): + continue + local = bb.data.expand(bb.fetch.localpath(s, d), d) + for mp in paths: + if local.startswith(mp): + #bb.note("overriding PACKAGE_ARCH from %s to %s" % (pkg_arch, mach_arch)) + bb.data.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}", d) + bb.data.setVar('MULTIMACH_ARCH', mach_arch, d) + return + + multiarch = pkg_arch + + packages = bb.data.getVar('PACKAGES', d, 1).split() + for pkg in packages: + pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1) + + # We could look for != PACKAGE_ARCH here but how to choose + # if multiple differences are present? + # Look through PACKAGE_ARCHS for the priority order? + if pkgarch and pkgarch == mach_arch: + multiarch = mach_arch + break + + bb.data.setVar('MULTIMACH_ARCH', multiarch, d) python () { base_after_parse(d) diff --git a/meta/classes/multimachine.bbclass b/meta/classes/multimachine.bbclass deleted file mode 100644 index 945d22bfe..000000000 --- a/meta/classes/multimachine.bbclass +++ /dev/null @@ -1,30 +0,0 @@ -STAMP = "${TMPDIR}/stamps/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}/${PF}" -WORKDIR = "${TMPDIR}/work/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}/${PF}" -STAGING_KERNEL_DIR = "${STAGING_DIR}/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}/kernel" -PKGDATA_DIR = "${STAGING_DIR}/pkgdata/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}" - -# Find any machine specific sub packages and if present, mark the -# whole package as machine specific for multimachine purposes. - - -def multi_machine_after_parse(d): - import bb - packages = bb.data.getVar('PACKAGES', d, 1).split() - macharch = bb.data.getVar('MACHINE_ARCH', d, 1) - multiarch = bb.data.getVar('PACKAGE_ARCH', d, 1) - - for pkg in packages: - pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1) - - # We could look for != PACKAGE_ARCH here but how to choose - # if multiple differences are present? - # Look through PACKAGE_ARCHS for the priority order? - if pkgarch and pkgarch == macharch: - multiarch = macharch - - bb.data.setVar('MULTIMACH_ARCH', multiarch, d) - - -python __anonymous () { - multi_machine_after_parse(d) -} diff --git a/meta/classes/singlemachine.bbclass b/meta/classes/singlemachine.bbclass new file mode 100644 index 000000000..c685ce397 --- /dev/null +++ b/meta/classes/singlemachine.bbclass @@ -0,0 +1,15 @@ +# +# Emulates the old mode of OE operation where only one machine can be targetted. +# + +MULTIMACH_TARGET_SYS = "${TARGET_SYS}" +MULTIMACH_HOST_SYS = "${HOST_SYS}" + +STAMP = "${TMPDIR}/stamps/${PF}" +WORKDIR = "${TMPDIR}/work/${PF}" +STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_SYS}" +STAGING_DIR_TARGET = "${STAGING_DIR}/${TARGET_SYS}" +PKGDATA_DIR = "${STAGING_DIR}/pkgdata" +STAGING_KERNEL_DIR = "${STAGING_DIR_HOST}/kernel" + + diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index ad85dc386..cee68ef9f 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -91,6 +91,9 @@ PACKAGE_ARCH = "${BASE_PACKAGE_ARCH}" MACHINE_ARCH = "${@[bb.data.getVar('HOST_ARCH', d, 1), bb.data.getVar('MACHINE', d, 1)][bool(bb.data.getVar('MACHINE', d, 1))]}" PACKAGE_ARCHS = "all any noarch ${TARGET_ARCH} ${PACKAGE_EXTRA_ARCHS} ${MACHINE}" +MULTIMACH_TARGET_SYS = "${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}" +MULTIMACH_HOST_SYS = "${MULTIMACH_ARCH}${HOST_VENDOR}-${HOST_OS}" + # select proper CPU to get binary locales generated QEMU_OPTIONS = "" QEMU_OPTIONS_iwmmxt = "-cpu pxa270-c5" @@ -218,8 +221,8 @@ SVNDIR = "${DL_DIR}/svn" GITDIR = "${DL_DIR}/git" BZRDIR = "${DL_DIR}/bzr" -STAMP = "${TMPDIR}/stamps/${PF}" -WORKDIR = "${TMPDIR}/work/${PF}" +STAMP = "${TMPDIR}/stamps/${MULTIMACH_TARGET_SYS}/${PF}" +WORKDIR = "${TMPDIR}/work/${MULTIMACH_TARGET_SYS}/${PF}" T = "${WORKDIR}/temp" D = "${WORKDIR}/image" S = "${WORKDIR}/${P}" @@ -254,7 +257,7 @@ DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb" DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images" DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools" -PKGDATA_DIR = "${STAGING_DIR}/pkgdata" +PKGDATA_DIR = "${STAGING_DIR}/pkgdata/${MULTIMACH_TARGET_SYS}" SDK_NAME = "${DISTRO}/${TARGET_ARCH}" SDK_PREFIX = "/usr/local/${SDK_NAME}" @@ -264,7 +267,7 @@ SDK_PREFIX = "/usr/local/${SDK_NAME}" ################################################################## OLDEST_KERNEL = "2.4.0" -STAGING_KERNEL_DIR = "${STAGING_DIR_HOST}/kernel" +STAGING_KERNEL_DIR = "${STAGING_DIR}/${MULTIMACH_TARGET_SYS}/kernel" ################################################################## # Specific image creation and rootfs population info. diff --git a/meta/conf/distro/poky.conf b/meta/conf/distro/poky.conf index ba51d1e19..2a6927371 100644 --- a/meta/conf/distro/poky.conf +++ b/meta/conf/distro/poky.conf @@ -9,7 +9,7 @@ MAINTAINER = "OpenedHand " PACKAGE_CLASSES ?= "package_ipk" INHERIT_INSANE ?= "insane" -INHERIT += "${PACKAGE_CLASSES} debian multimachine poky devshell ${INHERIT_INSANE}" +INHERIT += "${PACKAGE_CLASSES} debian poky devshell ${INHERIT_INSANE}" # For some reason, this doesn't work # TARGET_OS ?= "linux" # TARGET_VENDOR ?= "-poky" -- cgit v1.2.3