summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openembedded.org>2007-04-05 18:20:42 +0000
committerMarcin Juszkiewicz <hrw@openembedded.org>2007-04-05 18:20:42 +0000
commit328eff19a08bd399c6a833d213862039b4432b05 (patch)
treee20fa9422b90a51da620e168dba7f32764bba5c9
downloadoetest-328eff19a08bd399c6a833d213862039b4432b05.tar.gz
oetest-328eff19a08bd399c6a833d213862039b4432b05.tar.bz2
oetest-328eff19a08bd399c6a833d213862039b4432b05.zip
import of bitbake-qa bittest util which can be used as:
- source availability checker - source mirror populate tool - and few others branch is named 'oetest' because this tool will be renamed to 'oetest' as it is useful only with OE metadata
-rw-r--r--.mtn2git_empty0
-rw-r--r--bin/.mtn2git_empty0
-rwxr-xr-xbin/bittest126
-rwxr-xr-xbin/bittest_single138
-rw-r--r--classes/.mtn2git_empty0
-rwxr-xr-xclasses/base.bbclass768
-rw-r--r--conf/.mtn2git_empty0
-rw-r--r--conf/bitbake.conf414
-rw-r--r--conf/local.conf0
-rw-r--r--conf/testrun.conf.sample9
-rw-r--r--doc/.mtn2git_empty0
-rw-r--r--doc/ADD_YOUR_CHECK7
-rw-r--r--doc/README24
-rw-r--r--lib/.mtn2git_empty0
-rw-r--r--lib/bittest/.mtn2git_empty0
-rw-r--r--lib/bittest/__init__.py176
-rw-r--r--lib/bittest/config.py79
-rw-r--r--lib/bittest/fileparser.py62
-rw-r--r--lib/bittest/testreport_html.py120
-rw-r--r--lib/bittest/testreport_text.py56
-rw-r--r--lib/bittest/testreport_tinder.py328
-rw-r--r--lib/bittest/testresult.py120
-rw-r--r--modules/.mtn2git_empty0
-rw-r--r--modules/content_checker/.mtn2git_empty0
-rw-r--r--modules/content_checker/__init__.py40
-rw-r--r--modules/content_checker/content_checker.py238
-rw-r--r--modules/depends_checker/.mtn2git_empty0
-rw-r--r--modules/depends_checker/__init__.py41
-rw-r--r--modules/depends_checker/depends.py94
-rw-r--r--modules/doc_checker/.mtn2git_empty0
-rw-r--r--modules/doc_checker/__init__.py40
-rw-r--r--modules/doc_checker/doc_checker.py74
-rw-r--r--modules/example/.mtn2git_empty0
-rw-r--r--modules/example/__init__.py41
-rw-r--r--modules/example/example.py59
-rw-r--r--modules/patch_checker/.mtn2git_empty0
-rw-r--r--modules/patch_checker/__init__.py42
-rw-r--r--modules/patch_checker/patch_checker.py77
-rw-r--r--modules/source_checker/.mtn2git_empty0
-rw-r--r--modules/source_checker/__init__.py40
-rw-r--r--modules/source_checker/source_checker.py80
41 files changed, 3293 insertions, 0 deletions
diff --git a/.mtn2git_empty b/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.mtn2git_empty
diff --git a/bin/.mtn2git_empty b/bin/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bin/.mtn2git_empty
diff --git a/bin/bittest b/bin/bittest
new file mode 100755
index 0000000..5db993e
--- /dev/null
+++ b/bin/bittest
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005, 2006 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import sys, os, optparse
+
+# append the lib subdir and modules subdir to the system python path
+sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
+sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'modules'))
+
+
+try:
+ import bb
+ import bb.data
+ import bb.parse
+ from bb import cooker
+except:
+ print "Use PYTHONPATH to point to bitbake/lib"
+ sys.exit(-1)
+
+
+from bittest import *
+
+class BBConfiguration( object ):
+ """
+ Manages build options and configurations for one run
+ """
+ def __init__( self, options ):
+ for key, val in options.__dict__.items():
+ setattr( self, key, val )
+
+def start_testing():
+ """
+ Start with testing:
+ We will parse the options to decide which tests should be executed.
+ Then we will parse the base configuration (bitbake.conf) and afterwards
+ our unit testing configuration.
+ We will go through every bbfile, parse it and for each setup we will call
+ the testing method
+ """
+
+ options, args = handle_options( sys.argv )
+
+ tests = []
+ if len(args) == 0:
+ tests = __all_tests__
+ else:
+ for mode in args:
+ if not mode in __all_tests__ and not mode == "example":
+ bb.note("Test %s does not exist" % mode)
+ else:
+ tests.append(mode)
+
+ if len(tests) == 0:
+ bb.note("No tests to run exiting")
+ sys.exit(0)
+
+ bb.note("Running the following tests: %s" % tests )
+
+ # Parse the default config
+ configuration = BBConfiguration(options)
+ configuration.pkgs_to_build = []
+ configuration.data = bb.data.init()
+ configuration.verbose = False
+ configuration.debug = False
+ configuration.debug_domains = []
+ configuration.file = []
+ configuration.cmd = "fetch"
+
+ bb.msg.set_debug_level(0)
+ cook = bb.cooker.BBCooker(configuration)
+ cook.configuration = configuration
+ cook.parseConfigurationFile( os.path.join( "conf", "bitbake.conf" ) )
+ data = _load_config('bitbake.conf')
+ if data == None:
+ bb.error("Could not parse the bitbake.conf")
+ elif bb.data.getVar('BITBAKETEST_BITBAKE_CONF', data ) == None:
+ bb.error("You are not using the bitbake.conf from bittest please check your BBPATH")
+
+ bb.data.inheritFromOS(data)
+
+ # Parse the test configuration
+ test_config = _load_config('testrun.conf')
+ if test_config == None:
+ bb.error("Could not parse the bittest configuration file")
+ test_options = parse_test_options(test_config)
+
+ # start running the test
+ results = run_tests(data, test_config, test_options, tests, options)
+ generate_results(results, options)
+
+
+
+if __name__ == "__main__":
+ start_testing()
diff --git a/bin/bittest_single b/bin/bittest_single
new file mode 100755
index 0000000..d7182cc
--- /dev/null
+++ b/bin/bittest_single
@@ -0,0 +1,138 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005, 2006 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import sys, os, optparse
+
+# append the lib subdir and modules subdir to the system python path
+sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
+sys.path.append(os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'modules'))
+
+
+def which(path, item):
+ """Useful function for locating a file in a PATH"""
+ found = None
+ for p in (path or "").split(':'):
+ if os.path.exists(os.path.join(p, item)):
+ found = os.path.join(p, item)
+ break
+ return found
+
+
+# Code to try hard to find the BitBake libraries
+try:
+ import bb
+ import bb.data
+ import bb.parse
+except:
+ print "Trying hard to find the BitBake libraries"
+ path = which(os.environ['PATH'], "bitbake")
+ if not path:
+ print "ERROR can't find bitbake in the $PATH. Either place bitbake/bin there or point PYTHONPATH to bitbake/lib."
+ sys.exit(-1)
+
+ sys.path.append(os.path.join(os.path.dirname(os.path.dirname(path)), 'lib'))
+ import bb
+ import bb.data
+ import bb.parse
+
+
+from bittest import *
+
+
+# Start it up now
+if __name__ == "__main__":
+ """
+ In contrast to bittest we will try to update the BBPATH, load local conf to
+ get the TARGET_ARCH, TARGET_OS, DISTRO and MACHINE from the configuration file
+ """
+
+ options, args = handle_options( sys.argv )
+ tests = []
+ if len(args) == 0:
+ tests = __all_tests__
+ else:
+ for mode in args:
+ if not mode in __all_tests__ and not mode == "example":
+ bb.note("Test %s does not exist" % mode)
+ else:
+ tests.append(mode)
+
+ if len(tests) == 0:
+ bb.note("No tests to run exiting")
+ sys.exit(0)
+
+ bb.note("Running the following tests: %s" % tests )
+
+ # Parse the test configuration - use local.conf here the one in the old BBPATH
+ test_config = _load_config('local.conf')
+ if test_config == None:
+ bb.error("Could not parse the local.conf configuration file")
+
+ # extract information from the current setup
+ arch = bb.data.getVar('TARGET_ARCH', test_config, True)
+ tos = bb.data.getVar('TARGET_OS' , test_config, True)
+ distro = bb.data.getVar('DISTRO' , test_config, True)
+ machine= bb.data.getVar('MACHINE' , test_config, True)
+ test_options = [(arch,os,distro,[machine])]
+
+ # Check for issues
+ if None in [arch,tos,distro,machine]:
+ bb.error("Error in your configuration. TARGET_ARCH=%(arch)s, TARGET_OS=%(tos)s, DISTRO=%(distro)s, MACHINE=%(machine)s" % locals() )
+ sys.exit(-3)
+ else:
+ bb.note("Your configuration: TARGET_ARCH=%(arch)s, TARGET_OS=%(tos)s, DISTRO=%(distro)s, MACHINE=%(machine)s" % locals() )
+
+
+
+ # Update the BBPATH now
+ new_path = os.path.dirname(os.path.dirname(sys.argv[0]))+":"+os.environ['BBPATH']
+ os.environ['BBPATH'] = new_path
+
+ # Now start with the real deal
+ # Parse the default config
+ data = _load_config('bitbake.conf')
+ if data == None:
+ bb.error("Could not parse the bitbake.conf")
+ elif bb.data.getVar('BITBAKETEST_BITBAKE_CONF', data ) == None:
+ bb.error("You are not using the bitbake.conf from bittest please check your BBPATH")
+
+ bb.data.inheritFromOS(data)
+
+
+ # start running the test
+ results = run_tests(data, test_config, test_options, tests, options)
+ generate_results(results, options)
+
+
diff --git a/classes/.mtn2git_empty b/classes/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/classes/.mtn2git_empty
diff --git a/classes/base.bbclass b/classes/base.bbclass
new file mode 100755
index 0000000..619c50b
--- /dev/null
+++ b/classes/base.bbclass
@@ -0,0 +1,768 @@
+PATCHES_DIR="${S}"
+
+def base_dep_prepend(d):
+ import bb;
+ #
+ # Ideally this will check a flag so we will operate properly in
+ # the case where host == build == target, for now we don't work in
+ # that case though.
+ #
+ deps = ""
+
+ # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not
+ # we need that built is the responsibility of the patch function / class, not
+ # the application.
+ patchdeps = bb.data.getVar("PATCH_DEPENDS", d, 1)
+ if patchdeps and not patchdeps in bb.data.getVar("PROVIDES", d, 1):
+ deps = patchdeps
+
+ if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d):
+ if (bb.data.getVar('HOST_SYS', d, 1) !=
+ bb.data.getVar('BUILD_SYS', d, 1)):
+ deps += " virtual/${TARGET_PREFIX}gcc virtual/libc "
+ return deps
+
+def base_read_file(filename):
+ import bb
+ try:
+ f = file( filename, "r" )
+ except IOError, reason:
+ return "" # WARNING: can't raise an error now because of the new RDEPENDS handling. This is a bit ugly. :M:
+ else:
+ return f.read().strip()
+ return None
+
+def base_conditional(variable, checkvalue, truevalue, falsevalue, d):
+ import bb
+ if bb.data.getVar(variable,d,1) == checkvalue:
+ return truevalue
+ else:
+ return falsevalue
+
+DEPENDS_prepend="${@base_dep_prepend(d)} "
+
+def base_set_filespath(path, d):
+ import os, bb
+ filespath = []
+ for p in path:
+ overrides = bb.data.getVar("OVERRIDES", d, 1) or ""
+ overrides = overrides + ":"
+ for o in overrides.split(":"):
+ filespath.append(os.path.join(p, o))
+ bb.data.setVar("FILESPATH", ":".join(filespath), d)
+
+FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}"
+
+def oe_filter(f, str, d):
+ from re import match
+ return " ".join(filter(lambda x: match(f, x, 0), str.split()))
+
+def oe_filter_out(f, str, d):
+ from re import match
+ return " ".join(filter(lambda x: not match(f, x, 0), str.split()))
+
+die() {
+ oefatal "$*"
+}
+
+oenote() {
+ echo "NOTE:" "$*"
+}
+
+oewarn() {
+ echo "WARNING:" "$*"
+}
+
+oefatal() {
+ echo "FATAL:" "$*"
+ exit 1
+}
+
+oedebug() {
+ test $# -ge 2 || {
+ echo "Usage: oedebug level \"message\""
+ exit 1
+ }
+
+ test ${OEDEBUG:-0} -ge $1 && {
+ shift
+ echo "DEBUG:" $*
+ }
+}
+
+oe_runmake() {
+ if [ x"$MAKE" = x ]; then MAKE=make; fi
+ oenote ${MAKE} ${EXTRA_OEMAKE} "$@"
+ ${MAKE} ${EXTRA_OEMAKE} "$@" || die "oe_runmake failed"
+}
+
+oe_soinstall() {
+ # Purpose: Install shared library file and
+ # create the necessary links
+ # Example:
+ #
+ # oe_
+ #
+ #oenote installing shared library $1 to $2
+ #
+ libname=`basename $1`
+ install -m 755 $1 $2/$libname
+ sonamelink=`${HOST_PREFIX}readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
+ solink=`echo $libname | sed -e 's/\.so\..*/.so/'`
+ ln -sf $libname $2/$sonamelink
+ ln -sf $libname $2/$solink
+}
+
+oe_libinstall() {
+ # Purpose: Install a library, in all its forms
+ # Example
+ #
+ # oe_libinstall libltdl ${STAGING_LIBDIR}/
+ # oe_libinstall -C src/libblah libblah ${D}/${libdir}/
+ dir=""
+ libtool=""
+ silent=""
+ require_static=""
+ require_shared=""
+ staging_install=""
+ while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -C)
+ shift
+ dir="$1"
+ ;;
+ -s)
+ silent=1
+ ;;
+ -a)
+ require_static=1
+ ;;
+ -so)
+ require_shared=1
+ ;;
+ -*)
+ oefatal "oe_libinstall: unknown option: $1"
+ ;;
+ *)
+ break;
+ ;;
+ esac
+ shift
+ done
+
+ libname="$1"
+ shift
+ destpath="$1"
+ if [ -z "$destpath" ]; then
+ oefatal "oe_libinstall: no destination path specified"
+ fi
+ if echo "$destpath/" | egrep '^${STAGING_LIBDIR}/' >/dev/null
+ then
+ staging_install=1
+ fi
+
+ __runcmd () {
+ if [ -z "$silent" ]; then
+ echo >&2 "oe_libinstall: $*"
+ fi
+ $*
+ }
+
+ if [ -z "$dir" ]; then
+ dir=`pwd`
+ fi
+ dotlai=$libname.lai
+ dir=$dir`(cd $dir; find -name "$dotlai") | sed "s/^\.//;s/\/$dotlai\$//;q"`
+ olddir=`pwd`
+ __runcmd cd $dir
+
+ lafile=$libname.la
+ if [ -f "$lafile" ]; then
+ # libtool archive
+ eval `cat $lafile|grep "^library_names="`
+ libtool=1
+ else
+ library_names="$libname.so* $libname.dll.a"
+ fi
+
+ __runcmd install -d $destpath/
+ dota=$libname.a
+ if [ -f "$dota" -o -n "$require_static" ]; then
+ __runcmd install -m 0644 $dota $destpath/
+ fi
+ if [ -f "$dotlai" -a -n "$libtool" ]; then
+ if test -n "$staging_install"
+ then
+ # stop libtool using the final directory name for libraries
+ # in staging:
+ __runcmd rm -f $destpath/$libname.la
+ __runcmd sed -e 's/^installed=yes$/installed=no/' -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' $dotlai >$destpath/$libname.la
+ else
+ __runcmd install -m 0644 $dotlai $destpath/$libname.la
+ fi
+ fi
+
+ for name in $library_names; do
+ files=`eval echo $name`
+ for f in $files; do
+ if [ ! -e "$f" ]; then
+ if [ -n "$libtool" ]; then
+ oefatal "oe_libinstall: $dir/$f not found."
+ fi
+ elif [ -L "$f" ]; then
+ __runcmd cp -P "$f" $destpath/
+ elif [ ! -L "$f" ]; then
+ libfile="$f"
+ __runcmd install -m 0755 $libfile $destpath/
+ fi
+ done
+ done
+
+ if [ -z "$libfile" ]; then
+ if [ -n "$require_shared" ]; then
+ oefatal "oe_libinstall: unable to locate shared library"
+ fi
+ elif [ -z "$libtool" ]; then
+ # special case hack for non-libtool .so.#.#.# links
+ baselibfile=`basename "$libfile"`
+ if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
+ sonamelink=`${HOST_PREFIX}readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
+ solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
+ if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
+ __runcmd ln -sf $baselibfile $destpath/$sonamelink
+ fi
+ __runcmd ln -sf $baselibfile $destpath/$solink
+ fi
+ fi
+
+ __runcmd cd "$olddir"
+}
+
+oe_machinstall() {
+ # Purpose: Install machine dependent files, if available
+ # If not available, check if there is a default
+ # If no default, just touch the destination
+ # Example:
+ # $1 $2 $3 $4
+ # oe_machinstall -m 0644 fstab ${D}/etc/fstab
+ #
+ # TODO: Check argument number?
+ #
+ filename=`basename $3`
+ dirname=`dirname $3`
+
+ for o in `echo ${OVERRIDES} | tr ':' ' '`; do
+ if [ -e $dirname/$o/$filename ]; then
+ oenote $dirname/$o/$filename present, installing to $4
+ install $1 $2 $dirname/$o/$filename $4
+ return
+ fi
+ done
+# oenote overrides specific file NOT present, trying default=$3...
+ if [ -e $3 ]; then
+ oenote $3 present, installing to $4
+ install $1 $2 $3 $4
+ else
+ oenote $3 NOT present, touching empty $4
+ touch $4
+ fi
+}
+
+addtask showdata
+do_showdata[nostamp] = "1"
+python do_showdata() {
+ import sys
+ # emit variables and shell functions
+ bb.data.emit_env(sys.__stdout__, d, True)
+ # emit the metadata which isnt valid shell
+ for e in d.keys():
+ if bb.data.getVarFlag(e, 'python', d):
+ sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1)))
+}
+
+addtask listtasks
+do_listtasks[nostamp] = "1"
+python do_listtasks() {
+ import sys
+ # emit variables and shell functions
+ #bb.data.emit_env(sys.__stdout__, d)
+ # emit the metadata which isnt valid shell
+ for e in d.keys():
+ if bb.data.getVarFlag(e, 'task', d):
+ sys.__stdout__.write("%s\n" % e)
+}
+
+addtask clean
+do_clean[dirs] = "${TOPDIR}"
+do_clean[nostamp] = "1"
+do_clean[bbdepcmd] = ""
+python base_do_clean() {
+ """clear the build and temp directories"""
+ dir = bb.data.expand("${WORKDIR}", d)
+ if dir == '//': raise bb.build.FuncFailed("wrong DATADIR")
+ bb.note("removing " + dir)
+ os.system('rm -rf ' + dir)
+
+ dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d)
+ bb.note("removing " + dir)
+ os.system('rm -f '+ dir)
+}
+
+addtask mrproper
+do_mrproper[dirs] = "${TOPDIR}"
+do_mrproper[nostamp] = "1"
+do_mrproper[bbdepcmd] = ""
+python base_do_mrproper() {
+ """clear downloaded sources, build and temp directories"""
+ dir = bb.data.expand("${DL_DIR}", d)
+ if dir == '/': bb.build.FuncFailed("wrong DATADIR")
+ bb.debug(2, "removing " + dir)
+ os.system('rm -rf ' + dir)
+ bb.build.exec_task('do_clean', d)
+}
+
+addtask fetch
+do_fetch[dirs] = "${DL_DIR}"
+do_fetch[nostamp] = "1"
+python base_do_fetch() {
+ import sys
+
+ localdata = bb.data.createCopy(d)
+ bb.data.update_data(localdata)
+
+ src_uri = bb.data.getVar('SRC_URI', localdata, 1)
+ if not src_uri:
+ return 1
+
+ try:
+ bb.fetch.init(src_uri.split(),d)
+ except bb.fetch.NoMethodError:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("No method: %s" % value)
+
+ try:
+ bb.fetch.go(localdata)
+ except bb.fetch.MissingParameterError:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("Missing parameters: %s" % value)
+ except bb.fetch.FetchError:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("Fetch failed: %s" % value)
+}
+
+def oe_unpack_file(file, data, url = None):
+ import bb, os
+ if not url:
+ url = "file://%s" % file
+ dots = file.split(".")
+ if dots[-1] in ['gz', 'bz2', 'Z']:
+ efile = os.path.join(bb.data.getVar('WORKDIR', data, 1),os.path.basename('.'.join(dots[0:-1])))
+ else:
+ efile = file
+ cmd = None
+ if file.endswith('.tar'):
+ cmd = 'tar x --no-same-owner -f %s' % file
+ elif file.endswith('.tgz') or file.endswith('.tar.gz'):
+ cmd = 'tar xz --no-same-owner -f %s' % file
+ elif file.endswith('.tbz') or file.endswith('.tar.bz2'):
+ cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file
+ elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'):
+ cmd = 'gzip -dc %s > %s' % (file, efile)
+ elif file.endswith('.bz2'):
+ cmd = 'bzip2 -dc %s > %s' % (file, efile)
+ elif file.endswith('.zip'):
+ cmd = 'unzip -q'
+ (type, host, path, user, pswd, parm) = bb.decodeurl(url)
+ if 'dos' in parm:
+ cmd = '%s -a' % cmd
+ cmd = '%s %s' % (cmd, file)
+ elif os.path.isdir(file):
+ filesdir = os.path.realpath(bb.data.getVar("FILESDIR", data, 1))
+ destdir = "."
+ if file[0:len(filesdir)] == filesdir:
+ destdir = file[len(filesdir):file.rfind('/')]
+ destdir = destdir.strip('/')
+ if len(destdir) < 1:
+ destdir = "."
+ elif not os.access("%s/%s" % (os.getcwd(), destdir), os.F_OK):
+ os.makedirs("%s/%s" % (os.getcwd(), destdir))
+ cmd = 'cp -pPR %s %s/%s/' % (file, os.getcwd(), destdir)
+ else:
+ (type, host, path, user, pswd, parm) = bb.decodeurl(url)
+ if not 'patch' in parm:
+ # The "destdir" handling was specifically done for FILESPATH
+ # items. So, only do so for file:// entries.
+ if type == "file":
+ destdir = bb.decodeurl(url)[1] or "."
+ else:
+ destdir = "."
+ bb.mkdirhier("%s/%s" % (os.getcwd(), destdir))
+ cmd = 'cp %s %s/%s/' % (file, os.getcwd(), destdir)
+
+ if not cmd:
+ return True
+
+ dest = os.path.join(os.getcwd(), os.path.basename(file))
+ if os.path.exists(dest):
+ if os.path.samefile(file, dest):
+ return True
+
+ cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd)
+ bb.note("Unpacking %s to %s/" % (file, os.getcwd()))
+ ret = os.system(cmd)
+ return ret == 0
+
+addtask unpack after do_fetch
+do_unpack[dirs] = "${WORKDIR}"
+python base_do_unpack() {
+ import re, os
+
+ localdata = bb.data.createCopy(d)
+ bb.data.update_data(localdata)
+
+ src_uri = bb.data.getVar('SRC_URI', localdata)
+ if not src_uri:
+ return
+ src_uri = bb.data.expand(src_uri, localdata)
+ for url in src_uri.split():
+ try:
+ local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
+ except bb.MalformedUrl, e:
+ raise FuncFailed('Unable to generate local path for malformed uri: %s' % e)
+ # dont need any parameters for extraction, strip them off
+ local = re.sub(';.*$', '', local)
+ local = os.path.realpath(local)
+ ret = oe_unpack_file(local, localdata, url)
+ if not ret:
+ raise bb.build.FuncFailed()
+}
+
+addtask patch after do_unpack
+do_patch[dirs] = "${WORKDIR}"
+python base_do_patch() {
+ import re
+ import bb.fetch
+
+ src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split()
+ if not src_uri:
+ return
+
+ patchcleancmd = bb.data.getVar('PATCHCLEANCMD', d, 1)
+ if patchcleancmd:
+ bb.data.setVar("do_patchcleancmd", patchcleancmd, d)
+ bb.data.setVarFlag("do_patchcleancmd", "func", 1, d)
+ bb.build.exec_func("do_patchcleancmd", d)
+
+ workdir = bb.data.getVar('WORKDIR', d, 1)
+ for url in src_uri:
+
+ (type, host, path, user, pswd, parm) = bb.decodeurl(url)
+ if not "patch" in parm:
+ continue
+
+ bb.fetch.init([url],d)
+ url = bb.encodeurl((type, host, path, user, pswd, []))
+ local = os.path.join('/', bb.fetch.localpath(url, d))
+
+ # did it need to be unpacked?
+ dots = os.path.basename(local).split(".")
+ if dots[-1] in ['gz', 'bz2', 'Z']:
+ unpacked = os.path.join(bb.data.getVar('WORKDIR', d),'.'.join(dots[0:-1]))
+ else:
+ unpacked = local
+ unpacked = bb.data.expand(unpacked, d)
+
+ if "pnum" in parm:
+ pnum = parm["pnum"]
+ else:
+ pnum = "1"
+
+ if "pname" in parm:
+ pname = parm["pname"]
+ else:
+ pname = os.path.basename(unpacked)
+
+ if "mindate" in parm:
+ mindate = parm["mindate"]
+ else:
+ mindate = 0
+
+ if "maxdate" in parm:
+ maxdate = parm["maxdate"]
+ else:
+ maxdate = "20711226"
+
+ pn = bb.data.getVar('PN', d, 1)
+ srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
+
+ if not srcdate:
+ srcdate = bb.data.getVar('SRCDATE', d, 1)
+
+ if srcdate == "now":
+ srcdate = bb.data.getVar('DATE', d, 1)
+
+ if (maxdate < srcdate) or (mindate > srcdate):
+ if (maxdate < srcdate):
+ bb.note("Patch '%s' is outdated" % pname)
+
+ if (mindate > srcdate):
+ bb.note("Patch '%s' is predated" % pname)
+
+ continue
+
+ bb.note("Applying patch '%s'" % pname)
+ bb.data.setVar("do_patchcmd", bb.data.getVar("PATCHCMD", d, 1) % (pnum, pname, unpacked), d)
+ bb.data.setVarFlag("do_patchcmd", "func", 1, d)
+ bb.data.setVarFlag("do_patchcmd", "dirs", "${WORKDIR} ${S}", d)
+ bb.build.exec_func("do_patchcmd", d)
+}
+
+
+addhandler base_eventhandler
+python base_eventhandler() {
+ from bb import note, error, data
+ from bb.event import Handled, NotHandled, getName
+ import os
+
+ messages = {}
+ messages["Completed"] = "completed"
+ messages["Succeeded"] = "completed"
+ messages["Started"] = "started"
+ messages["Failed"] = "failed"
+
+ name = getName(e)
+ msg = ""
+ if name.startswith("Pkg"):
+ msg += "package %s: " % data.getVar("P", e.data, 1)
+ msg += messages.get(name[3:]) or name[3:]
+ elif name.startswith("Task"):
+ msg += "package %s: task %s: " % (data.getVar("PF", e.data, 1), e.task)
+ msg += messages.get(name[4:]) or name[4:]
+ elif name.startswith("Build"):
+ msg += "build %s: " % e.name
+ msg += messages.get(name[5:]) or name[5:]
+ elif name == "UnsatisfiedDep":
+ msg += "package %s: dependency %s %s" % (e.pkg, e.dep, name[:-3].lower())
+ note(msg)
+
+ if name.startswith("BuildStarted"):
+ bb.data.setVar( 'BB_VERSION', bb.__version__, e.data )
+ path_to_bbfiles = bb.data.getVar( 'BBFILES', e.data, 1 )
+ path_to_packages = path_to_bbfiles[:path_to_bbfiles.rindex( "packages" )]
+ monotone_revision = "<unknown>"
+ try:
+ monotone_revision = file( "%s/_MTN/revision" % path_to_packages ).read().strip()
+ except IOError:
+ pass
+ bb.data.setVar( 'OE_REVISION', monotone_revision, e.data )
+ statusvars = ['BB_VERSION', 'OE_REVISION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TARGET_FPU']
+ statuslines = ["%-14s = \"%s\"" % (i, bb.data.getVar(i, e.data, 1) or '') for i in statusvars]
+ statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines)
+ print statusmsg
+
+ needed_vars = [ "TARGET_ARCH", "TARGET_OS" ]
+ pesteruser = []
+ for v in needed_vars:
+ val = bb.data.getVar(v, e.data, 1)
+ if not val or val == 'INVALID':
+ pesteruser.append(v)
+ if pesteruser:
+ bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
+
+ if not data in e.__dict__:
+ return NotHandled
+
+ log = data.getVar("EVENTLOG", e.data, 1)
+ if log:
+ logfile = file(log, "a")
+ logfile.write("%s\n" % msg)
+ logfile.close()
+
+ return NotHandled
+}
+
+addtask configure after do_unpack do_patch
+do_configure[dirs] = "${S} ${B}"
+do_configure[bbdepcmd] = "do_populate_staging"
+base_do_configure() {
+ :
+}
+
+addtask compile after do_configure
+do_compile[dirs] = "${S} ${B}"
+do_compile[bbdepcmd] = "do_populate_staging"
+base_do_compile() {
+ if [ -e Makefile -o -e makefile ]; then
+ oe_runmake || die "make failed"
+ else
+ oenote "nothing to compile"
+ fi
+}
+
+
+addtask stage after do_compile
+base_do_stage () {
+ :
+}
+
+do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${TARGET_SYS}/lib \
+ ${STAGING_DIR}/${TARGET_SYS}/include \
+ ${STAGING_DIR}/${BUILD_SYS}/bin ${STAGING_DIR}/${BUILD_SYS}/lib \
+ ${STAGING_DIR}/${BUILD_SYS}/include \
+ ${STAGING_DATADIR} \
+ ${S} ${B}"
+
+addtask populate_staging after do_compile
+
+python do_populate_staging () {
+ bb.build.exec_func('do_stage', d)
+}
+
+addtask install after do_compile
+do_install[dirs] = "${S} ${B}"
+
+base_do_install() {
+ :
+}
+
+base_do_package() {
+ :
+}
+
+addtask build after do_populate_staging
+do_build = ""
+do_build[func] = "1"
+
+# Functions that update metadata based on files outputted
+# during the build process.
+
+SHLIBS = ""
+RDEPENDS_prepend = " ${SHLIBS}"
+
+def explode_deps(s):
+ r = []
+ l = s.split()
+ flag = False
+ for i in l:
+ if i[0] == '(':
+ flag = True
+ j = []
+ if flag:
+ j.append(i)
+ if i.endswith(')'):
+ flag = False
+ r[-1] += ' ' + ' '.join(j)
+ else:
+ r.append(i)
+ return r
+
+python read_shlibdeps () {
+ packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
+ for pkg in packages:
+ rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "")
+ shlibsfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d)
+ if os.access(shlibsfile, os.R_OK):
+ fd = file(shlibsfile)
+ lines = fd.readlines()
+ fd.close()
+ for l in lines:
+ rdepends.append(l.rstrip())
+ pcfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d)
+ if os.access(pcfile, os.R_OK):
+ fd = file(pcfile)
+ lines = fd.readlines()
+ fd.close()
+ for l in lines:
+ rdepends.append(l.rstrip())
+ bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
+}
+
+python read_subpackage_metadata () {
+ import re
+
+ def decode(str):
+ import codecs
+ c = codecs.getdecoder("string_escape")
+ return c(str)[0]
+
+ data_file = bb.data.expand("${WORKDIR}/install/${PN}.package", d)
+ if os.access(data_file, os.R_OK):
+ f = file(data_file, 'r')
+ lines = f.readlines()
+ f.close()
+ r = re.compile("([^:]+):\s*(.*)")
+ for l in lines:
+ m = r.match(l)
+ if m:
+ bb.data.setVar(m.group(1), decode(m.group(2)), d)
+}
+
+python __anonymous () {
+ import exceptions
+ need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
+ if need_host:
+ import re
+ this_host = bb.data.getVar('HOST_SYS', d, 1)
+ if not re.match(need_host, this_host):
+ raise bb.parse.SkipPackage("incompatible with host %s" % this_host)
+
+ need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1)
+ if need_machine:
+ import re
+ this_machine = bb.data.getVar('MACHINE', d, 1)
+ if this_machine and not re.match(need_machine, this_machine):
+ raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine)
+
+ pn = bb.data.getVar('PN', d, 1)
+
+ srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
+ if srcdate != None:
+ bb.data.setVar('SRCDATE', srcdate, d)
+
+ use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
+ if use_nls != None:
+ bb.data.setVar('USE_NLS', use_nls, d)
+}
+
+python () {
+ import bb, os
+ 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
+ return
+ if (bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) == '0'):
+ return
+ paths = []
+ for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]:
+ paths.append(bb.data.expand(os.path.join(p, mach_arch), d))
+ for s in bb.data.getVar('SRC_URI', d, 1).split():
+ 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', mach_arch, d)
+ return
+}
+
+EXPORT_FUNCTIONS do_clean do_mrproper do_fetch do_unpack do_configure do_compile do_install do_package do_patch do_populate_pkgs do_stage
+
+MIRRORS[func] = "0"
+MIRRORS () {
+${DEBIAN_MIRROR}/main http://snapshot.debian.net/archive/pool
+${DEBIAN_MIRROR} ftp://ftp.de.debian.org/debian/pool
+${GNU_MIRROR} ftp://mirrors.kernel.org/gnu
+ftp://ftp.kernel.org/pub http://www.kernel.org/pub
+ftp://ftp.kernel.org/pub ftp://ftp.us.kernel.org/pub
+ftp://ftp.gnupg.org/gcrypt/ ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/
+ftp://ftp.gnupg.org/gcrypt/ ftp://ftp.surfnet.nl/pub/security/gnupg/
+ftp://dante.ctan.org/tex-archive ftp://ftp.fu-berlin.de/tex/CTAN
+ftp://ftp.gnutls.org/pub/gnutls ftp://ftp.gnutls.org/pub/gnutls/
+ftp://ftp.gnutls.org/pub/gnutls http://josefsson.org/gnutls/releases/
+
+
+
+ftp://.*/.*/ http://www.oesources.org/source/current/
+http://.*/.*/ http://www.oesources.org/source/current/
+}
+
diff --git a/conf/.mtn2git_empty b/conf/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/conf/.mtn2git_empty
diff --git a/conf/bitbake.conf b/conf/bitbake.conf
new file mode 100644
index 0000000..d4b56a8
--- /dev/null
+++ b/conf/bitbake.conf
@@ -0,0 +1,414 @@
+##################################################################
+# Standard target filesystem paths.
+##################################################################
+
+# Path prefixes
+export base_prefix = ""
+export prefix = "/usr"
+export exec_prefix = "${prefix}"
+
+# Base paths
+export base_bindir = "${base_prefix}/bin"
+export base_sbindir = "${base_prefix}/sbin"
+export base_libdir = "${base_prefix}/lib"
+
+# Architecture independent paths
+export datadir = "${prefix}/share"
+export sysconfdir = "/etc"
+export sharedstatedir = "${prefix}/com"
+export localstatedir = "/var"
+export infodir = "${datadir}/info"
+export mandir = "${datadir}/man"
+export docdir = "${datadir}/doc"
+export servicedir = "/srv"
+
+# Architecture dependent paths
+export bindir = "${exec_prefix}/bin"
+export sbindir = "${exec_prefix}/sbin"
+export libexecdir = "${exec_prefix}/libexec"
+export libdir = "${exec_prefix}/lib"
+export includedir = "${exec_prefix}/include"
+export oldincludedir = "${exec_prefix}/include"
+
+##################################################################
+# Architecture-dependent build variables.
+##################################################################
+
+BUILD_ARCH = "${@os.uname()[4]}"
+BUILD_OS = "${@os.uname()[0].lower()}"
+BUILD_VENDOR = ""
+BUILD_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
+BUILD_PREFIX = ""
+BUILD_CC_ARCH = ""
+
+HOST_ARCH = "${TARGET_ARCH}"
+HOST_OS = "${TARGET_OS}"
+HOST_VENDOR = "${TARGET_VENDOR}"
+HOST_SYS = "${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}"
+HOST_PREFIX = "${TARGET_PREFIX}"
+HOST_CC_ARCH = "${TARGET_CC_ARCH}"
+
+TARGET_ARCH = "INVALID"
+TARGET_OS = "INVALID"
+TARGET_VENDOR = "${BUILD_VENDOR}"
+TARGET_SYS = "${TARGET_ARCH}${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d, 1) == ('' or 'custom')]}"
+TARGET_PREFIX = "${TARGET_SYS}-"
+TARGET_CC_ARCH = ""
+
+PACKAGE_ARCH = "${HOST_ARCH}"
+MACHINE_ARCH = "${@[bb.data.getVar('HOST_ARCH', d, 1), bb.data.getVar('MACHINE', d, 1)][bool(bb.data.getVar('MACHINE', d, 1))]}"
+IPKG_ARCHS = "all any noarch ${TARGET_ARCH} ${IPKG_EXTRA_ARCHS} ${MACHINE}"
+
+##################################################################
+# Date/time variables.
+##################################################################
+
+DATE := "${@time.strftime('%Y%m%d',time.gmtime())}"
+TIME := "${@time.strftime('%H%M%S',time.gmtime())}"
+DATETIME = "${DATE}${TIME}"
+
+##################################################################
+# Package default variables.
+##################################################################
+
+PN = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[0] or 'defaultpkgname'}"
+PV = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[1] or '1.0'}"
+PR = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[2] or 'r0'}"
+PF = "${PN}-${PV}-${PR}"
+P = "${PN}-${PV}"
+
+# Package info.
+
+SECTION = "base"
+PRIORITY = "optional"
+DESCRIPTION = "Version ${PV}-${PR} of package ${PN}"
+LICENSE = "unknown"
+MAINTAINER = "OpenEmbedded Team <openembedded-devel@lists.openembedded.org>"
+HOMEPAGE = "unknown"
+
+# Package dependencies and provides.
+
+DEPENDS = ""
+RDEPENDS = ""
+PROVIDES = ""
+PROVIDES_prepend = "${P} ${PF} ${PN} "
+RPROVIDES = ""
+
+PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-dev ${PN}-locale"
+FILES = ""
+FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
+ ${sysconfdir} ${sharedstatedir} ${localstatedir} \
+ /bin/* /sbin/* /lib/*.so* ${datadir}/${PN} ${libdir}/${PN} \
+ ${datadir}/pixmaps ${datadir}/applications \
+ ${datadir}/idl ${datadir}/omf ${datadir}/sounds \
+ ${libdir}/bonobo/servers"
+SECTION_${PN}-doc = "doc"
+FILES_${PN}-doc = "${docdir} ${mandir} ${infodir} ${datadir}/gtk-doc \
+ ${datadir}/gnome/help"
+SECTION_${PN}-dev = "devel"
+FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la \
+ ${libdir}/*.a ${libdir}/*.o ${libdir}/pkgconfig \
+ /lib/*.a /lib/*.o ${datadir}/aclocal"
+FILES_${PN}-locale = "${datadir}/locale"
+FILES_${PN}-dbg = "${bindir}/.debug ${sbindir}/.debug ${libexecdir}/.debug ${libdir}/.debug \
+ /bin/.debug /sbin/.debug /lib/.debug ${libdir}/${PN}/.debug"
+
+# File manifest
+
+export MANIFEST = "${FILESDIR}/manifest"
+
+FILE_DIRNAME = "${@os.path.dirname(bb.data.getVar('FILE', d))}"
+FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"
+FILESDIR = "${@bb.which(bb.data.getVar('FILESPATH', d, 1), '.')}"
+
+##################################################################
+# General work and output directories for the build system.
+##################################################################
+
+TMPDIR = "${TOPDIR}/tmp"
+CACHE = "${TMPDIR}/cache"
+DL_DIR = "${TMPDIR}/downloads"
+CVSDIR = "${DL_DIR}/cvs"
+SVNDIR = "${DL_DIR}/svn"
+GITDIR = "${DL_DIR}/git"
+
+STAMP = "${TMPDIR}/stamps/${PF}"
+WORKDIR = "${TMPDIR}/work/${PF}"
+T = "${WORKDIR}/temp"
+D = "${WORKDIR}/image"
+S = "${WORKDIR}/${P}"
+B = "${S}"
+
+STAGING_DIR = "${TMPDIR}/staging"
+STAGING_BINDIR = "${STAGING_DIR}/${BUILD_SYS}/bin"
+STAGING_LIBDIR = "${STAGING_DIR}/${HOST_SYS}/lib"
+STAGING_INCDIR = "${STAGING_DIR}/${HOST_SYS}/include"
+STAGING_DATADIR = "${STAGING_DIR}/${HOST_SYS}/share"
+STAGING_LOADER_DIR = "${STAGING_DIR}/${HOST_SYS}/loader"
+STAGING_PYDIR = "${STAGING_DIR}/lib/python2.4"
+
+DEPLOY_DIR = "${TMPDIR}/deploy"
+DEPLOY_DIR_TAR = "${DEPLOY_DIR}/tar"
+DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk"
+DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm"
+
+##################################################################
+# Kernel info.
+##################################################################
+
+OLDEST_KERNEL = "2.4.0"
+STAGING_KERNEL_DIR = "${STAGING_DIR}/${HOST_SYS}/kernel"
+
+##################################################################
+# Specific image creation and rootfs population info.
+##################################################################
+
+DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images"
+IMAGE_ROOTFS = "${TMPDIR}/rootfs"
+IMAGE_BASENAME = "rootfs"
+IMAGE_NAME = "${IMAGE_BASENAME}-${MACHINE}-${DATETIME}"
+IMAGE_CMD = ""
+IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime \
+ --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \
+ ${EXTRA_IMAGECMD}"
+IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}"
+IMAGE_CMD_ext2 = "genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}"
+IMAGE_CMD_ext2.gz = "mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz; genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}; gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2; mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2.gz; rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz"
+IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${EXTRA_IMAGECMD} -noappend"
+IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ."
+IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS} && tar -zcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ."
+IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ."
+EXTRA_IMAGECMD = ""
+EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --eraseblock=0x40000"
+EXTRA_IMAGECMD_squashfs = "-le -b 16384"
+IMAGE_ROOTFS_SIZE_ext2 = "65536"
+IMAGE_ROOTFS_SIZE_ext2.gz = "65536"
+
+IMAGE_DEPENDS = ""
+IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
+IMAGE_DEPENDS_cramfs = "cramfs-native"
+IMAGE_DEPENDS_ext2 = "genext2fs-native"
+IMAGE_DEPENDS_ext2.gz = "genext2fs-native"
+IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
+EXTRA_IMAGEDEPENDS = ""
+
+##################################################################
+# Toolchain info.
+##################################################################
+
+CROSS_DIR = "${TMPDIR}/cross"
+CROSS_DATADIR = "${CROSS_DIR}/share"
+export PATH_prepend = "${STAGING_BINDIR}/${HOST_SYS}:${STAGING_BINDIR}:${CROSS_DIR}/bin:"
+
+##################################################################
+# Build utility info.
+##################################################################
+
+CCACHE = "${@bb.which(bb.data.getVar('PATH', d), 'ccache') and 'ccache '}"
+
+export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
+export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}"
+export F77 = "${CCACHE}${HOST_PREFIX}g77 ${HOST_CC_ARCH}"
+export CPP = "${HOST_PREFIX}gcc -E"
+export LD = "${HOST_PREFIX}ld"
+export CCLD = "${CC}"
+export AR = "${HOST_PREFIX}ar"
+export AS = "${HOST_PREFIX}as"
+export RANLIB = "${HOST_PREFIX}ranlib"
+export STRIP = "${HOST_PREFIX}strip"
+export OBJCOPY = "${HOST_PREFIX}objcopy"
+
+export BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc ${BUILD_CC_ARCH}"
+export BUILD_CXX = "${CCACHE}${BUILD_PREFIX}g++ ${BUILD_CC_ARCH}"
+export BUILD_F77 = "${CCACHE}${BUILD_PREFIX}g77 ${BUILD_CC_ARCH}"
+export BUILD_CPP = "${BUILD_PREFIX}cpp"
+export BUILD_LD = "${BUILD_PREFIX}ld"
+export BUILD_CCLD = "${BUILD_PREFIX}gcc"
+export BUILD_AR = "${BUILD_PREFIX}ar"
+export BUILD_RANLIB = "${BUILD_PREFIX}ranlib"
+export BUILD_STRIP = "${BUILD_PREFIX}strip"
+
+export MAKE = "make"
+EXTRA_OEMAKE = "-e MAKEFLAGS="
+
+##################################################################
+# Patch handling.
+##################################################################
+PATCHTOOL = 'quilt'
+PATCHRESOLVE = 'user'
+
+##################################################################
+# Build flags and options.
+##################################################################
+
+export BUILD_CPPFLAGS = "-isystem${STAGING_DIR}/${BUILD_SYS}/include"
+export CPPFLAGS = "${TARGET_CPPFLAGS}"
+export TARGET_CPPFLAGS = "-isystem${STAGING_DIR}/${TARGET_SYS}/include"
+
+export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
+export CFLAGS = "${TARGET_CFLAGS}"
+export TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
+
+export BUILD_CXXFLAGS = "${BUILD_CFLAGS} -fpermissive"
+export CXXFLAGS = "${TARGET_CXXFLAGS}"
+export TARGET_CXXFLAGS = "${TARGET_CFLAGS} -fpermissive"
+
+export BUILD_LDFLAGS = "-L${STAGING_DIR}/${BUILD_SYS}/lib \
+ -Wl,-rpath-link,${STAGING_DIR}/${BUILD_SYS}/lib \
+ -Wl,-rpath,${STAGING_DIR}/${BUILD_SYS}/lib -Wl,-O1"
+export LDFLAGS = "${TARGET_LDFLAGS}"
+export TARGET_LDFLAGS = "-L${STAGING_DIR}/${TARGET_SYS}/lib \
+ -Wl,-rpath-link,${STAGING_DIR}/${TARGET_SYS}/lib \
+ -Wl,-O1"
+
+# Which flags to leave by strip-flags() in bin/build/oebuild.sh ?
+ALLOWED_FLAGS = "-O -mcpu -march -pipe"
+
+# Pass parallel make options to the compile task only
+EXTRA_OEMAKE_prepend_task_do_compile = "${PARALLEL_MAKE} "
+
+##################################################################
+# Optimization flags.
+##################################################################
+
+FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O2"
+DEBUG_OPTIMIZATION = "-O -g"
+SELECTED_OPTIMIZATION = "${@bb.data.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][bb.data.getVar('DEBUG_BUILD', d, 1) == '1'], d, 1)}"
+BUILD_OPTIMIZATION = "-O2"
+
+##################################################################
+# Bootstrap stuff.
+##################################################################
+
+BOOTSTRAP_EXTRA_RDEPENDS = ""
+BOOTSTRAP_EXTRA_RRECOMMENDS = ""
+
+##################################################################
+# Palmtop stuff.
+##################################################################
+
+export QTDIR = "${STAGING_DIR}/${HOST_SYS}/qt2"
+export QPEDIR = "${STAGING_DIR}/${HOST_SYS}"
+export OPIEDIR = "${STAGING_DIR}/${HOST_SYS}"
+export palmtopdir = "/opt/QtPalmtop"
+export palmqtdir = "/opt/QtPalmtop"
+
+##################################################################
+# Download locations and utilities.
+##################################################################
+
+GNU_MIRROR = "ftp://ftp.gnu.org/gnu"
+DEBIAN_MIRROR = "ftp://ftp.debian.org/debian/pool"
+SOURCEFORGE_MIRROR = "http://heanet.dl.sourceforge.net/sourceforge"
+GPE_MIRROR = "http://handhelds.org/pub/projects/gpe/source"
+XLIBS_MIRROR = "http://xlibs.freedesktop.org/release"
+XORG_MIRROR = "http://xorg.freedesktop.org/releases"
+GNOME_MIRROR = "http://ftp.gnome.org/pub/GNOME/sources"
+FREEBSD_MIRROR = "ftp://ftp.freebsd.org/pub/FreeBSD/"
+HANDHELDS_CVS = "cvs://anoncvs:anoncvs@anoncvs.handhelds.org/cvs"
+E_CVS = "cvs://anonymous@anoncvs.enlightenment.org/var/cvs/e"
+E_URI = "http://enlightenment.freedesktop.org/files"
+FREEDESKTOP_CVS = "cvs://anoncvs:anoncvs@anoncvs.freedesktop.org/cvs"
+GENTOO_MIRROR = "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles"
+APACHE_MIRROR = "http://www.apache.org/dist"
+
+# You can use the mirror of your country to get faster downloads by putting
+# export DEBIAN_MIRROR = "ftp://ftp.de.debian.org/debian/pool"
+# export SOURCEFORGE_MIRROR = "http://belnet.dl.sourceforge.net/sourceforge"
+# into your local.conf
+
+FETCHCOMMAND = "ERROR, this must be a BitBake bug"
+FETCHCOMMAND_wget = "/usr/bin/env wget --timeout=30 -t 3 --passive-ftp -P ${DL_DIR} ${URI}"
+FETCHCOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} co ${CVSCOOPTS} ${CVSMODULE}"
+FETCHCOMMAND_svn = "/usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT} ${SVNMODULE}"
+RESUMECOMMAND = "ERROR, this must be a BitBake bug"
+RESUMECOMMAND_wget = "/usr/bin/env wget -c --timeout=30 -t 3 --passive-ftp -P ${DL_DIR} ${URI}"
+UPDATECOMMAND = "ERROR, this must be a BitBake bug"
+UPDATECOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} update -d -P ${CVSCOOPTS}"
+UPDATECOMMAND_svn = "/usr/bin/env svn update ${SVNCOOPTS}"
+SRCDATE = "${DATE}"
+
+SRC_URI = "file://${FILE}"
+
+##################################################################
+# Miscellaneous utilities.
+##################################################################
+
+MKTEMPDIRCMD = "mktemp -d -q ${TMPBASE}"
+MKTEMPCMD = "mktemp -q ${TMPBASE}"
+
+# GNU patch tries to be intellgent about checking out read-only files from
+# a RCS, which freaks out those special folks with active Perforce clients
+# the following makes patch ignore RCS:
+
+export PATCH_GET=0
+
+# Program to be used to build ipkg packages
+
+IPKGBUILDCMD = "ipkg-build -o 0 -g 0"
+
+##################################################################
+# Not sure about the rest of this yet.
+##################################################################
+
+# slot - currently unused by OE. portage remnants
+SLOT = "0"
+
+# Other
+
+export PKG_CONFIG_PATH = "${STAGING_DATADIR}/pkgconfig"
+export PKG_CONFIG_DISABLE_UNINSTALLED = "yes"
+
+export QMAKE_MKSPEC_PATH = "${STAGING_DIR}/${BUILD_SYS}/share/qmake"
+export STAGING_SIPDIR = "${STAGING_DIR}/${BUILD_SYS}/share/sip"
+export STAGING_IDLDIR = "${STAGING_DATADIR}/idl"
+
+# default test results for autoconf
+# possible candidate for moving into autotools.oeclass -CL
+export CONFIG_SITE = "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'site/%s-%s' % (bb.data.getVar('HOST_ARCH', d, 1), bb.data.getVar('HOST_OS', d, 1)))}"
+
+# library package naming
+AUTO_LIBNAME_PKGS = "${PACKAGES}"
+
+###
+### Config file processing
+###
+
+# This means that an envionment variable named '<foo>_arm' overrides an
+# environment variable '<foo>' (when ${TARGET_ARCH} is arm). And the same: an
+# environment variable '<foo>_ramses' overrides both '<foo>' and '<foo>_arm
+# when ${MACHINE} is 'ramses'. And finally '<foo>_local' overrides anything.
+#
+# This works for functions as well, they are really just environment variables.
+#OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}"
+# Alternative OVERRIDES to make compilation fail fast, we will enable it by default soon
+OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}:fail-fast:pn-${PN}"
+
+##################################################################
+# Include the rest of the config files.
+##################################################################
+
+include conf/site.conf
+include conf/auto.conf
+include conf/local.conf
+include conf/build/${BUILD_SYS}.conf
+include conf/target/${TARGET_SYS}.conf
+include conf/machine/${MACHINE}.conf
+include conf/distro/${DISTRO}.conf
+include conf/documentation.conf
+
+
+##################################################################
+# Weak variables (usually to retain backwards compatibility)
+##################################################################
+
+IMAGE_FSTYPES ?= "jffs2"
+PCMCIA_MANAGER ?= "pcmcia-cs"
+MACHINE_TASK_PROVIDER ?= "task-bootstrap"
+
+
+
+##################################################################
+# Magic Cookie for SANITY CHECK
+##################################################################
+BITBAKETEST_BITBAKE_CONF = "1"
diff --git a/conf/local.conf b/conf/local.conf
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/conf/local.conf
diff --git a/conf/testrun.conf.sample b/conf/testrun.conf.sample
new file mode 100644
index 0000000..9f95fa3
--- /dev/null
+++ b/conf/testrun.conf.sample
@@ -0,0 +1,9 @@
+# Point to the OpenEmbedded packages
+BBFILES := "${HOME}/org.openembedded.dev/packages/*/*.bb"
+
+# Configurations to run tests for
+# Each configurations consists out of a three tuple
+# (TARGET_ARCH,TARGET_OS,DISTRO,[MACHINE1.MACHINE2])
+TEST_CONFIGS = "(arm,linux,angstrom-2007.1,[h3600.h3900]) (arm,linux,openzaurus-unstable,[collie.c7x0])"
+
+
diff --git a/doc/.mtn2git_empty b/doc/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/doc/.mtn2git_empty
diff --git a/doc/ADD_YOUR_CHECK b/doc/ADD_YOUR_CHECK
new file mode 100644
index 0000000..d2408dd
--- /dev/null
+++ b/doc/ADD_YOUR_CHECK
@@ -0,0 +1,7 @@
+To create your own check
+ - Copy the example directory which is inside modules
+ - Give your module a name
+ - Add the name of your directory to __all_tests__ in
+ lib/bittest/__init__.py
+
+Now have fun to write a clever test!
diff --git a/doc/README b/doc/README
new file mode 100644
index 0000000..642628e
--- /dev/null
+++ b/doc/README
@@ -0,0 +1,24 @@
+Bitbake QA will hold Quality Assurance Resources:
+ The primary user will be OpenEmbedded but it is useful
+for any other user bitbake as well.
+
+layout of the bitbake_qa module:
+conf/
+ It contains example configurations used to run tests
+with specified parameters (for overrides)
+
+doc/
+ This directory
+
+modules/module_name/
+ QA modules doing the actual tests
+
+
+I hope to offer the following tests soon:
+
+source_checker - It will check if the sources can still be fetched
+ and generates reports
+patch_checker - It will check if the patches still applies
+doc_checker - It will check if all variables have a documentation
+content_checker - It will check for common misusage in variables
+depends_checker - Check if native packages RDEPEND on non-native packages
diff --git a/lib/.mtn2git_empty b/lib/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/.mtn2git_empty
diff --git a/lib/bittest/.mtn2git_empty b/lib/bittest/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/bittest/.mtn2git_empty
diff --git a/lib/bittest/__init__.py b/lib/bittest/__init__.py
new file mode 100644
index 0000000..7980d7b
--- /dev/null
+++ b/lib/bittest/__init__.py
@@ -0,0 +1,176 @@
+from testresult import TestItem, TestResult
+from testreport_text import TestReportText
+from testreport_html import TestReportHTML
+from testreport_tinder import TestReportTinder
+from config import parse_test_options
+
+import sys, os, optparse
+import bb
+import bb.data
+import bb.parse
+
+
+__all__ = [
+ "TestResult",
+ "TestItem",
+ "TestReportText",
+ "TestReportHTML",
+ "TestReportTinder",
+
+# fileparser.py
+ "fileparser",
+# config.py
+ "parse_test_options",
+
+# in this file
+ "__version__",
+ "__all_tests__",
+ "__all_reports__",
+ "handle_options",
+ "_load_config",
+ "_get_instances",
+ "generate_results",
+ "run_tests"
+
+]
+
+
+__version__ = 0.2
+
+# Add your test here
+__all_tests__ = ["patch_checker",
+ "source_checker",
+ "doc_checker",
+ "content_checker",
+ "depends_checker" ]
+
+# known reporting classes
+__all_reports__ = {
+ "TestReportText" : TestReportText,
+ "TestReportHTML" : TestReportHTML,
+ "TestReportTinder" : TestReportTinder
+}
+
+
+
+def handle_options( args ):
+ """
+ Handle the options and return the handled options and the rest (not parsed)
+ """
+ parser = optparse.OptionParser( version = "BitTest Bitbake Testing Tool version %s" % __version__,
+ usage = """%prog [options] [test ...]
+Executes the specified tests or if none are given all tests. The result is printed
+on the cmd line
+""" )
+
+ parser.add_option( "-o", "--output", help = "print the output to the file",
+ action = "store", dest = "output", default = sys.stdout )
+ parser.add_option( "-r", "--report", help = "print the report in the specified format",
+ action = "store", dest = "report", default = "TestReportText" )
+
+ options, args = parser.parse_args( args )
+
+ if not options.report in __all_reports__:
+ print "The specified report format is not available. Falling back to TestReportText"
+ options.report = "TestReportText"
+
+ if not type(options.output) == type(sys.stdout):
+ """ Create a file """
+ options.output = file(options.output, "w")
+
+ return options, args[1:]
+
+
+def _load_config(file):
+ """
+ load a config file into a bb.data instance
+ """
+ try:
+ return bb.parse.handle(os.path.join('conf', file), bb.data.init() )
+ except IOError, e:
+ return None
+
+
+def _get_instances(tests):
+ test_inst = {}
+
+ # create instances
+ for test in tests:
+ test_inst[test] = __import__(test).create_test()
+
+ return test_inst
+
+
+def generate_results(test_results, options):
+ for result in test_results:
+ res = test_results[result]
+ res.test_reporter().init(res)
+ res.test_reporter().print_result()
+
+
+def run_tests(data,test_config,test_options, tests, options):
+ """
+ Run tests using 'data' as base
+ """
+
+ bbfiles = fileparser.find_files(bb.data.getVar('BBFILES', test_config).split(' '))
+ bb.note("Collected %d BitBake files" % len(bbfiles) )
+
+ tmp_dir = os.path.join(os.getcwd(),'tmp')
+ src_dir = os.path.join(os.getcwd(),'tmp_sources')
+ bb.mkdirhier(tmp_dir)
+ bb.mkdirhier(src_dir)
+
+ # now run the tests for each test
+ test_results = {}
+ test_instances = _get_instances(tests)
+
+ # Create the TestResult container and initialize the Report
+ for test in test_instances:
+ test_results[test] = TestResult(test_instances[test].test_name(), __all_reports__[options.report](test_config, test, options.output) )
+
+ for bbfile in bbfiles:
+
+ # now we do it for each configuration...
+ for (arch,os1,distro,machines) in test_options:
+ test_data = bb.data.createCopy(data)
+ bb.data.setVar('TARGET_ARCH', arch, test_data)
+ bb.data.setVar('TARGET_OS', os1, test_data)
+ bb.data.setVar('DISTRO', distro, test_data)
+
+ # include the distro
+ bb.parse.handle(os.path.join('conf/distro',distro+'.conf'),test_data,1)
+
+ # now for each machine and we can finally run the tests
+ for machine in machines:
+ machine_data = bb.data.createCopy(test_data)
+ bb.data.setVar('MACHINE', machine, machine_data)
+
+ try:
+ bb.parse.handle(os.path.join('conf/machine',machine+'.conf'),machine_data,1)
+ except:
+ bb.note("Machine %s is not known" % machine)
+
+ try:
+ bb_data = bb.parse.handle(bbfile, bb.data.createCopy(machine_data))
+ except bb.parse.SkipPackage:
+ bb.note("Skipping Package %s" % bbfile)
+ continue
+ except Exception, e:
+ bb.note("Error on parsing: %s:%s" % (bbfile, e))
+ continue
+
+ # run the testcases now
+ for test in test_instances:
+ test_run = bb.data.createCopy(bb_data)
+
+ # be sure these variables are set
+ bb.data.setVar('TMPDIR', tmp_dir, test_run)
+ bb.data.setVar('DL_DIR', src_dir, test_run)
+
+
+ bb.data.update_data(test_run)
+# print "Running test for %s with machine: %s and distro: %s" % (bb.data.getVar('PN', test_run, True), machine, distro)
+ test_results[test].insert_result(test_instances[test].test(bbfile, test_run))
+
+ return test_results
diff --git a/lib/bittest/config.py b/lib/bittest/config.py
new file mode 100644
index 0000000..ea1dfc3
--- /dev/null
+++ b/lib/bittest/config.py
@@ -0,0 +1,79 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Config Utility to parse bitttest/doctest related configuration resources
+"""
+
+__version__ = 0.2
+
+import bb
+
+def __build_array(string):
+ """
+ Build an array out of the string [abc.def]
+ """
+ ar = []
+ tmp = string.split('.')
+
+ for item in tmp:
+ ar.append( item.strip().strip('[').strip(']').strip() )
+
+ return ar
+
+def parse_test_options(cfg):
+ """
+ Parse the test options from the TEST_CONFIGS key normally found in the
+ testrun.conf
+ """
+
+ config = []
+ data = bb.data.getVar('TEST_CONFIGS', cfg)
+ data = data.split(' ')
+
+ for tuple in data:
+ # Lame ass splitting
+ g = tuple.split(',')
+ # Split the tuple by hand
+ a = g[0].strip().strip('(').strip()
+ b = g[1].strip()
+ c = g[2].strip()
+
+ # [a.b]
+ d = __build_array(g[3].strip(')').strip())
+
+ # now append
+ config.append( (a,b,c,d) )
+
+ return config
diff --git a/lib/bittest/fileparser.py b/lib/bittest/fileparser.py
new file mode 100644
index 0000000..576215e
--- /dev/null
+++ b/lib/bittest/fileparser.py
@@ -0,0 +1,62 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import os, glob
+
+__version__ = "0.0"
+
+def __find_files( path ):
+ """
+ BitBake does not offer a find_files implementation
+ so we copy and paste it here :(
+ """
+ findcmd = 'find ' + path + ' -name *.bb | grep -v SCCS/'
+ try:
+ finddata = os.popen(findcmd)
+ except OSError:
+ return []
+ return finddata.readlines()
+
+def find_files(files):
+ lst = []
+
+ for file in files:
+ if os.path.isdir(file):
+ d_files = __find_files(f)
+ if d_files:
+ lst += d_files
+ else:
+ lst += glob.glob(file) or [ file ]
+
+ return lst
diff --git a/lib/bittest/testreport_html.py b/lib/bittest/testreport_html.py
new file mode 100644
index 0000000..f9241ed
--- /dev/null
+++ b/lib/bittest/testreport_html.py
@@ -0,0 +1,120 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005, 2006 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+__version__ = "0.0"
+
+import os, sys
+
+class HTMLPage:
+ """
+ Small utility to create a HTML report page
+ """
+ def __init__(self):
+ self.header = ""
+ self.config = ""
+ self.summary = []
+ self.passed = []
+ self.failed = []
+
+ def open(self, title):
+ """
+ The header is taken from JHBuild
+ """
+ self.header = """<html>
+ <head>
+ <title>%(title)s</title>
+ <style type="text/css">
+ .section {
+ margin-after: 1.5em;
+ }
+ .success {
+ color: black;
+ background-color: #afa;
+ }
+ .failure {
+ color: black;
+ background-color: #faa;
+ }
+ </style>
+ </head>
+"""
+ pass
+
+ def add_head(self, config):
+ pass
+
+ def add_summary(self, count, passed, failed):
+ pass
+
+ def add_failed(self, failed):
+ pass
+
+ def add_passed(self, failed):
+ pass
+
+ def write(self, file):
+ pass
+
+class TestReportHTML:
+ """
+ Output the Test Result as a single HTML Page
+ """
+
+ def __init__(self, config, test_name, file):
+ self.test_config = test_name
+
+ def init(self, test_result):
+ self.test_result = test_result
+ self.failed = []
+ self.passed = []
+
+ def parse_tests(self):
+ """
+ Parse the tests into the categories Passed and Failed
+ """
+ for test in self.test_result:
+ if test.test_result:
+ self.passed.append( test )
+ else:
+ self.failed.append( test )
+
+ def print_result(self):
+ self.parse_tests()
+ page = HTMLPage()
+ page.open( "Bit Test Result" )
+ page.add_head( self.test_config )
+ page.add_summary( len(self.test_result), len(self.passed), len(self.failed) )
+ page.add_failed( self.failed )
+ page.add_passed( self.failed )
+ page.write( "result.html" )
diff --git a/lib/bittest/testreport_text.py b/lib/bittest/testreport_text.py
new file mode 100644
index 0000000..351a5a7
--- /dev/null
+++ b/lib/bittest/testreport_text.py
@@ -0,0 +1,56 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005, 2006 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+__version__ = "0.0"
+
+import os, sys
+
+class TestReportText:
+ """
+ Output the Test Result as Text
+ """
+
+ def __init__(self,config,test_name, file):
+ self.test_file = file
+ self.test_config = test_name
+
+ def init(self,test_result):
+ self.test_result = test_result
+
+ def print_result(self):
+ print >> self.test_file, "Test results for %s:" % self.test_config
+ print >> self.test_file, "\tNumber of ran tests: %d" % len(self.test_result)
+ for test in self.test_result:
+ if not test.test_result():
+ print >> self.test_file, "Tested file: %s" % (test.tested_file())
diff --git a/lib/bittest/testreport_tinder.py b/lib/bittest/testreport_tinder.py
new file mode 100644
index 0000000..74a4a89
--- /dev/null
+++ b/lib/bittest/testreport_tinder.py
@@ -0,0 +1,328 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005, 2006 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+__version__ = "0.0"
+
+import os, sys
+
+
+#
+#
+# Methods from the tinderclient.bbclass
+#
+#
+
+
+def tinder_http_post(server, selector, content_type, body):
+ import httplib
+ # now post it
+ for i in range(0,5):
+ try:
+ h = httplib.HTTP(server)
+ h.putrequest('POST', selector)
+ h.putheader('content-type', content_type)
+ h.putheader('content-length', str(len(body)))
+ h.endheaders()
+ h.send(body)
+ errcode, errmsg, headers = h.getreply()
+ #print errcode, errmsg, headers
+ return (errcode,errmsg, headers, h.file)
+ except:
+ print "Error sending the report!"
+ # try again
+ pass
+
+ # return some garbage
+ return (-1, "unknown", "unknown", None)
+
+def tinder_form_data(bound, dict, log):
+ output = []
+ # for each key in the dictionary
+ for name in dict:
+ output.append( "--" + bound )
+ output.append( 'Content-Disposition: form-data; name="%s"' % name )
+ output.append( "" )
+ print "Adding %s %s" % (name, dict[name])
+ output.append( dict[name] )
+
+ if log:
+ output.append( "--" + bound )
+ output.append( 'Content-Disposition: form-data; name="log"; filename="log.txt"' )
+ output.append( '' )
+ output.append( log )
+ output.append( '--' + bound + '--' )
+ output.append( '' )
+
+ return "\r\n".join(output)
+
+def tinder_format_http_post(d,status,log, test_name):
+ """
+ Format the Tinderbox HTTP post with the data needed
+ for the tinderbox to be happy.
+ """
+
+ from bb import data, build
+ import os,random
+
+ # the variables we will need to send on this form post
+ variables = {
+ "tree" : data.getVar('TINDER_TREE', d, True),
+ "machine_name" : "%s-%s" % (data.getVar('TINDER_MACHINE', d, True), test_name),
+ "os" : os.uname()[0],
+ "os_version" : os.uname()[2],
+ "compiler" : "gcc",
+ "clobber" : data.getVar('TINDER_CLOBBER', d, True)
+ }
+
+ # optionally add the status
+ if status:
+ variables["status"] = str(status)
+
+ # try to load the machine id
+ # we only need on build_status.pl but sending it
+ # always does not hurt
+ try:
+ f = file(data.getVar('TMPDIR',d,True)+'/tinder-machine.id', 'r')
+ id = f.read()
+ variables['machine_id'] = id
+ except:
+ pass
+
+ # the boundary we will need
+ boundary = "----------------------------------%d" % int(random.random()*1000000000000)
+
+ # now format the body
+ body = tinder_form_data( boundary, variables, log )
+
+ return ("multipart/form-data; boundary=%s" % boundary),body
+
+
+def tinder_build_start(d, test_name):
+ """
+ Inform the tinderbox that a build is starting. We do this
+ by posting our name and tree to the build_start.pl script
+ on the server.
+ """
+ from bb import data
+
+ # get the body and type
+ content_type, body = tinder_format_http_post(d,None,None, test_name)
+ server = data.getVar('TINDER_HOST', d, True )
+ url = data.getVar('TINDER_URL', d, True )
+
+ selector = url + "/xml/build_start.pl"
+
+ #print "selector %s and url %s" % (selector, url)
+
+ # now post it
+ errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
+ #print errcode, errmsg, headers
+ report = h_file.read()
+
+ # now let us find the machine id that was assigned to us
+ search = "<machine id='"
+ report = report[report.find(search)+len(search):]
+ report = report[0:report.find("'")]
+
+ import bb
+ bb.note("Machine ID assigned by tinderbox: %s" % report )
+
+ # now we will need to save the machine number
+ # we will override any previous numbers
+ bb.mkdirhier(data.getVar('TMPDIR', d, True))
+ f = file(data.getVar('TMPDIR', d, True)+"/tinder-machine.id", 'w')
+ f.write(report)
+
+def tinder_send_http(d, status, _log, test_name):
+ """
+ Send this log as build status
+ """
+ from bb import data
+
+
+ # get the body and type
+ server = data.getVar('TINDER_HOST', d, True )
+ url = data.getVar('TINDER_URL', d, True )
+
+ selector = url + "/xml/build_status.pl"
+
+ # now post it - in chunks of 10.000 charachters
+ new_log = _log
+ while len(new_log) > 0:
+ content_type, body = tinder_format_http_post(d,status,new_log[0:18000], test_name)
+ errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
+ #print errcode, errmsg, headers
+ #print h.file.read()
+ new_log = new_log[18000:]
+
+
+def tinder_print_info(d):
+ """
+ Print the TinderBox Info
+ Including informations of the BaseSystem and the Tree
+ we use.
+ """
+
+ from bb import data
+ import os
+ # get the local vars
+
+ time = ""
+ ops = os.uname()[0]
+ version = os.uname()[2]
+ url = data.getVar( 'TINDER_URL' , d, True )
+ tree = data.getVar( 'TINDER_TREE', d, True )
+ branch = data.getVar( 'TINDER_BRANCH', d, True )
+ srcdate = data.getVar( 'SRCDATE', d, True )
+ machine = data.getVar( 'MACHINE', d, True )
+ distro = data.getVar( 'DISTRO', d, True )
+ bbfiles = data.getVar( 'BBFILES', d, True )
+ tarch = data.getVar( 'TARGET_ARCH', d, True )
+ fpu = data.getVar( 'TARGET_FPU', d, True )
+ oerev = data.getVar( 'OE_REVISION', d, True ) or "unknown"
+
+ # there is a bug with tipple quoted strings
+ # i will work around but will fix the original
+ # bug as well
+ output = []
+ output.append("== Tinderbox Info" )
+ output.append("Time: %(time)s" )
+ output.append("OS: %(ops)s" )
+ output.append("%(version)s" )
+ output.append("Compiler: BitTest" )
+ output.append("Tinderbox Client: BitTest 0.1" )
+ output.append("Tinderbox Client Last Modified: yesterday" )
+ output.append("Tinderbox Protocol: 0.1" )
+ output.append("URL: %(url)s" )
+ output.append("Tree: %(tree)s" )
+ output.append("Config:" )
+ output.append("branch = '%(branch)s'" )
+ output.append("TARGET_ARCH = '%(tarch)s'" )
+ output.append("TARGET_FPU = '%(fpu)s'" )
+ output.append("SRCDATE = '%(srcdate)s'" )
+ output.append("MACHINE = '%(machine)s'" )
+ output.append("DISTRO = '%(distro)s'" )
+ output.append("BBFILES = '%(bbfiles)s'" )
+ output.append("OEREV = '%(oerev)s'" )
+ output.append("== End Tinderbox Client Info" )
+
+ # now create the real output
+ return "\n".join(output) % vars()
+
+def tinder_print_env():
+ """
+ Print the environment variables of this build
+ """
+ from bb import data
+ import os
+
+ time_start = ""
+ time_end = ""
+
+ # build the environment
+ env = ""
+ for var in os.environ:
+ env += "%s=%s\n" % (var, os.environ[var])
+
+ output = []
+ output.append( "---> TINDERBOX RUNNING env %(time_start)s" )
+ output.append( env )
+ output.append( "<--- TINDERBOX FINISHED (SUCCESS) %(time_end)s" )
+
+ return "\n".join(output) % vars()
+
+def tinder_tinder_start(d, test_name):
+ """
+ PRINT the configuration of this build
+ """
+
+ config = tinder_print_info(d)
+ #env = tinder_print_env()
+ time_start = ""
+ time_end = ""
+
+ output = []
+ output.append( "---> TINDERBOX PRINTING CONFIGURATION %(time_start)s" )
+ output.append( config )
+ #output.append( env )
+ output.append( "<--- TINDERBOX FINISHED PRINTING CONFIGURATION %(time_end)s" )
+ output.append( "---> TINDERBOX TESTING '%(test_name)s'" )
+ output.append( "<--- TINDERBOX STARTING TESTING NOW" )
+
+ output.append( "" )
+
+ return "\n".join(output) % vars()
+
+
+class TestReportTinder:
+ """
+ Output the Test Result to a TinderBox
+ """
+
+ def __init__(self,config, test_name, file):
+ self._config = config
+ self.test_config = test_name
+ self.test_file = file
+
+ # inform our box
+ tinder_build_start(config, test_name)
+ log = tinder_tinder_start(config,test_name)
+ tinder_send_http(config, 1, log, test_name)
+
+ def init(self, test_result):
+ self.test_result = test_result
+
+ def print_result(self):
+ """
+ Now format the test results
+ -Settle for 100 or 200 as status (sucess, failure)
+ -Create one big log message
+ """
+ status = 100
+
+ log = "---> Printing the test results now\n"
+ print >> self.test_file, "Test results for %s:\n" % self.test_config
+ print >> self.test_file, "\tNumber of ran tests: %d\n" % len(self.test_result)
+ log += "<--- Done preparing\n"
+
+ for test in self.test_result:
+ log += "---> Test for %s\n" % test.tested_file()
+ log += "Test comment: %s\n" % test.test_comment()
+ log += "<--- Test finished (%s)\n" % test.test_result()
+
+ if not test.test_result():
+ status = 200
+
+ # now send the log
+ tinder_send_http(self._config, status, log, self.test_config)
diff --git a/lib/bittest/testresult.py b/lib/bittest/testresult.py
new file mode 100644
index 0000000..2a1355c
--- /dev/null
+++ b/lib/bittest/testresult.py
@@ -0,0 +1,120 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005, 2006 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import types
+
+__version__ = "0.0"
+
+
+class TestItem:
+ """
+ A TestItem contains of the following:
+ (
+ tested_file [String],
+ test_result [True,False],
+ test_comment [String]
+ )
+ """
+ def __init__(self,tested_file,test_result,test_comment):
+ self._tested_file = tested_file
+ self._test_result = test_result
+ self._test_comment = test_comment
+
+ def tested_file(self):
+ return self._tested_file
+
+ def test_result(self):
+ return self._test_result
+
+ def test_comment(self):
+ return self._test_comment
+
+class TestResult:
+ """
+ This class holds the testresults
+ """
+
+ def __init__(self, name, report):
+ """
+ name is the test name
+ """
+ self._test_name = name
+ self._results = []
+ self._report = report
+
+ def test_name(self):
+ return self._test_name
+
+ def test_reporter(self):
+ return self._report
+
+ def insert_result(self, item):
+ """
+ Insert item into the list of results. We will not
+ enter item if item is None.
+ If item is of type list we will add every element in the
+ list to the list of test results
+ """
+ if item == None:
+ return
+
+ if type(item) == types.ListType:
+ self._results.extend(item)
+ else:
+ self._results.append(item)
+
+ def __iter__(self):
+ return self._results.__iter__()
+
+ def __getitem__(self,index):
+ return self._results[index]
+
+ def count(self):
+ return self._results.count()
+
+ def __len__(self):
+ return self._results.__len__()
+
+
+def _test():
+ """
+ Test the quite simple Test Data Types
+ """
+ import doctest
+
+
+if __name__ == "__main__":
+ _test()
+
+
diff --git a/modules/.mtn2git_empty b/modules/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/.mtn2git_empty
diff --git a/modules/content_checker/.mtn2git_empty b/modules/content_checker/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/content_checker/.mtn2git_empty
diff --git a/modules/content_checker/__init__.py b/modules/content_checker/__init__.py
new file mode 100644
index 0000000..4304075
--- /dev/null
+++ b/modules/content_checker/__init__.py
@@ -0,0 +1,40 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import content_checker
+
+__all__ = [ "create_test" ]
+
+def create_test():
+ return content_checker.TestCase()
diff --git a/modules/content_checker/content_checker.py b/modules/content_checker/content_checker.py
new file mode 100644
index 0000000..343e029
--- /dev/null
+++ b/modules/content_checker/content_checker.py
@@ -0,0 +1,238 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from bittest import TestItem
+from bb import data
+import types
+
+#
+# The tests are copied from the oelint.bbclass to this location
+#
+
+
+# quite simple without regexps
+bad_signs = {
+ 'SRC_URI' : '?', # SRC_URI should not contain URLs like http://foo.foo?file=foo.tar.gz
+ 'RDEPENDS': 'kernel-module-' # According to reenoo this is always wrong
+}
+
+# Test for the HOMEPAGE
+def homepage1():
+ return lambda fn,value : [None,TestItem(fn,False,"HOMEPAGE is not set %s" % value)] [value == 'unknown']
+
+def homepage2():
+ return lambda fn,value : [None,TestItem(fn,False,"HOMEPAGE doesn't start with http://")][not value.startswith("http://")]
+
+# Test for the MAINTAINER
+def maintainer1():
+ return lambda fn,value : [None,TestItem(fn,False, "explicit MAINTAINER is missing, using default"), None][value == "OpenEmbedded Team <oe@handhelds.org>"]
+
+def maintainer2():
+ return lambda fn, value : [None,TestItem(fn,False,"You forgot to put an e-mail address into MAINTAINER"),None] [value.find("@") == -1]
+
+
+# Check the licenses of the Files
+valid_licenses = {
+ "GPL-2" : "GPLv2",
+ "GPL LGPL FDL" : True,
+ "GPL PSF" : True,
+ "GPL/QPL" : "GPL QPL",
+ "GPL QPL" : True,
+ "GPL" : True,
+ "GPLv2" : True,
+ "GPLV2" : "GPLv2",
+ "IBM" : True,
+ "LGPL GPL" : True,
+ "LGPL" : True,
+ "MIT" : True,
+ "OSL" : True,
+ "Perl" : True,
+ "Public Domain" : True,
+ "QPL" : True,
+ "Vendor" : True,
+ "BSD" : True,
+ "tickypip-levels" : True,
+ "unknown" : False,
+}
+
+def license2():
+ return lambda fn, value : [None,TestItem(fn,False,"LICENSE '%s' is not known" % value),None][not valid_licenses.has_key(value)]
+
+def license3():
+ return lambda fn, value : [None,TestItem(fn,False,"LICENSE '%s' is not recommed, better use '%s'" % (value,valid_licenses[value])),None][valid_licenses[value] != True]
+def license1():
+ return lambda fn, value : [None,TestItem(fn,False,"LICENSE is not set %s" % value)][value == "unknown"]
+
+# Check the priorities here...
+valid_priorities = {
+ "standard" : True,
+ "required" : True,
+ "optional" : True,
+ "extra" : True,
+}
+
+
+def priority1():
+ return lambda fn, value : [None,TestItem(fn,False,"PRIORITY '%s' is not known" % value)][not valid_priorities.has_key(value)]
+
+def priority2():
+ return lambda fn, value : [None,TestItem(fn,False,"PRIORITY '%s' is not recommed" % value)][valid_priorities[value]==False]
+
+
+# Test the SECTION now
+valid_sections = {
+ # Current Section Correct section
+ "apps" : True,
+ "audio" : True,
+ "base" : True,
+ "console/games" : True,
+ "console/net" : "console/network",
+ "console/network" : True,
+ "console/utils" : True,
+ "devel" : True,
+ "developing" : "devel",
+ "devel/python" : True,
+ "fonts" : True,
+ "games" : True,
+ "games/libs" : True,
+ "gnome/base" : True,
+ "gnome/libs" : True,
+ "gpe" : True,
+ "gpe/libs" : True,
+ "gui" : False,
+ "libc" : "libs",
+ "libs" : True,
+ "libs/net" : True,
+ "multimedia" : True,
+ "net" : "network",
+ "NET" : "network",
+ "network" : True,
+ "opie/applets" : True,
+ "opie/applications" : True,
+ "opie/base" : True,
+ "opie/codecs" : True,
+ "opie/decorations" : True,
+ "opie/fontfactories" : True,
+ "opie/fonts" : True,
+ "opie/games" : True,
+ "opie/help" : True,
+ "opie/inputmethods" : True,
+ "opie/libs" : True,
+ "opie/multimedia" : True,
+ "opie/pim" : True,
+ "opie/setting" : "opie/settings",
+ "opie/settings" : True,
+ "opie/Shell" : False,
+ "opie/styles" : True,
+ "opie/today" : True,
+ "scientific" : True,
+ "utils" : True,
+ "x11" : True,
+ "x11/libs" : True,
+ "x11/wm" : True,
+}
+
+def section1():
+ return lambda fn,value : [None,TestItem(fn,False,"SECTION '%s' is not known" % value)][not valid_sections.has_key(value)]
+def section2():
+ return lambda fn,value : [None,TestItem(fn,False,"SECTION '%s' is not reccomed use '%s' instead" % (value,valid_sections[value]))][valid_sections[value]!=True]
+
+
+
+# these are checks we execute on each variable
+variable_checks = {
+ 'DESCRIPTION' : None, # we only want the presence check
+ 'HOMEPAGE' : [homepage1(),homepage2()],
+ 'LICENSE' : [license1(),license2(),license3()],
+ 'MAINTAINER' : [maintainer1(),maintainer2()],
+ 'SECTION' : [section1(),section2()],
+ 'PRIORITY' : [priority1(), priority2()],
+}
+
+class TestCase:
+ """
+ Check if keys contain weird expressions that are considered
+ error prone.
+ """
+
+ def __init__(self):
+ pass
+
+ def test(self, file_name, file_data):
+ """
+ Go through bad_signs and do reports
+ """
+ results = []
+
+ # apply the heuristics
+ for sign in bad_signs.keys():
+ try:
+ value = data.getVar(sign, file_data, True)
+ except:
+ try:
+ value = data.getVar(sign, file_data, False)
+ except:
+ pass
+
+ if not value == None:
+ if bad_signs[sign] in value:
+ results.append( TestItem(file_name,False,"BAD sign found for %s." % sign))
+
+ # apply the variable content check
+ for variable in variable_checks.keys():
+ value = data.getVar(variable, file_data, True)
+
+ # is this require variable present
+ if value == None:
+ result.append( TestItem(file_name,False, "Required variable '%(variable)s' not found." % vars()) )
+ else:
+ checks = variable_checks[variable]
+ # now check if we need to check a list of checks
+ if type(checks) == types.ListType:
+ for check in checks:
+ res = check(file_name, value)
+ # if one test failed we will stop here
+ if res:
+ results.append( res )
+ print "Stopping the check for variable %s" % variable
+ break
+ elif checks:
+ res = checks(file_name, value)
+ if res:
+ results.append( res )
+
+ return results
+
+ def test_name(self):
+ return "Content Checker Tool"
diff --git a/modules/depends_checker/.mtn2git_empty b/modules/depends_checker/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/depends_checker/.mtn2git_empty
diff --git a/modules/depends_checker/__init__.py b/modules/depends_checker/__init__.py
new file mode 100644
index 0000000..077e607
--- /dev/null
+++ b/modules/depends_checker/__init__.py
@@ -0,0 +1,41 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import depends
+
+__all__ = [
+ "create_test"
+]
+def create_test():
+ return depends.TestCase()
diff --git a/modules/depends_checker/depends.py b/modules/depends_checker/depends.py
new file mode 100644
index 0000000..07ce2a7
--- /dev/null
+++ b/modules/depends_checker/depends.py
@@ -0,0 +1,94 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2006 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from bittest import TestItem
+from bb import data
+from bb import utils
+
+class TestCase:
+ """
+ Check if native packages have non native RDEPENDS
+ """
+
+ def __init__(self):
+ pass
+
+ def test(self,file_name, file_data):
+ """
+ Check if the RDEPENDS or RRECOMMENDS of a native
+ package includes non native packages
+ """
+ if data.inherits_class("native", file_data):
+ def check_rdepends(key, base_var):
+ """
+ Check the RDEPENDS/RRECOMMENDS for the key
+ """
+
+ copy = data.createCopy(file_data)
+ cases = []
+ if "_${PN}" in key:
+ pn = data.getVar('PN', copy, True)
+ ov = data.getVar('OVERRIDES', copy, True)
+ data.setVar('OVERRIDES', '%s:%s' % (pn,ov), copy )
+ data.update_data(copy)
+ key = base_var
+
+ deps = data.getVar(key, copy, True).strip()
+ deps = utils.explode_deps(deps)
+
+ for dep in deps:
+ if len(dep.strip()) != 0 and not "-native" in dep:
+ cases.append( TestItem(file_name,False,"Native package is %s'ing on non native package '%s'" % (key,dep)) )
+ return cases
+
+ # check every key with RDEPENDS
+ # this finds more RDEPENDS :)
+ cases = []
+ for key in data.keys(file_data):
+ res = None
+ if key.startswith('RDEPENDS'):
+ res = check_rdepends(key, 'RDEPENDS')
+ elif key.startswith('RRECOMMENDS'):
+ res = check_rdepends(key, 'RRECOMMENDS')
+
+ # add the result
+ if res:
+ cases += res
+ return cases
+
+ def test_name(self):
+ """
+ Retutnr a name for the test
+ """
+ return "RDEPEND and RRECOMMENDS checker for native packages"
diff --git a/modules/doc_checker/.mtn2git_empty b/modules/doc_checker/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/doc_checker/.mtn2git_empty
diff --git a/modules/doc_checker/__init__.py b/modules/doc_checker/__init__.py
new file mode 100644
index 0000000..24cbe84
--- /dev/null
+++ b/modules/doc_checker/__init__.py
@@ -0,0 +1,40 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import doc_checker
+
+__all__ = [ "create_test" ]
+
+def create_test():
+ return doc_checker.TestCase()
diff --git a/modules/doc_checker/doc_checker.py b/modules/doc_checker/doc_checker.py
new file mode 100644
index 0000000..18650cd
--- /dev/null
+++ b/modules/doc_checker/doc_checker.py
@@ -0,0 +1,74 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from bittest import TestItem
+
+import bb
+
+
+# black list of KEYs that are not needed to have a documentation
+_black_list = []
+
+class TestCase:
+ """
+ Check if variables carry a documentation. For each concrete bbfile
+ (which includes bbclasses) we will check if all keys are named.
+ """
+
+ def __init__(self):
+ """
+ Construct the test case...
+ """
+ pass
+
+ def test(self, file_name, file_data):
+ """
+ Now we will run the tests
+ """
+
+ results = []
+
+ #
+ # The big plot. We will go through every key of file_data
+ # and check if there is a doc Flag
+ #
+ for key in bb.data.keys(file_data):
+ flag = bb.data.getVarFlag(key,"doc", file_data)
+ if flag == None:
+ results.append( TestItem(file_name,False,"Attribute named '%s' lacks documentation." % key))
+
+ return results
+
+ def test_name(self):
+ return "Documentation Checker Tool"
diff --git a/modules/example/.mtn2git_empty b/modules/example/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/example/.mtn2git_empty
diff --git a/modules/example/__init__.py b/modules/example/__init__.py
new file mode 100644
index 0000000..661b31f
--- /dev/null
+++ b/modules/example/__init__.py
@@ -0,0 +1,41 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import example
+
+__all__ = [
+ "create_test"
+]
+def create_test():
+ return example.TestCase()
diff --git a/modules/example/example.py b/modules/example/example.py
new file mode 100644
index 0000000..d91cba5
--- /dev/null
+++ b/modules/example/example.py
@@ -0,0 +1,59 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from bittest import TestItem
+
+class TestCase:
+ """
+ A simple test case
+ """
+
+ def __init__(self):
+ """
+ Construct and initialize the test case
+ """
+
+ def test(self,file_name, file_data):
+ """
+ Now run the test for file_name and the corresponding data.
+ You can use whatever you want
+ """
+
+ return TestItem(file_name,False,"The Test Failed")
+
+ def test_name(self):
+ """
+ Retutnr a name for the test
+ """
+ return "Example Test"
diff --git a/modules/patch_checker/.mtn2git_empty b/modules/patch_checker/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/patch_checker/.mtn2git_empty
diff --git a/modules/patch_checker/__init__.py b/modules/patch_checker/__init__.py
new file mode 100644
index 0000000..efa4665
--- /dev/null
+++ b/modules/patch_checker/__init__.py
@@ -0,0 +1,42 @@
+#ifndef SOURCE_CHECKER/SOURCE_CHECKER.PY
+#define SOURCE_CHECKER/SOURCE_CHECKER.PY
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import patch_checker
+
+__all__ = ["create_test"]
+
+def create_test():
+ return patch_checker.TestCase()
diff --git a/modules/patch_checker/patch_checker.py b/modules/patch_checker/patch_checker.py
new file mode 100644
index 0000000..e072f01
--- /dev/null
+++ b/modules/patch_checker/patch_checker.py
@@ -0,0 +1,77 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from bittest import TestItem
+import bb, sys
+
+
+class TestCase:
+ def __init__(self):
+ pass
+
+ def test_name(self):
+ return "Patch Checker"
+
+ def test(self,file, data):
+ """
+ Run the Test now... some duplication of the base.bbclass
+ """
+
+ error = None
+
+ try:
+ bb.build.exec_func('do_unpack', data)
+ bb.build.exec_func('do_patch', data)
+ except bb.build.FuncFailed:
+ error = """Function failed
+Distro: %s
+Machine: %s
+OS: %s
+ARCH: %s
+FPU: %s
+""" % (bb.data.getVar('DISTRO',data),bb.data.getVar('MACHINE',data),bb.data.getVar('TARGET_OS',data, True),bb.data.getVar('TARGET_ARCH',data, True),bb.data.getVar('TARGET_FPU',data, True))
+ except bb.build.EventException:
+ (type,value,traceback) = sys.exc_info()
+ e = value.event
+ error = """EventException %s
+Distro: %s
+Machine: %s
+OS: %s
+ARCH: %s
+FPU: %s
+""" % (bb.event.getName(e),bb.data.getVar('DISTRO',data),bb.data.getVar('MACHINE',data),bb.data.getVar('TARGET_OS',data, True),bb.data.getVar('TARGET_ARCH',data, True),bb.data.getVar('TARGET_FPU',data))
+
+ bb.build.exec_func('do_clean', data)
+
+ return TestItem(file,error == None, error)
diff --git a/modules/source_checker/.mtn2git_empty b/modules/source_checker/.mtn2git_empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/source_checker/.mtn2git_empty
diff --git a/modules/source_checker/__init__.py b/modules/source_checker/__init__.py
new file mode 100644
index 0000000..ef8c8b5
--- /dev/null
+++ b/modules/source_checker/__init__.py
@@ -0,0 +1,40 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import source_checker
+
+__all__ = [ "create_test" ]
+
+def create_test():
+ return source_checker.TestCase()
diff --git a/modules/source_checker/source_checker.py b/modules/source_checker/source_checker.py
new file mode 100644
index 0000000..5dfc7ce
--- /dev/null
+++ b/modules/source_checker/source_checker.py
@@ -0,0 +1,80 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+#
+# Copyright (C) 2005 Holger Hans Peter Freyther
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Neither the name Holger Hans Peter Freyther nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from bittest import TestItem
+import bb
+import os, sys
+
+class TestCase:
+ def __init__(self):
+ pass
+
+ def test_name(self):
+ return "Source Checker"
+
+ def generate_error(file, error):
+ (type,value,traceback) = sys.exc_info()
+ return TestItem(file,False,error % (value,type,traceback))
+ generate_error = staticmethod(generate_error)
+
+ def test(self,file, data):
+ # we run the tests
+
+ src_uri = bb.data.getVar('SRC_URI', data, 1)
+
+ if not src_uri:
+ return TestItem(file,True,"NO SRC_URI")
+
+ try:
+ bb.fetch.init(src_uri.split(), data)
+ except bb.fetch.NoMethodError:
+ return TestCase.generate_error(file,"""No Method Exception %s
+Type: %s
+Traceback: %s
+""")
+ try:
+ bb.fetch.go(data)
+ except bb.fetch.MissingParameterError:
+ return TestCase.generate_error(file,"""Missing Parameter Error %s
+Type: %s
+Traceback: %s
+""")
+ except bb.fetch.FetchError:
+ return TestCase.generate_error(file,"""Fetch Error %s
+Type: %s
+Traceback: %s
+""")
+
+ return TestItem(file,True,"")
+