diff options
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/base.bbclass | 31 | ||||
| -rw-r--r-- | classes/clean.bbclass | 53 | ||||
| -rw-r--r-- | classes/devshell.bbclass | 3 | ||||
| -rw-r--r-- | classes/distutils-common-base.bbclass | 4 | ||||
| -rw-r--r-- | classes/gconf.bbclass | 7 | ||||
| -rw-r--r-- | classes/gitver.bbclass | 54 | ||||
| -rw-r--r-- | classes/glx-use-tls.bbclass | 7 | ||||
| -rw-r--r-- | classes/gnome.bbclass | 1 | ||||
| -rw-r--r-- | classes/image.bbclass | 4 | ||||
| -rw-r--r-- | classes/insane.bbclass | 2 | ||||
| -rw-r--r-- | classes/kernel.bbclass | 19 | ||||
| -rw-r--r-- | classes/package.bbclass | 45 | ||||
| -rw-r--r-- | classes/package_deb.bbclass | 7 | ||||
| -rw-r--r-- | classes/package_ipk.bbclass | 7 | ||||
| -rw-r--r-- | classes/package_rpm.bbclass | 4 | ||||
| -rw-r--r-- | classes/package_tar.bbclass | 2 | ||||
| -rw-r--r-- | classes/patch.bbclass | 20 | ||||
| -rw-r--r-- | classes/qmake_base.bbclass | 2 | ||||
| -rw-r--r-- | classes/sanity.bbclass | 2 | ||||
| -rw-r--r-- | classes/siteinfo.bbclass | 22 | ||||
| -rw-r--r-- | classes/src_distribute.bbclass | 43 | ||||
| -rw-r--r-- | classes/src_distribute_local.bbclass | 58 | ||||
| -rw-r--r-- | classes/srctree.bbclass | 115 | ||||
| -rw-r--r-- | classes/task-metadata-track.bbclass | 96 | ||||
| -rw-r--r-- | classes/vala.bbclass | 13 |
25 files changed, 556 insertions, 65 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass index ef6c0abf8f..d29ba4bfcf 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -84,7 +84,7 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): # call md5(sum) and shasum try: - md5pipe = os.popen('md5sum ' + localpath) + md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath)) md5data = (md5pipe.readline().split() or [ "" ])[0] md5pipe.close() except OSError: @@ -159,6 +159,12 @@ def base_read_file(filename): return f.read().strip() return None +def base_ifelse(condition, iftrue = True, iffalse = False): + if condition: + return iftrue + else: + return iffalse + def base_conditional(variable, checkvalue, truevalue, falsevalue, d): import bb if bb.data.getVar(variable,d,1) == checkvalue: @@ -517,6 +523,12 @@ python base_do_clean() { os.system('rm -f '+ dir) } +python do_cleanall() { + pass +} +do_cleanall[recrdeptask] = "do_clean" +addtask cleanall after do_clean + #Uncomment this for bitbake 1.8.12 #addtask rebuild after do_${BB_DEFAULT_TASK} addtask rebuild @@ -614,6 +626,9 @@ python base_do_fetch() { except bb.fetch.NoMethodError: (type, value, traceback) = sys.exc_info() raise bb.build.FuncFailed("No method: %s" % value) + except bb.MalformedUrl: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("Malformed URL: %s" % value) try: bb.fetch.go(localdata) @@ -719,9 +734,14 @@ base_do_buildall() { : } +def subprocess_setup(): + import signal + # Python installs a SIGPIPE handler by default. This is usually not what + # non-Python subprocesses expect. + signal.signal(signal.SIGPIPE, signal.SIG_DFL) def oe_unpack_file(file, data, url = None): - import bb, os + import bb, os, subprocess if not url: url = "file://%s" % file dots = file.split(".") @@ -790,7 +810,7 @@ def oe_unpack_file(file, data, url = None): cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) bb.note("Unpacking %s to %s/" % (base_path_out(file, data), base_path_out(os.getcwd(), data))) - ret = os.system(cmd) + ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) os.chdir(save_cwd) @@ -1279,7 +1299,6 @@ ${DEBIAN_MIRROR} ftp://ftp.es.debian.org/debian/pool ${DEBIAN_MIRROR} ftp://ftp.se.debian.org/debian/pool ${DEBIAN_MIRROR} ftp://ftp.tr.debian.org/debian/pool ${GNU_MIRROR} ftp://mirrors.kernel.org/gnu -${GNU_MIRROR} ftp://ftp.matrix.com.br/pub/gnu ${GNU_MIRROR} ftp://ftp.cs.ubc.ca/mirror2/gnu ${GNU_MIRROR} ftp://sunsite.ust.hk/pub/gnu ${GNU_MIRROR} ftp://ftp.ayamura.org/pub/gnu @@ -1313,6 +1332,10 @@ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://gd.tuwien.ac.at/utils/adm ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://sunsite.ualberta.ca/pub/Mirror/lsof/ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://the.wiretapped.net/pub/security/host-security/lsof/ http://www.apache.org/dist http://archive.apache.org/dist +ftp://.*/.* http://mirrors.openembedded.org/ +https?$://.*/.* http://mirrors.openembedded.org/ +ftp://.*/.* http://sources.openembedded.org/ +https?$://.*/.* http://sources.openembedded.org/ } diff --git a/classes/clean.bbclass b/classes/clean.bbclass new file mode 100644 index 0000000000..65c1ab5d76 --- /dev/null +++ b/classes/clean.bbclass @@ -0,0 +1,53 @@ +def clean_builddir(d): + from shutil import rmtree + + builddir = d.getVar("B", True) + srcdir = d.getVar("S", True) + if builddir != srcdir: + rmtree(builddir, ignore_errors=True) + +def clean_stamps(d): + from glob import glob + from bb import note + from bb.data import expand + from os import unlink + + note("Removing stamps") + for stamp in glob(expand('${STAMP}.*', d)): + try: + unlink(stamp) + except OSError: + pass + +def clean_workdir(d): + from shutil import rmtree + from bb import note + + workdir = d.getVar("WORKDIR", 1) + note("Removing %s" % workdir) + rmtree(workdir, ignore_errors=True) + +def clean_git(d): + from subprocess import call + + call(["git", "clean", "-d", "-f", "-X"], cwd=d.getVar("S", True)) + +def clean_make(d): + import bb + + bb.note("Running make clean") + try: + bb.build.exec_func("__do_clean_make", d) + except bb.build.FuncFailed: + pass + +__do_clean_make () { + oe_runmake clean +} + +python do_clean () { + clean_stamps(d) + clean_workdir(d) + clean_builddir(d) + clean_make(d) +} diff --git a/classes/devshell.bbclass b/classes/devshell.bbclass index 2944dbbfc2..9327b55d0a 100644 --- a/classes/devshell.bbclass +++ b/classes/devshell.bbclass @@ -4,7 +4,8 @@ do_devshell[dirs] = "${S}" do_devshell[nostamp] = "1" export DISPLAY -export XAUTHORITY +export DBUS_SESSION_BUS_ADDRESS +export XAUTHORITY ?= "${HOME}/.Xauthority" devshell_do_devshell() { export TERMWINDOWTITLE="Bitbake Developer Shell" diff --git a/classes/distutils-common-base.bbclass b/classes/distutils-common-base.bbclass index 9ca392b84a..01bf9eaeba 100644 --- a/classes/distutils-common-base.bbclass +++ b/classes/distutils-common-base.bbclass @@ -8,7 +8,9 @@ def python_dir(d): staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 ) for majmin in "2.6 2.5 2.4 2.3".split(): if os.path.exists( "%s/python%s" % ( staging_incdir, majmin ) ): return "python%s" % majmin - raise "No Python in STAGING_INCDIR. Forgot to build python-native ?" + if not "python-native" in bb.data.getVar( "DEPENDS", d, 1 ).split(): + raise "No Python in STAGING_INCDIR. Forgot to build python-native ?" + return "INVALID" PYTHON_DIR = "${@python_dir(d)}" diff --git a/classes/gconf.bbclass b/classes/gconf.bbclass index 99f33e433a..47df06329b 100644 --- a/classes/gconf.bbclass +++ b/classes/gconf.bbclass @@ -45,9 +45,10 @@ python populate_packages_append () { if schemas != []: bb.note("adding gconf postinst and prerm scripts to %s" % pkg) bb.data.setVar('SCHEMA_FILES', " ".join(schemas), d) - postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) - if not postinst: - postinst = '#!/bin/sh\n' + postinst = '#!/bin/sh\n' + pkgpostinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) + if pkgpostinst: + postinst += pkgpostinst postinst += bb.data.getVar('gconf_postinst', d, 1) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) prerm = bb.data.getVar('pkg_prerm_%s' % pkg, d, 1) or bb.data.getVar('pkg_prerm', d, 1) diff --git a/classes/gitver.bbclass b/classes/gitver.bbclass new file mode 100644 index 0000000000..92c053ae24 --- /dev/null +++ b/classes/gitver.bbclass @@ -0,0 +1,54 @@ +# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> +# Released under the MIT license (see COPYING.MIT for the terms) +# +# gitver.bbclass provides a GITVER variable which is a (fairly) sane version, +# for use in ${PV}, extracted from the ${S} git checkout, assuming it is one. +# This is most useful in concert with srctree.bbclass. + + +GITVER = "${@get_git_pv('${S}', d)}" + +def gitver_mark_dependency(d): + from bb.data import expand + from bb.parse import mark_dependency + from os.path import abspath + + fn = abspath(expand("${S}/.git/HEAD", d)) + mark_dependency(d, fn) + +def get_git_pv(path, d, tagadjust=None): + from subprocess import Popen, PIPE + from os.path import join + from bb import error + + env = {"GIT_DIR": join(d.getVar("S", True), ".git")} + + def popen(cmd, **kwargs): + kwargs["stderr"] = PIPE + kwargs["stdout"] = PIPE + kwargs["env"] = env + try: + pipe = Popen(cmd, **kwargs) + except OSError, e: + #error("Execution of %s failed: %s" % (cmd, e)) + return + + (stdout, stderr) = pipe.communicate(None) + if pipe.returncode != 0: + #error("Execution of %s failed: %s" % (cmd, stderr)) + return + return stdout.rstrip() + + gitver_mark_dependency(d) + + ver = popen(["git", "describe", "--tags"], cwd=path) + if not ver: + ver = popen(["git", "rev-parse", "--short", "HEAD"], cwd=path) + if ver: + return "0.0-%s" % ver + else: + return "0.0" + else: + if tagadjust: + ver = tagadjust(ver) + return ver diff --git a/classes/glx-use-tls.bbclass b/classes/glx-use-tls.bbclass new file mode 100644 index 0000000000..7530872fa4 --- /dev/null +++ b/classes/glx-use-tls.bbclass @@ -0,0 +1,7 @@ +def get_tls_setting(bb, d): + # until we have no prober TLS support in uclibc disable it + if bb.data.getVar('TARGET_OS', d, 1).find('uclibc') >= 0 : + return "" + return "--enable-glx-tls" + +EXTRA_OECONF += "${@get_tls_setting(bb, d)}" diff --git a/classes/gnome.bbclass b/classes/gnome.bbclass index da88884dde..3d04298ac6 100644 --- a/classes/gnome.bbclass +++ b/classes/gnome.bbclass @@ -23,5 +23,6 @@ gnome_stage_includes() { do_install_append() { rm -rf ${D}${localstatedir}/lib/scrollkeeper/* + rm -f ${D}${datadir}/applications/*.cache } diff --git a/classes/image.bbclass b/classes/image.bbclass index 385043bfc7..f7afbab81e 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -243,8 +243,10 @@ if [ -e ${IMAGE_ROOTFS}/usr/bin/opkg-cl ] ; then ${OPKG} list_installed | awk '{print $1}' |sort | uniq > /tmp/installed-packages for i in $(cat /tmp/installed-packages | grep -v locale) ; do - for translation in ${IMAGE_LINGUAS} $(echo ${IMAGE_LINGUAS} | awk -F_ '{print $1}'); do + for translation in ${IMAGE_LINGUAS}; do + translation_split=$(echo ${translation} | awk -F '-' '{print $1}') echo ${i}-locale-${translation} + echo ${i}-locale-${translation_split} done done | sort | uniq > /tmp/wanted-locale-packages diff --git a/classes/insane.bbclass b/classes/insane.bbclass index 606270d62c..c41b84a4c0 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -73,7 +73,7 @@ def package_qa_get_machine_dict(): "arm" : (40, 0, 0, True, True), "armeb" : (40, 0, 0, False, True), }, - "linux-uclibcgnueabi" : { + "linux-uclibceabi" : { "arm" : (40, 0, 0, True, True), "armeb" : (40, 0, 0, False, True), }, diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index b4987608ed..c5192d59d4 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -78,6 +78,10 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" UBOOT_ENTRYPOINT ?= "20008000" UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" +# For the kernel, we don't want the '-e MAKEFLAGS=' in EXTRA_OEMAKE. +# We don't want to override kernel Makefile variables from the environment +EXTRA_OEMAKE = "" + kernel_do_compile() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE oe_runmake include/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}" @@ -103,8 +107,15 @@ kernel_do_stage() { cp -fR arch/${ARCH}/include/asm/* ${STAGING_KERNEL_DIR}/include/$ASMDIR/ install -d ${STAGING_KERNEL_DIR}/arch/${ARCH}/include cp -fR arch/${ARCH}/* ${STAGING_KERNEL_DIR}/arch/${ARCH}/ + + # Check for arch/x86 on i386 + elif [ -d arch/x86/include/asm/ ]; then + cp -fR arch/x86/include/asm/* ${STAGING_KERNEL_DIR}/include/asm-x86/ + install -d ${STAGING_KERNEL_DIR}/arch/x86/include + cp -fR arch/x86/* ${STAGING_KERNEL_DIR}/arch/x86/ fi - rm -f $ASMDIR ${STAGING_KERNEL_DIR}/include/asm + + rm -f ${STAGING_KERNEL_DIR}/include/asm ln -sf $ASMDIR ${STAGING_KERNEL_DIR}/include/asm mkdir -p ${STAGING_KERNEL_DIR}/include/asm-generic @@ -175,6 +186,7 @@ kernel_do_install() { install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} + [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION} install -d ${D}/etc/modutils if [ "${KERNEL_MAJOR_VERSION}" = "2.6" ]; then install -d ${D}/etc/modprobe.d @@ -225,7 +237,7 @@ EXPORT_FUNCTIONS do_compile do_install do_stage do_configure PACKAGES = "kernel kernel-base kernel-image kernel-dev kernel-vmlinux" FILES = "" FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" -FILES_kernel-dev = "/boot/System.map* /boot/config*" +FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config*" FILES_kernel-vmlinux = "/boot/vmlinux*" RDEPENDS_kernel = "kernel-base" RRECOMMENDS_kernel-module-hostap-cs += '${@base_version_less_or_equal("KERNEL_VERSION", "2.6.17", "", "apm-wifi-suspendfix", d)}' @@ -510,6 +522,7 @@ addtask uboot_mkimage before do_install after do_compile KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}" KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" +MODULES_IMAGE_BASE_NAME ?= modules-${PV}-${PR}-${MACHINE} do_deploy() { install -d ${DEPLOY_DIR_IMAGE} @@ -517,7 +530,7 @@ do_deploy() { package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin if [ -d "${D}/lib" ]; then - tar -cvzf ${DEPLOY_DIR_IMAGE}/modules-${PV}-${PR}-${MACHINE}.tgz -C ${D} lib + tar -cvzf ${DEPLOY_DIR_IMAGE}/${MODULES_IMAGE_BASE_NAME}.tgz -C ${D} lib fi cd ${DEPLOY_DIR_IMAGE} diff --git a/classes/package.bbclass b/classes/package.bbclass index f6bd7c5b4a..5a9fa503ae 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -202,6 +202,51 @@ def runstrip(file, d): return 1 +def write_package_md5sums (root, outfile, ignorepaths): + # For each regular file under root, writes an md5sum to outfile. + # With thanks to patch.bbclass. + import bb, os + + try: + # Python 2.5+ + import hashlib + ctor = hashlib.md5 + except ImportError: + import md5 + ctor = md5.new + + outf = file(outfile, 'w') + + # Each output line looks like: "<hex...> <filename without leading slash>" + striplen = len(root) + if not root.endswith('/'): + striplen += 1 + + for walkroot, dirs, files in os.walk(root): + # Skip e.g. the DEBIAN directory + if walkroot[striplen:] in ignorepaths: + dirs[:] = [] + continue + + for name in files: + fullpath = os.path.join(walkroot, name) + if os.path.islink(fullpath) or (not os.path.isfile(fullpath)): + continue + + m = ctor() + f = file(fullpath, 'rb') + while True: + d = f.read(8192) + if not d: + break + m.update(d) + f.close() + + print >> outf, "%s %s" % (m.hexdigest(), fullpath[striplen:]) + + outf.close() + + # # Package data handling routines # diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index e5339a9064..4a17010538 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -243,6 +243,13 @@ python do_package_deb () { conffiles.write('%s\n' % f) conffiles.close() + try: + write_package_md5sums(root, os.path.join(controldir, 'md5sums'), + ['DEBIAN']) + except: + bb.utils.unlockfile(lf) + raise + os.chdir(basedir) ret = os.system("PATH=\"%s\" fakeroot dpkg-deb -b %s %s" % (bb.data.getVar("PATH", localdata, 1), root, pkgoutdir)) if ret != 0: diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index e3a7522619..e5561082fd 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -266,10 +266,9 @@ python do_package_ipk () { ctrlfile.write("Replaces: %s\n" % ", ".join(rreplaces)) if rconflicts: ctrlfile.write("Conflicts: %s\n" % ", ".join(rconflicts)) - src_uri = bb.data.getVar("SRC_URI", localdata, 1) - if src_uri: - src_uri = re.sub("\s+", " ", src_uri) - ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) + src_uri = bb.data.getVar("SRC_URI", localdata, 1) or d.getVar("FILE", True) + src_uri = re.sub("\s+", " ", src_uri) + ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) ctrlfile.close() for script in ["preinst", "postinst", "prerm", "postrm"]: diff --git a/classes/package_rpm.bbclass b/classes/package_rpm.bbclass index 9755bf1d2d..13cb8773af 100644 --- a/classes/package_rpm.bbclass +++ b/classes/package_rpm.bbclass @@ -210,7 +210,9 @@ python do_package_rpm () { python () { import bb - if bb.data.getVar('PACKAGES', d, True) != '': + if bb.data.getVar('PACKAGES', d, True) != '' and \ + not bb.data.inherits_class('native', d) and \ + not bb.data.inherits_class('cross', d): deps = (bb.data.getVarFlag('do_package_write_rpm', 'depends', d) or "").split() deps.append('rpm-native:do_populate_staging') deps.append('fakeroot-native:do_populate_staging') diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass index cb70a5fae8..a0eacf27f5 100644 --- a/classes/package_tar.bbclass +++ b/classes/package_tar.bbclass @@ -1,7 +1,5 @@ inherit package -IMAGE_PKGTYPE ?= "tar" - python package_tar_fn () { import os from bb import data diff --git a/classes/patch.bbclass b/classes/patch.bbclass index 2f99e4cf30..dfb8ec960f 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -189,6 +189,24 @@ def patch_init(d): def Clean(self): """""" + class GitApplyTree(PatchTree): + def __init__(self, dir, d): + PatchTree.__init__(self, dir, d) + + def _applypatch(self, patch, force = False, reverse = False, run = True): + shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']] + + if reverse: + shellcmd.append('-R') + + shellcmd.append(patch['file']) + + if not run: + return "sh" + "-c" + " ".join(shellcmd) + + return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) + + class QuiltTree(PatchSet): def _runcmd(self, args, run = True): quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1) @@ -424,6 +442,7 @@ def patch_init(d): g["PatchSet"] = PatchSet g["PatchTree"] = PatchTree g["QuiltTree"] = QuiltTree + g["GitApplyTree"] = GitApplyTree g["Resolver"] = Resolver g["UserResolver"] = UserResolver g["NOOPResolver"] = NOOPResolver @@ -449,6 +468,7 @@ python patch_do_patch() { patchsetmap = { "patch": PatchTree, "quilt": QuiltTree, + "git": GitApplyTree, } cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt'] diff --git a/classes/qmake_base.bbclass b/classes/qmake_base.bbclass index 5eccfa47e4..50d8bb53da 100644 --- a/classes/qmake_base.bbclass +++ b/classes/qmake_base.bbclass @@ -33,7 +33,7 @@ oe_qmake_mkspecs () { qmake_base_do_configure() { case ${QMAKESPEC} in - *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++|*linux-uclibcgnueabi-oe-g++) + *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++|*linux-uclibceabi-oe-g++) ;; *-oe-g++) die Unsupported target ${TARGET_OS} for oe-g++ qmake spec diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index 29624c3f78..83c03299bf 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -185,7 +185,7 @@ def check_sanity(e): archs = data.getVar('PACKAGE_ARCHS', e.data, True).split() for arch in archs: if archs.count(arch) != 1: - messages = messages + "Error, Your PACKAGE_ARCHS field contains duplicates. Perhaps you set EXTRA_PACKAGE_ARCHS twice accidently through some tune file?\n" + messages = messages + "Error, Your PACKAGE_ARCHS field contains duplicates. Perhaps you set PACKAGE_EXTRA_ARCHS twice accidently through some tune file?\n" break if messages != "": diff --git a/classes/siteinfo.bbclass b/classes/siteinfo.bbclass index e51d7ab8a6..2bacd69488 100644 --- a/classes/siteinfo.bbclass +++ b/classes/siteinfo.bbclass @@ -22,21 +22,27 @@ def get_siteinfo_list(d): targetinfo = {\ "armeb-linux": "endian-big bit-32 common-linux common-glibc arm-common",\ + "armeb-linux-gnu": "endian-big bit-32 common-linux common-glibc arm-common",\ "armeb-linux-gnueabi": "endian-big bit-32 common-linux common-glibc arm-common armeb-linux",\ "armeb-linux-uclibc": "endian-big bit-32 common-linux common-uclibc arm-common",\ - "armeb-linux-uclibcgnueabi": "endian-big bit-32 common-linux common-uclibc arm-common armeb-linux-uclibc",\ + "armeb-linux-uclibceabi": "endian-big bit-32 common-linux common-uclibc arm-common armeb-linux-uclibc",\ "arm-darwin": "endian-little bit-32 common-darwin",\ "arm-darwin9": "endian-little bit-32 common-darwin",\ "arm-linux": "endian-little bit-32 common-linux common-glibc arm-common",\ + "arm-linux-gnu": "endian-little bit-32 common-linux common-glibc arm-common",\ "arm-linux-gnueabi": "endian-little bit-32 common-linux common-glibc arm-common arm-linux",\ "arm-linux-uclibc": "endian-little bit-32 common-linux common-uclibc arm-common",\ - "arm-linux-uclibcgnueabi": "endian-little bit-32 common-linux common-uclibc arm-common arm-linux-uclibc",\ + "arm-linux-uclibceabi": "endian-little bit-32 common-linux common-uclibc arm-common arm-linux-uclibc",\ "avr32-linux-uclibc": "endian-big bit-32 common-linux common-uclibc avr32-common",\ "bfin-uclinux-uclibc": "endian-little bit-32 common-uclibc bfin-common",\ "i386-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "i386-linux-gnu": "endian-little bit-32 common-linux common-glibc ix86-common",\ "i486-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "i486-linux-gnu": "endian-little bit-32 common-linux common-glibc ix86-common",\ "i586-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "i586-linux-gnu": "endian-little bit-32 common-linux common-glibc ix86-common",\ "i686-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "i686-linux-gnu": "endian-little bit-32 common-linux common-glibc ix86-common",\ "i386-linux-uclibc": "endian-little bit-32 common-linux common-uclibc ix86-common",\ "i486-linux-uclibc": "endian-little bit-32 common-linux common-uclibc ix86-common",\ "i586-linux-uclibc": "endian-little bit-32 common-linux common-uclibc ix86-common",\ @@ -50,22 +56,34 @@ def get_siteinfo_list(d): "i586-mingw32": "endian-little bit-32 common-mingw ix86-common",\ "i686-mingw32": "endian-little bit-32 common-mingw ix86-common",\ "ia64-linux": "endian-little bit-64 common-linux common-glibc",\ + "ia64-linux-gnu": "endian-little bit-64 common-linux common-glibc",\ "mipsel-linux": "endian-little bit-32 common-linux common-glibc",\ + "mipsel-linux-gnu": "endian-little bit-32 common-linux common-glibc",\ "mipsel-linux-uclibc": "endian-little bit-32 common-linux common-uclibc",\ "mips-linux": "endian-big bit-32 common-linux common-glibc",\ + "mips-linux-gnu": "endian-big bit-32 common-linux common-glibc",\ "mips-linux-uclibc": "endian-big bit-32 common-linux common-uclibc",\ "powerpc-darwin": "endian-big bit-32 common-darwin",\ "ppc-linux": "endian-big bit-32 common-linux common-glibc powerpc-common",\ + "ppc-linux-gnu": "endian-big bit-32 common-linux common-glibc powerpc-common",\ "ppc64-linux": "endian-big bit-64 common-linux common-glibc powerpc-common",\ + "ppc64-linux-gnu": "endian-big bit-64 common-linux common-glibc powerpc-common",\ "powerpc-linux": "endian-big bit-32 common-linux common-glibc powerpc-common",\ + "powerpc-linux-gnu": "endian-big bit-32 common-linux common-glibc powerpc-common",\ "powerpc-linux-gnuspe": "endian-big bit-32 common-linux common-glibc powerpc-common",\ "powerpc-linux-uclibc": "endian-big bit-32 common-linux common-uclibc powerpc-common",\ + "powerpc-linux-uclibcspe": "endian-big bit-32 common-linux common-uclibc powerpc-common",\ "sh3-linux": "endian-little bit-32 common-linux common-glibc sh-common",\ + "sh3-linux-gnu": "endian-little bit-32 common-linux common-glibc sh-common",\ "sh4-linux": "endian-little bit-32 common-linux common-glibc sh-common",\ + "sh4-linux-gnu": "endian-little bit-32 common-linux common-glibc sh-common",\ "sh4-linux-uclibc": "endian-little bit-32 common-linux common-uclibc sh-common",\ "sparc-linux": "endian-big bit-32 common-linux common-glibc",\ + "sparc-linux-gnu": "endian-big bit-32 common-linux common-glibc",\ "viac3-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "viac3-linux-gnu": "endian-little bit-32 common-linux common-glibc ix86-common",\ "x86_64-linux": "endian-little bit-64 common-linux common-glibc",\ + "x86_64-linux-gnu": "endian-little bit-64 common-linux common-glibc",\ "x86_64-linux-uclibc": "endian-little bit-64 common-linux common-uclibc"} if target in targetinfo: info = targetinfo[target].split() diff --git a/classes/src_distribute.bbclass b/classes/src_distribute.bbclass index 30b2670011..7d75c9e16f 100644 --- a/classes/src_distribute.bbclass +++ b/classes/src_distribute.bbclass @@ -1,29 +1,46 @@ +SRC_DISTRIBUTE_DLONLY ?= "0" SRC_DISTRIBUTECOMMAND[func] = "1" + +addtask distribute_sources before do_build after do_fetch python do_distribute_sources () { + import os, re, bb + + bb.build.exec_func("do_fetch", d) + l = bb.data.createCopy(d) bb.data.update_data(l) - licenses = (bb.data.getVar('LICENSE', d, 1) or "unknown").split() - sources_dir = bb.data.getVar('SRC_DISTRIBUTEDIR', d, 1) - import re + licenses = (bb.data.getVar('LICENSE', d, 1) or "unknown").split() for license in licenses: for entry in license.split("|"): for url in ((bb.data.getVar('SRC_URI', d, 1) or '').split()): bb.fetch.init([url], d) s = bb.fetch.localpath(url, d) s = re.sub(';.*$', '', s) + + try: + dlonly = int(d.getVar("SRC_DISTRIBUTE_DLONLY", 1)) + except ValueError: + raise bb.build.FuncFailed("Invalid value for SRC_DISTRIBUTE_DLONLY: expected integer.") + if dlonly: + dldir = os.path.realpath(d.getVar("DL_DIR", 1) or "") + if dldir and not \ + os.path.realpath(s).startswith(dldir + os.path.sep): + continue + cmd = bb.data.getVar('SRC_DISTRIBUTECOMMAND', d, 1) if not cmd: - raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not defined") - bb.data.setVar('SRC', s, d) - bb.data.setVar('SRC_DISTRIBUTEDIR', "%s/%s" % (sources_dir, entry), d) - bb.build.exec_func('SRC_DISTRIBUTECOMMAND', d) + raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not set") + bb.debug(2, "srcdist: running %s" % cmd) + bb.data.setVar('SRC', os.path.normpath(s), l) + bb.data.setVar('LIC', entry, l) + bb.build.exec_func('SRC_DISTRIBUTECOMMAND', l) } -addtask distribute_sources before do_build after do_fetch +addtask distribute_sources_all after do_distribute_sources +do_distribute_sources_all[recrdeptask] = "do_distribute_sources" +do_distribute_sources_all[nostamp] = "1" -addtask distsrcall after do_distribute_sources -do_distsrcall[recrdeptask] = "do_distribute_sources" -base_do_distsrcall() { - : -} +# compatability wrapper +addtask distsrcall after do_distribute_sources_all +do_distsrcall[nostamp] = "1" diff --git a/classes/src_distribute_local.bbclass b/classes/src_distribute_local.bbclass index 5f0cef5bec..5cec2880aa 100644 --- a/classes/src_distribute_local.bbclass +++ b/classes/src_distribute_local.bbclass @@ -1,31 +1,37 @@ inherit src_distribute -# SRC_DIST_LOCAL possible values: -# copy copies the files from ${A} to the distributedir -# symlink symlinks the files from ${A} to the distributedir -# move+symlink moves the files into distributedir, and symlinks them back SRC_DIST_LOCAL ?= "move+symlink" SRC_DISTRIBUTEDIR ?= "${DEPLOY_DIR}/sources" -SRC_DISTRIBUTECOMMAND () { - s="${SRC}" - if [ ! -L "$s" ] && (echo "$s"|grep "^${DL_DIR}"); then - : - else - exit 0; - fi - mkdir -p ${SRC_DISTRIBUTEDIR} - case "${SRC_DIST_LOCAL}" in - copy) - test -e $s.md5 && cp -f $s.md5 ${SRC_DISTRIBUTEDIR}/ - cp -f $s ${SRC_DISTRIBUTEDIR}/ - ;; - symlink) - test -e $s.md5 && ln -sf $s.md5 ${SRC_DISTRIBUTEDIR}/ - ln -sf $s ${SRC_DISTRIBUTEDIR}/ - ;; - move+symlink) - mv $s ${SRC_DISTRIBUTEDIR}/ - ln -sf ${SRC_DISTRIBUTEDIR}/`basename $s` $s - ;; - esac +SRC_DISTRIBUTECOMMAND[dirs] = "${SRC_DISTRIBUTEDIR}/${LIC}/${PN}" + +# symlinks the files to the SRC_DISTRIBUTEDIR +SRC_DISTRIBUTECOMMAND-symlink () { + test -e ${SRC}.md5 && ln -sf ${SRC}.md5 . + ln -sf ${SRC} . +} + +# copies the files to the SRC_DISTRIBUTEDIR +SRC_DISTRIBUTECOMMAND-copy () { + test -e ${SRC}.md5 && cp -f ${SRC}.md5 . + cp -fr ${SRC} . +} + +# moves the files to the SRC_DISTRIBUTEDIR and symlinks them back +SRC_DISTRIBUTECOMMAND-move+symlink () { + if ! [ -L ${SRC} ]; then + mv ${SRC} . + ln -sf $PWD/`basename ${SRC}` ${SRC} + if [ -e ${SRC}.md5 ]; then + mv ${SRC}.md5 . + ln -sf $PWD/`basename ${SRC}.md5` ${SRC}.md5 + fi + fi +} + +#SRC_DISTRIBUTECOMMAND = "${@str(d.getVar('SRC_DISTRIBUTECOMMAND-%s' % d.getVar('SRC_DIST_LOCAL', 1), 1))}" +python () { + if d.getVar("SRC_DISTRIBUTECOMMAND", 1) is None: + cmd = d.getVar("SRC_DISTRIBUTECOMMAND-%s" % d.getVar("SRC_DIST_LOCAL", 1), 0) + if cmd: + d.setVar("SRC_DISTRIBUTECOMMAND", cmd) } diff --git a/classes/srctree.bbclass b/classes/srctree.bbclass new file mode 100644 index 0000000000..dbf8ad2c3f --- /dev/null +++ b/classes/srctree.bbclass @@ -0,0 +1,115 @@ +# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> +# Released under the MIT license (see COPYING.MIT for the terms) +# +# srctree.bbclass enables operation inside of an existing source tree for a +# project, rather than using the fetch/unpack/patch idiom. +# +# By default, it expects that you're keeping the recipe(s) inside the +# aforementioned source tree, but you could override S to point at an external +# directory and place the recipes in a normal collection/overlay, if you so +# chose. +# +# It also provides some convenience python functions for assembling your +# do_clean, if you want to leverage things like 'git clean' to simplify the +# operation. + + +# Grab convenience methods & sane default for do_clean +inherit clean + +# Build here +S = "${FILE_DIRNAME}" +SRC_URI = "" + + +def merge_tasks(d): + """ + merge_tasks performs two operations: + 1) removes do_patch and its deps from the build entirely. + 2) merges all of the operations that occur prior to do_populate_staging + into do_populate_staging. + + This is necessary, because of recipe variants (normal, native, cross, + sdk). If a bitbake run happens to want to build more than one of + these variants in a single run, it's possible for them to step on one + another's toes, due to the shared ${S}. Interleaved + configure/compile/install amongst variants will break things badly. + """ + from itertools import chain + from bb import note + + def __gather_taskdeps(task, seen): + for dep in d.getVarFlag(task, "deps"): + if not dep in seen: + __gather_taskdeps(dep, seen) + if not task in seen: + seen.append(task) + + def gather_taskdeps(task): + items = [] + __gather_taskdeps(task, items) + return items + + newtask = "do_populate_staging" + mergedtasks = gather_taskdeps(newtask) + mergedtasks.pop() + deltasks = gather_taskdeps("do_patch") + + for task in (key for key in d.keys() + if d.getVarFlag(key, "task") and + not key in mergedtasks): + deps = d.getVarFlag(task, "deps") + for mergetask in mergedtasks: + if mergetask in (d.getVarFlag(task, "recrdeptask"), + d.getVarFlag(task, "recdeptask"), + d.getVarFlag(task, "deptask")): + continue + + if mergetask in deps: + deps.remove(mergetask) + #note("removing dep on %s from %s" % (mergetask, task)) + + if not mergetask in deltasks and \ + not newtask in deps: + #note("adding dep on %s to %s" % (newtask, task)) + deps.append(newtask) + d.setVarFlag(task, "deps", deps) + + for task in mergedtasks[:-1]: + deps = d.getVarFlag(task, "deps") + for deltask in deltasks: + if deltask in deps: + deps.remove(deltask) + d.setVarFlag(task, "deps", deps) + + # Pull cross recipe task deps over + depends = (d.getVarFlag(task, "depends") or "" + for task in mergedtasks[:-1] + if not task in deltasks) + d.setVarFlag("do_populate_staging", "depends", " ".join(depends)) + +python () { + merge_tasks(d) +} + +# Manually run do_install & all of its deps, then do_stage +python do_populate_staging () { + from os.path import exists + from bb.build import exec_task, exec_func + from bb import note + + stamp = d.getVar("STAMP", True) + + def rec_exec_task(task, seen): + for dep in d.getVarFlag(task, "deps"): + if not dep in seen: + rec_exec_task(dep, seen) + seen.add(task) + #if not exists("%s.%s" % (stamp, task)): + note("%s: executing task %s" % (d.getVar("PF", True), task)) + exec_task(task, d) + + rec_exec_task("do_install", set()) + exec_func("do_stage", d) +} +do_populate_staging[lockfiles] += "${S}/.lock" diff --git a/classes/task-metadata-track.bbclass b/classes/task-metadata-track.bbclass new file mode 100644 index 0000000000..d3622aef68 --- /dev/null +++ b/classes/task-metadata-track.bbclass @@ -0,0 +1,96 @@ +# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> +# Released under the MIT license (see COPYING.MIT for the terms) +# +# This class uses events to capture the state of the datastore when the task +# starts, and after it completes. It diffs those captured states, and emits +# messages showing which variables changed, and what their values were changed +# to. +# +# It provides a mechanism to blacklist variables you expect to change, both +# globally and on a per-task basis. +# +# Known instances of tasks changing metadata: +# +# PSTAGE_PKGMANAGER changes by calls to pstage_set_pkgmanager in: +# do_clean, do_setscene, do_package_stage +# +# Subpackage metadata, read by the pkgdata functions in base.bbclass, in: +# do_package, do_package_stage, do_package_write_* + + +TASK_METADATA_BLACKLIST = "\ + __RUNQUEUE_DO_NOT_USE_EXTERNALLY \ +" + +#TASK_METADATA_BLACKLIST_do_clean = "\ +# PSTAGE_PKGMANAGER \ +#" + + +def dict_diff(olddict, newdict): + diff = {} + for key in set(olddict).union(set(newdict)): + old = olddict.get(key) + new = newdict.get(key) + if old != new: + diff[key] = (old, new) + + return diff + +def dict_for_data(data): + newdict = {} + for key in data.keys(): + newdict[key] = data.getVar(key, False) + return newdict + +def task_metadata_track_start(task, data): + originaldata = dict_for_data(data) + data.setVar("__originaldata_%s" % task, originaldata) + +def task_metadata_track_stop(task, data): + from bb import note + + pf = data.getVar("PF", True) + def emit(msg): + note("%s: %s" % (pf, msg)) + + originaldata = data.getVar("__originaldata_%s" % task, False) + newdata = dict_for_data(data) + blacklist = data.getVar("TASK_METADATA_BLACKLIST", True).split() + \ + (data.getVar("TASK_METADATA_BLACKLIST_%s" % task, True) or "").split() + + diff = dict_diff(originaldata, newdata) + diff_clean = [key for key in diff \ + if not key in blacklist and \ + not key.startswith("__originaldata_")] + + if diff_clean: + emit("Variables changed by %s:" % task) + for key in diff_clean: + (old, new) = diff[key] + emit(" %s:" % key) + emit(" '%s' -> '%s'" % (old, new)) + +python __task_metadata_track_eh () { + from bb.build import TaskStarted, TaskSucceeded + + if isinstance(e, TaskStarted): + if e.data is None: + from bb import fatal + fatal("e.data is none for %s" % e) + task_metadata_track_start(e.task, e.data) + elif isinstance(e, TaskSucceeded): + task_metadata_track_stop(e.task, e.data) +} +addhandler __task_metadata_track_eh + +addtask py_listtasks +do_py_listtasks[nostamp] = "1" +do_py_listtasks[recrdeptask] = "do_py_listtasks" +python do_py_listtasks() { + import sys + for e in d.keys(): + if d.getVarFlag(e, "task") and \ + d.getVarFlag(e, "python"): + sys.stdout.write("%s\n" % e) +} diff --git a/classes/vala.bbclass b/classes/vala.bbclass index bcd906aeb9..125820c00c 100644 --- a/classes/vala.bbclass +++ b/classes/vala.bbclass @@ -1,3 +1,14 @@ DEPENDS += "vala-native" -FILES_${PN}-dev += "${datadir}/vala/vapi/*.vapi" +FILES_${PN}-dev += "\ + ${datadir}/vala/vapi/*.vapi \ + ${datadir}/vala/vapi/*.deps \ +" + +# .vapi and .deps files are arch independent and need to be present in the +# staging datadir for the native vala compiler +do_stage_append() { + install -d ${STAGING_DATADIR_NATIVE}/vala/vapi + find . -name "*.vapi" -exec install -m 0644 {} ${STAGING_DATADIR_NATIVE}/vala/vapi/ \; + find . -name "*.deps" -exec install -m 0644 {} ${STAGING_DATADIR_NATIVE}/vala/vapi/ \; +} |
