diff options
author | Marcin Juszkiewicz <hrw@openembedded.org> | 2007-08-09 08:41:19 +0000 |
---|---|---|
committer | Marcin Juszkiewicz <hrw@openembedded.org> | 2007-08-09 08:41:19 +0000 |
commit | 9d829ed05c295df608b4fc108eb1c628fd06fd39 (patch) | |
tree | c1b27cfe4498f8abef1a61325922906f3e6a32ff /classes | |
parent | 1434b204e16e87b7f59f074f3036d5dcbcf0116f (diff) | |
parent | 6ccac10beeaaa02a86081bd6179fd57c208ad6b1 (diff) |
merge of '76e1e69496801009ea0aa69c84f76e858978ab99'
and 'db976a98427dd6a195e2cf167e225de2d0206aea'
Diffstat (limited to 'classes')
58 files changed, 1109 insertions, 310 deletions
diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass index 33546e0eb6..fccf2b6d80 100644 --- a/classes/autotools.bbclass +++ b/classes/autotools.bbclass @@ -15,6 +15,10 @@ def autotools_dep_prepend(d): if not pn in ['libtool', 'libtool-native', 'libtool-cross']: deps += 'libtool-native ' + if not bb.data.inherits_class('native', d) \ + and not bb.data.inherits_class('cross', d) \ + and not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1): + deps += 'libtool-cross ' return deps + 'gnu-config-native ' @@ -135,6 +139,13 @@ autotools_do_configure() { autotools_do_install() { oe_runmake 'DESTDIR=${D}' install + + for i in `find ${D} -name "*.la"` ; do \ + sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i + sed -i -e s:${D}::g $i + sed -i -e 's:-I${WORKDIR}\S*: :g' $i + sed -i -e 's:-L${WORKDIR}\S*: :g' $i + done } STAGE_TEMP="${WORKDIR}/temp-staging" diff --git a/classes/base.bbclass b/classes/base.bbclass index 53139e19fa..1294e41c65 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -10,6 +10,67 @@ def base_path_join(a, *p): path += '/' + b return path +# for MD5/SHA handling +def base_chk_load_parser(config_path): + import ConfigParser, os, bb + parser = ConfigParser.ConfigParser() + if not len(parser.read(config_path)) == 1: + bb.note("Can not open the '%s' ini file" % config_path) + raise Exception("Can not open the '%s'" % config_path) + + return parser + +def base_chk_file(parser, pn, pv, src_uri, localpath, data): + import os, bb + # Try PN-PV-SRC_URI first and then try PN-SRC_URI + # we rely on the get method to create errors + pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri) + pn_src = "%s-%s" % (pn,src_uri) + if parser.has_section(pn_pv_src): + md5 = parser.get(pn_pv_src, "md5") + sha256 = parser.get(pn_pv_src, "sha256") + elif parser.has_section(pn_src): + md5 = parser.get(pn_src, "md5") + sha256 = parser.get(pn_src, "sha256") + elif parser.has_section(src_uri): + md5 = parser.get(src_uri, "md5") + sha256 = parser.get(src_uri, "sha256") + else: + return False + #raise Exception("Can not find a section for '%s' '%s' and '%s'" % (pn,pv,src_uri)) + + # md5 and sha256 should be valid now + if not os.path.exists(localpath): + bb.note("The localpath does not exist '%s'" % localpath) + raise Exception("The path does not exist '%s'" % localpath) + + + # call md5(sum) and shasum + try: + md5pipe = os.popen('md5sum ' + localpath) + md5data = (md5pipe.readline().split() or [ "" ])[0] + md5pipe.close() + except OSError: + raise Exception("Executing md5sum failed") + + try: + shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath)) + shadata = (shapipe.readline().split() or [ "" ])[0] + shapipe.close() + except OSError: + raise Exception("Executing shasum failed") + + if not md5 == md5data: + bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (md5,md5data)) + raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (md5, md5data)) + + if not sha256 == shadata: + bb.note("The SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256,shadata)) + raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (sha256, shadata)) + + return True + + def base_dep_prepend(d): import bb; # @@ -17,17 +78,13 @@ def base_dep_prepend(d): # the case where host == build == target, for now we don't work in # that case though. # - deps = "" + deps = "shasum-native " + if bb.data.getVar('PN', d, True) == "shasum-native": + 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("PATCHTOOL", d, 1) - if patchdeps: - patchdeps = "%s-native" % patchdeps - if 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)): @@ -218,8 +275,12 @@ oe_libinstall() { # If such file doesn't exist, try to cut version suffix if [ ! -f "$lafile" ]; then - libname=`echo "$libname" | sed 's/-[0-9.]*$//'` - lafile=$libname.la + libname1=`echo "$libname" | sed 's/-[0-9.]*$//'` + lafile1=$libname.la + if [ -f "$lafile1" ]; then + libname=$libname1 + lafile=$lafile1 + fi fi if [ -f "$lafile" ]; then @@ -378,6 +439,7 @@ python base_do_mrproper() { addtask fetch do_fetch[dirs] = "${DL_DIR}" +do_fetch[depends] = "shasum-native:do_populate_staging" python base_do_fetch() { import sys @@ -402,6 +464,40 @@ python base_do_fetch() { except bb.fetch.FetchError: (type, value, traceback) = sys.exc_info() raise bb.build.FuncFailed("Fetch failed: %s" % value) + except bb.fetch.MD5SumError: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("MD5 failed: %s" % value) + except: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("Unknown fetch Error: %s" % value) + + + # Verify the SHA and MD5 sums we have in OE and check what do + # in + check_sum = bb.which(bb.data.getVar('BBPATH', d, True), "conf/checksums.ini") + if not check_sum: + bb.note("No conf/checksums.ini found, not checking checksums") + return + + try: + parser = base_chk_load_parser(check_sum) + except: + bb.note("Creating the CheckSum parser failed") + return + + pv = bb.data.getVar('PV', d, True) + pn = bb.data.getVar('PN', d, True) + + # Check each URI + for url in src_uri.split(): + localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata) + (type,host,path,_,_,_) = bb.decodeurl(url) + uri = "%s://%s%s" % (type,host,path) + try: + if not base_chk_file(parser, pn, pv,uri, localpath, d): + bb.note("%s-%s-%s has no section, not checking URI" % (pn,pv,uri)) + except Exception: + raise bb.build.FuncFailed("Checksum of '%s' failed" % uri) } addtask fetchall after do_fetch @@ -696,9 +792,9 @@ python read_subpackage_metadata () { bb.data.setVar(key, sdata[key], d) } -def base_after_parse_two(d): - import bb - import exceptions +def base_after_parse(d): + import bb, os, exceptions + source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0) if not source_mirror_fetch: need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1) @@ -715,6 +811,8 @@ def base_after_parse_two(d): 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) # OBSOLETE in bitbake 1.7.4 @@ -726,20 +824,33 @@ def base_after_parse_two(d): if use_nls != None: bb.data.setVar('USE_NLS', use_nls, d) -def base_after_parse(d): - import bb, os - - # Make sure MACHINE *isn't* exported + # Make sure MACHINE isn't exported + # (breaks binutils at least) bb.data.delVarFlag('MACHINE', 'export', d) bb.data.setVarFlag('MACHINE', 'unexport', 1, d) + + # Make sure DISTRO isn't exported + # (breaks sysvinit at least) + bb.data.delVarFlag('DISTRO', 'export', d) + bb.data.setVarFlag('DISTRO', 'unexport', 1, d) + + # Git packages should DEPEND on git-native + srcuri = bb.data.getVar('SRC_URI', d, 1) + if "git://" in srcuri: + depends = bb.data.getVarFlag('do_fetch', 'depends', d) or "" + depends = depends + " git-native:do_populate_staging" + bb.data.setVarFlag('do_fetch', 'depends', depends, d) 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'): + override = bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) + + if not override or override == '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)) @@ -751,12 +862,64 @@ def base_after_parse(d): bb.data.setVar('PACKAGE_ARCH', mach_arch, d) return +# +# Various backwards compatibility stuff to be removed +# when we switch to bitbake 1.8.2+ as a minimum version +# +def base_oldbitbake_workarounds(d): + import bb + from bb import __version__ + from distutils.version import LooseVersion + + if (LooseVersion(__version__) > "1.8.0"): + return + + pn = bb.data.getVar('PN', d, True) + srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, True) + if srcdate != None: + bb.data.setVar('SRCDATE', srcdate, d) + depends = bb.data.getVar('DEPENDS', d, False) + patchdeps = bb.data.getVar("PATCHTOOL", d, True) + if patchdeps: + patchdeps = "%s-native " % patchdeps + if not patchdeps in bb.data.getVar("PROVIDES", d, True): + depends = patchdeps + depends + if bb.data.inherits_class('rootfs_ipk', d): + depends = "ipkg-native ipkg-utils-native fakeroot-native " + depends + if bb.data.inherits_class('rootfs_deb', d): + depends = "dpkg-native apt-native fakeroot-native " + depends + if bb.data.inherits_class('image', d): + depends = "makedevs-native " + depends + for type in (bb.data.getVar('IMAGE_FSTYPES', d, True) or "").split(): + deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "" + if deps: + depends = depends + " %s" % deps + for dep in (bb.data.getVar('EXTRA_IMAGEDEPENDS', d, True) or "").split(): + depends = depends + " %s" % dep + + packages = bb.data.getVar('PACKAGES', d, True) + if packages != '': + if bb.data.inherits_class('package_ipk', d): + depends = "ipkg-utils-native " + depends + if bb.data.inherits_class('package_deb', d): + depends = "dpkg-native " + depends + if bb.data.inherits_class('package', d): + depends = "${PACKAGE_DEPENDS} fakeroot-native " + depends + + bb.data.setVar('DEPENDS', depends, d) python () { - base_after_parse_two(d) + base_oldbitbake_workarounds(d) base_after_parse(d) } +# Remove me when we switch to bitbake 1.8.8 +def base_get_srcrev(d): + import bb + + if hasattr(bb.fetch, "get_srcrev"): + return bb.fetch.get_srcrev(d) + return "NOT IMPLEMENTED" # Patch handling inherit patch @@ -821,6 +984,7 @@ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://ftp.tux.org/pub/sites/vic ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://gd.tuwien.ac.at/utils/admin-tools/lsof/ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://sunsite.ualberta.ca/pub/Mirror/lsof/ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://the.wiretapped.net/pub/security/host-security/lsof/ +http://www.apache.org/dist http://archive.apache.org/dist } diff --git a/classes/binconfig.bbclass b/classes/binconfig.bbclass index dadf2dddfc..497b78f454 100644 --- a/classes/binconfig.bbclass +++ b/classes/binconfig.bbclass @@ -18,6 +18,8 @@ def get_binconfig_mangle(d): s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'" s += " -e 's:OEPREFIX:${STAGING_LIBDIR}/..:'" s += " -e 's:OEEXECPREFIX:${STAGING_LIBDIR}/..:'" + s += " -e 's:-I${WORKDIR}:-I${STAGING_INCDIR}:'" + s += " -e 's:-L${WORKDIR}:-L${STAGING_LIBDIR}:'" return s BINCONFIG_GLOB ?= "*-config" diff --git a/classes/cpan-base.bbclass b/classes/cpan-base.bbclass new file mode 100644 index 0000000000..cc0d11e515 --- /dev/null +++ b/classes/cpan-base.bbclass @@ -0,0 +1,55 @@ +# +# cpan-base providers various perl related information needed for building +# cpan modules +# +FILES_${PN} += "${libdir}/perl5 ${datadir}/perl5" + +DEPENDS += "${@["perl", "perl-native"][(bb.data.inherits_class('native', d))]}" +RDEPENDS += "${@["perl", ""][(bb.data.inherits_class('native', d))]}" + +# Determine the staged version of perl from the perl configuration file +def get_perl_version(d): + import os, bb, re + cfg = bb.data.expand('${STAGING_DIR}/${HOST_SYS}/perl/config.sh', d) + try: + f = open(cfg, 'r') + except IOError: + return None + l = f.readlines(); + f.close(); + r = re.compile("version='(\d\.\d\.\d)'") + for s in l: + m = r.match(s) + if m: + return m.group(1) + return None + +# Only 5.8.7 and 5.8.4 existed at the time we moved to the new layout +def is_new_perl(d): + ver = get_perl_version(d) + if ver == "5.8.4" or ver == "5.8.7": + return "no" + return "yes" + +# Determine where the library directories are +def perl_get_libdirs(d): + import bb + libdir = bb.data.getVar('libdir', d, 1) + if is_new_perl(d) == "yes": + libdirs = libdir + '/perl5' + else: + libdirs = libdir + '/*/*/perl5' + return libdirs + +def is_target(d): + import bb + if not bb.data.inherits_class('native', d): + return "yes" + return "no" + +IS_NEW_PERL = "${@is_new_perl(d)}" +PERLLIBDIRS = "${@perl_get_libdirs(d)}" + +FILES_${PN}-dbg += "${PERLLIBDIRS}/auto/*/.debug \ + ${PERLLIBDIRS}/auto/*/*/.debug \ + ${PERLLIBDIRS}/auto/*/*/*/.debug" diff --git a/classes/cpan.bbclass b/classes/cpan.bbclass index 74bbebf882..3250528c7a 100644 --- a/classes/cpan.bbclass +++ b/classes/cpan.bbclass @@ -1,32 +1,52 @@ # # This is for perl modules that use the old Makefile.PL build system # -FILES_${PN} += '${libdir}/perl5' -EXTRA_CPANFLAGS = "" +inherit cpan-base -DEPENDS += "perl-native" -RDEPENDS += "perl" +EXTRA_CPANFLAGS ?= "" + +# Env var which tells perl if it should use host (no) or target (yes) settings +export PERLCONFIGTARGET = "${@is_target(d)}" + +# Env var which tells perl where the perl include files are +export PERL_INC = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}/CORE" cpan_do_configure () { - perl Makefile.PL ${EXTRA_CPANFLAGS} + yes '' | perl Makefile.PL ${EXTRA_CPANFLAGS} if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh - sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ - -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ - -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ - -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ - -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ - Makefile + if [ "${IS_NEW_PERL}" = "yes" ]; then + sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ + -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ + -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${datadir}/perl5:" \ + -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5:" \ + -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ + Makefile + else + sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ + -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ + -e "s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ + -e "s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5/site_perl/${version}:" \ + -e "s:\(LDDLFLAGS.*\)${STAGING_DIR}/${BUILD_SYS}/lib:\1${STAGING_LIBDIR}:" \ + Makefile + fi fi } cpan_do_compile () { - # You must use gcc to link on sh - OPTIONS="" - if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then - OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" + if [ "${IS_NEW_PERL}" = "yes" ]; then + oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" LD="${CCLD}" + else + # You must use gcc to link on sh + OPTIONS="" + if test ${TARGET_ARCH} = "sh3" -o ${TARGET_ARCH} = "sh4"; then + OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" + fi + if test ${TARGET_ARCH} = "powerpc" ; then + OPTIONS="LD=${TARGET_ARCH}-${TARGET_OS}-gcc" + fi + oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS fi - oe_runmake PASTHRU_INC="${CFLAGS}" CCFLAGS="${CFLAGS}" $OPTIONS } cpan_do_install () { diff --git a/classes/cpan_build.bbclass b/classes/cpan_build.bbclass index 0660ef9b82..63e716c099 100644 --- a/classes/cpan_build.bbclass +++ b/classes/cpan_build.bbclass @@ -1,16 +1,14 @@ # # This is for perl modules that use the new Build.PL build system # -INHIBIT_NATIVE_STAGE_INSTALL = "1" -FILES_${PN} += '${libdir}/perl5' +inherit cpan-base -DEPENDS += "perl-native" -RDEPENDS += "perl" +INHIBIT_NATIVE_STAGE_INSTALL = "1" # # We also need to have built libmodule-build-perl-native for # everything except libmodule-build-perl-native itself (which uses -# this class, but uses itself as the probider of +# this class, but uses itself as the provider of # libmodule-build-perl) # def cpan_build_dep_prepend(d): @@ -24,24 +22,29 @@ def cpan_build_dep_prepend(d): DEPENDS_prepend = "${@cpan_build_dep_prepend(d)}" -def is_crosscompiling(d): - import bb - if not bb.data.inherits_class('native', d): - return "yes" - return "no" - cpan_build_do_configure () { - if [ ${@is_crosscompiling(d)} == "yes" ]; then + if [ ${@is_target(d)} == "yes" ]; then # build for target . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh - perl Build.PL --installdirs vendor \ - --destdir ${D} \ - --install_path lib="${libdir}/perl5/site_perl/${version}" \ - --install_path arch="${libdir}/perl5/site_perl/${version}/${TARGET_SYS}" \ - --install_path script=${bindir} \ - --install_path bin=${bindir} \ - --install_path bindoc=${mandir}/man1 \ - --install_path libdoc=${mandir}/man3 + if [ "${IS_NEW_PERL}" = "yes" ]; then + perl Build.PL --installdirs vendor \ + --destdir ${D} \ + --install_path lib="${datadir}/perl5" \ + --install_path arch="${libdir}/perl5" \ + --install_path script=${bindir} \ + --install_path bin=${bindir} \ + --install_path bindoc=${mandir}/man1 \ + --install_path libdoc=${mandir}/man3 + else + perl Build.PL --installdirs vendor \ + --destdir ${D} \ + --install_path lib="${libdir}/perl5/site_perl/${version}" \ + --install_path arch="${libdir}/perl5/site_perl/${version}/${TARGET_SYS}" \ + --install_path script=${bindir} \ + --install_path bin=${bindir} \ + --install_path bindoc=${mandir}/man1 \ + --install_path libdoc=${mandir}/man3 + fi else # build for host perl Build.PL --installdirs site @@ -53,13 +56,13 @@ cpan_build_do_compile () { } cpan_build_do_install () { - if [ ${@is_crosscompiling(d)} == "yes" ]; then + if [ ${@is_target(d)} == "yes" ]; then perl Build install fi } do_stage_append () { - if [ ${@is_crosscompiling(d)} == "no" ]; then + if [ ${@is_target(d)} == "no" ]; then perl Build install fi } diff --git a/classes/devshell.bbclass b/classes/devshell.bbclass index 14f957e12b..35456b517b 100644 --- a/classes/devshell.bbclass +++ b/classes/devshell.bbclass @@ -2,9 +2,14 @@ EXTRA_OEMAKE[export] = "1" do_devshell[dirs] = "${S}" do_devshell[nostamp] = "1" -do_devshell[interactive] = "1" + devshell_do_devshell() { - bash -i + export TERMWINDOWTITLE="Bitbake Developer Shell" + ${TERMCMD} + if [ $? -ne 0 ]; then + echo "Fatal: '${TERMCMD}' not found. Check TERMCMD variable." + exit 1 + fi } addtask devshell after do_patch diff --git a/classes/distutils-base.bbclass b/classes/distutils-base.bbclass index 15e945d518..c3f325768d 100644 --- a/classes/distutils-base.bbclass +++ b/classes/distutils-base.bbclass @@ -7,8 +7,12 @@ def python_dir(d): staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 ) if os.path.exists( "%s/python2.3" % staging_incdir ): return "python2.3" if os.path.exists( "%s/python2.4" % staging_incdir ): return "python2.4" + if os.path.exists( "%s/python2.5" % staging_incdir ): return "python2.5" raise "No Python in STAGING_INCDIR. Forgot to build python-native ?" PYTHON_DIR = "${@python_dir(d)}" -FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}" +FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" +FILES_${PN}-dbg = "${libdir}/${PYTHON_DIR}/site-packages/.debug \ + ${libdir}/${PYTHON_DIR}/site-packages/./*/debug \ + ${libdir}/${PYTHON_DIR}/site-packages/*/*/.debug" diff --git a/classes/distutils.bbclass b/classes/distutils.bbclass index 5f57a9ea19..d23c2a3b2e 100644 --- a/classes/distutils.bbclass +++ b/classes/distutils.bbclass @@ -1,15 +1,40 @@ inherit distutils-base distutils_do_compile() { - BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ - ${STAGING_BINDIR_NATIVE}/python setup.py build || \ - oefatal "python setup.py build execution failed." + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + ${STAGING_BINDIR_NATIVE}/python setup.py build || \ + oefatal "python setup.py build_ext execution failed." +} + +distutils_stage_headers() { + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + ${STAGING_BINDIR_NATIVE}/python setup.py install_headers --install-dir=${STAGING_INCDIR}/${PYTHON_DIR} || \ + oefatal "python setup.py install execution failed." } distutils_do_install() { - BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ - ${STAGING_BINDIR_NATIVE}/python setup.py install --prefix=${D}/${prefix} --install-data=${D}/${datadir} || \ - oefatal "python setup.py install execution failed." + install -d ${D}${libdir}/${PYTHON_DIR}/site-packages + PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages \ + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + ${STAGING_BINDIR_NATIVE}/python setup.py install --prefix=${D}/${prefix} --install-data=${D}/${datadir} || \ + oefatal "python setup.py install execution failed." + + for i in `find ${D} -name "*.py"` ; do \ + sed -i -e s:${D}::g $i + done + + if test -e ${D}${bindir} ; then + for i in ${D}${bindir}/* ; do \ + sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i + done + fi + + if test -e ${D}${sbindir} ; then + for i in ${D}${sbindir}/* ; do \ + sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i + done + fi + } EXPORT_FUNCTIONS do_compile do_install diff --git a/classes/dsmg600-image.bbclass b/classes/dsmg600-image.bbclass index 6920fe5dbd..5ccf49267b 100644 --- a/classes/dsmg600-image.bbclass +++ b/classes/dsmg600-image.bbclass @@ -16,4 +16,5 @@ dsmg600_pack_image () { rm -rf ${DEPLOY_DIR_IMAGE}/firmupgrade } -IMAGE_POSTPROCESS_COMMAND += "dsmg600_pack_image; " +# dsmg600 is not a separate machine - use the nslu2 machine override. +IMAGE_POSTPROCESS_COMMAND_nslu2 += "dsmg600_pack_image; " diff --git a/classes/e.bbclass b/classes/e.bbclass index f20c1f8b60..84d85f5542 100644 --- a/classes/e.bbclass +++ b/classes/e.bbclass @@ -1,5 +1,6 @@ HOMEPAGE = "http://www.enlightenment.org" SECTION = "e/apps" +SRC_URI = "http://download.enlightenment.org/snapshots/2007-06-17/${PN}-${PV}.tar.gz" inherit autotools pkgconfig binconfig @@ -22,11 +23,13 @@ export ESMART_CONFIG = "${STAGING_BINDIR_CROSS}/esmart-config" export FREETYPE_CONFIG = "${STAGING_BINDIR_CROSS}/freetype-config" export IMLIB2_CONFIG = "${STAGING_BINDIR_CROSS}/imlib2-config" -do_compile_prepend() { - find ${S} -name Makefile | xargs sed -i 's:/usr/include:${STAGING_INCDIR}:' - find ${S} -name Makefile | xargs sed -i 's:/usr/X11R6/include:${STAGING_INCDIR}:' -} +#do_compile_prepend() { +# find ${S} -name Makefile | xargs sed -i 's:/usr/include:${STAGING_INCDIR}:' +# find ${S} -name Makefile | xargs sed -i 's:/usr/X11R6/include:${STAGING_INCDIR}:' +#} -PACKAGES = "${PN}-dbg ${PN} ${PN}-themes" -FILES_${PN} = "${libdir}/lib*.so*" +PACKAGES = "${PN}-dbg ${PN}-themes ${PN} ${PN}-dev" +FILES_${PN} += "${libdir}/lib*.so.*" FILES_${PN}-themes = "${datadir}/${PN}/themes ${datadir}/${PN}/data ${datadir}/${PN}/fonts ${datadir}/${PN}/pointers ${datadir}/${PN}/images ${datadir}/${PN}/users ${datadir}/${PN}/images ${datadir}/${PN}/styles" +FILES_${PN}-dev += "${includedir} ${libdir}/lib*.so" + diff --git a/classes/efl.bbclass b/classes/efl.bbclass deleted file mode 100644 index 9b0345a5b8..0000000000 --- a/classes/efl.bbclass +++ /dev/null @@ -1,53 +0,0 @@ -inherit e - -SECTION = "e/libs" - -SRCNAME = "${@bb.data.getVar('PN', d, 1).replace('-native', '')}" -SRC_URI = "${E_URI}/${SRCNAME}-${PV}.tar.gz" -S = "${WORKDIR}/${SRCNAME}-${PV}" - -INHIBIT_AUTO_STAGE_INCLUDES = "1" -INHIBIT_NATIVE_STAGE_INSTALL = "1" - -libdirectory = "src/lib" -libraries = "lib${SRCNAME}" -headers = "${@bb.data.getVar('SRCNAME',d,1).capitalize()}.h" - -def efl_is_native(d): - import bb - return ["","-native"][bb.data.inherits_class('native', d)] - -do_stage_append () { - for i in ${libraries} - do - oe_libinstall -C ${libdirectory} $i ${STAGING_LIBDIR} - done - for i in ${headers} - do - install -m 0644 ${libdirectory}/$i ${STAGING_INCDIR} - done - - # Install binaries automatically for native builds - if [ "${@efl_is_native(d)}" = "-native" ] - then - - # Most EFL binaries start with the package name - for i in src/bin/${SRCNAME}* - do - if [ -x $i -a -f $i ] - then - - # Don't install anything with an extension (.so, etc) - if echo $i | grep -v \\. - then - ${HOST_SYS}-libtool --mode=install install -m 0755 $i ${STAGING_BINDIR} - fi - fi - done - fi -} - -PACKAGES = "${PN}-dbg ${PN} ${PN}-themes ${PN}-dev ${PN}-examples" -FILES_${PN}-dev = "${bindir}/${PN}-config ${libdir}/pkgconfig ${libdir}/lib*.?a ${libdir}/lib*.a ${includedir}" -FILES_${PN}-examples = "${bindir} ${datadir}" - diff --git a/classes/efl_base.bbclass b/classes/efl_base.bbclass new file mode 100644 index 0000000000..7f170d70f2 --- /dev/null +++ b/classes/efl_base.bbclass @@ -0,0 +1,20 @@ +inherit autotools pkgconfig + +#do_prepsources () { +# make clean distclean || true +#} +#addtask prepsources after do_fetch before do_unpack + +SECTION = "e/libs" +HOMEPAGE = "http://www.enlightenment.org" +SRCNAME = "${@bb.data.getVar('PN', d, 1).replace('-native', '')}" +SRC_URI = "http://download.enlightenment.org/snapshots/2007-07-10/${SRCNAME}-${PV}.tar.gz" +S = "${WORKDIR}/${SRCNAME}-${PV}" + +do_stage() { + autotools_stage_all +} + +PACKAGES = "${PN}-dbg ${PN} ${PN}-themes ${PN}-dev" +FILES_${PN}-dev += "${bindir}/${PN}-config ${libdir}/pkgconfig/* ${libdir}/lib*.?a ${libdir}/lib*.a" + diff --git a/classes/efl_library.bbclass b/classes/efl_library.bbclass new file mode 100644 index 0000000000..c2b6938e47 --- /dev/null +++ b/classes/efl_library.bbclass @@ -0,0 +1,9 @@ +inherit efl_base + +SRC_URI = "${E_CVS};module=e17/libs/${SRCNAME}" +S = "${WORKDIR}/${SRCNAME}" + +PACKAGES =+ "${PN}-tests" +FILES_${PN}-tests = "${bindir}/${PN} ${bindir}/*_* ${datadir}" +FILES_${PN}-dev += "${bindir}/*-config ${libdir}/${PN}/*.a ${libdir}/${PN}/*.la ${libdir}/${PN}/*/*.a ${libdir}/${PN}/*/*.la" +FILES_${PN} = "${libdir}/*.so*" diff --git a/classes/gconf.bbclass b/classes/gconf.bbclass index 686f8e6596..99f33e433a 100644 --- a/classes/gconf.bbclass +++ b/classes/gconf.bbclass @@ -1,4 +1,4 @@ -DEPENDS += "gconf" +DEPENDS += "gconf gconf-native" gconf_postinst() { if [ "$1" = configure ]; then diff --git a/classes/gtk-icon-cache.bbclass b/classes/gtk-icon-cache.bbclass index 0f68e6812b..b86562890a 100644 --- a/classes/gtk-icon-cache.bbclass +++ b/classes/gtk-icon-cache.bbclass @@ -1,5 +1,8 @@ FILES_${PN} += "${datadir}/icons/hicolor" +RDEPENDS += "hicolor-icon-theme" +# This could run on the host as icon cache files are architecture independent, +# but there is no gtk-update-icon-cache built natively. gtk-icon-cache_postinst() { if [ "x$D" != "x" ]; then exit 1 diff --git a/classes/icecc.bbclass b/classes/icecc.bbclass index 5fadee4ab6..446e78ae1a 100644 --- a/classes/icecc.bbclass +++ b/classes/icecc.bbclass @@ -253,10 +253,11 @@ def icc_path(bb,d,compile): #"system" package blacklist contains a list of packages that can not distribute compile tasks #for one reason or the other - system_package_blacklist = [ "uclibc", "glibc", "qemu" ] + system_package_blacklist = [ "uclibc", "glibc-intermediate", "qemu" ] for black in system_package_blacklist: if black in package_tmp: + bb.data.setVar('PARALLEL_MAKE' , '', d) return "" #user defined exclusion list @@ -265,6 +266,7 @@ def icc_path(bb,d,compile): for black in user_package_blacklist: if black in package_tmp: + bb.data.setVar('PARALLEL_MAKE' , '', d) return "" diff --git a/classes/image.bbclass b/classes/image.bbclass index 5055b5b987..248ccab60b 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -13,19 +13,21 @@ USE_DEVFS ?= "0" PID = "${@os.getpid()}" -DEPENDS += "makedevs-native" PACKAGE_ARCH = "${MACHINE_ARCH}" -def get_image_deps(d): - import bb - str = "" - for type in (bb.data.getVar('IMAGE_FSTYPES', d, 1) or "").split(): - deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "" - if deps: - str += " %s" % deps - return str +do_rootfs[depends] += "makedevs-native:do_populate_staging fakeroot-native:do_populate_staging" -DEPENDS += "${@get_image_deps(d)}" +python () { + import bb + + deps = bb.data.getVarFlag('do_rootfs', 'depends', d) or "" + for type in (bb.data.getVar('IMAGE_FSTYPES', d, True) or "").split(): + for dep in ((bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "").split() or []): + deps += " %s:do_populate_staging" % dep + for dep in (bb.data.getVar('EXTRA_IMAGEDEPENDS', d, True) or "").split(): + deps += " %s:do_populate_staging" % dep + bb.data.setVarFlag('do_rootfs', 'depends', deps, d) +} # # Get a list of files containing device tables to create. @@ -56,6 +58,7 @@ IMAGE_LINGUAS ?= "de-de fr-fr en-gb" LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}" ROOTFS_POSTPROCESS_COMMAND ?= "" +MACHINE_POSTPROCESS_COMMAND ?= "" do_rootfs[nostamp] = "1" do_rootfs[dirs] = "${TOPDIR}" @@ -78,7 +81,7 @@ fakeroot do_rootfs () { insert_feed_uris - rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/oe + rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/* ${IMAGE_PREPROCESS_COMMAND} @@ -87,17 +90,19 @@ fakeroot do_rootfs () { for type in ${IMAGE_FSTYPES}; do if test -z "$FAKEROOTKEY"; then - fakeroot -i ${TMPDIR}/fakedb.image bbimage -t $type -e ${FILE} + fakeroot -i ${TMPDIR}/fakedb.image ${PYTHON} `which bbimage` -t $type -e ${FILE} else - bbimage -n "${IMAGE_NAME}" -t "$type" -e "${FILE}" + ${PYTHON} `which bbimage` -n "${IMAGE_NAME}" -t "$type" -e "${FILE}" fi cd ${DEPLOY_DIR_IMAGE}/ - rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.* + rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type ln -s ${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type done ${IMAGE_POSTPROCESS_COMMAND} + + ${MACHINE_POSTPROCESS_COMMAND} } insert_feed_uris () { diff --git a/classes/insane.bbclass b/classes/insane.bbclass index a3ca21d1dc..08c1058edf 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -22,6 +22,7 @@ # We play a special package function inherit package PACKAGE_DEPENDS += "pax-utils-native" +#PACKAGE_DEPENDS += chrpath-native" PACKAGEFUNCS += " do_package_qa " @@ -47,19 +48,31 @@ def package_qa_get_machine_dict(): "hppa": (15, 3, 0, False, True), "m68k": ( 4, 0, 0, False, True), "mips": ( 8, 0, 0, False, True), + "mipsel": ( 8, 0, 0, True, True), "s390": (22, 0, 0, False, True), + "sh4": (42, 0, 0, True, True), "sparc": ( 2, 0, 0, False, True), }, "linux-uclibc" : { - "arm" : (40, 97, 0, True, True), - "armeb": (40, 97, 0, False, True), - "powerpc": (20, 0, 0, False, True), - "mipsel": ( 8, 0, 0, True, True), + "arm" : ( 40, 97, 0, True, True), + "armeb": ( 40, 97, 0, False, True), + "powerpc": ( 20, 0, 0, False, True), + "mipsel": ( 8, 0, 0, True, True), + "avr32": (6317, 0, 0, False, True), }, + "uclinux-uclibc" : { + "bfin": ( 0, 0, 0, True, True), + }, "linux-gnueabi" : { "arm" : (40, 0, 0, True, True), + "armeb" : (40, 0, 0, False, True), }, - } + "linux-uclibcgnueabi" : { + "arm" : (40, 0, 0, True, True), + "armeb" : (40, 0, 0, False, True), + }, + + } # factory for a class, embedded in a method def package_qa_get_elf(path, bits32): @@ -199,19 +212,28 @@ def package_qa_check_rpath(file,name,d): """ import bb, os scanelf = os.path.join(bb.data.getVar('STAGING_BINDIR_NATIVE',d,True),'scanelf') + #chrpath = os.path.join(bb.data.getVar('STAGING_BINDIR_NATIVE',d,True),'chrpath') bad_dir = bb.data.getVar('TMPDIR', d, True) + "/work" + bad_dir_test = bb.data.getVar('TMPDIR', d, True) if not os.path.exists(scanelf): - bb.fatal("Can not check RPATH scanelf not found") + bb.fatal("Can not check RPATH, scanelf (part of pax-utils-native) not found") + #if not os.path.exists(chrpath): + # bb.fatal("Can not fix RPATH, chrpath (part of chrpath-native) not found") if not bad_dir in bb.data.getVar('WORKDIR', d, True): bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") - output = os.popen("%s -Byr %s" % (scanelf,file)) - txt = output.readline().rsplit() - if bad_dir in txt: - package_qa_write_error( 1, name, file, d) - bb.error("QA Issue package %s contains bad RPATH %s in file %s" % (name, txt, file)) - return False - + #bb.note("%s -B -F%%r#F %s" % (scanelf,file)) + output = os.popen("%s -B -F%%r#F '%s'" % (scanelf,file)) + txt = output.readline().split() + #bb.note("???%s???" % bad_dir_test) + for line in txt: + #bb.note("===%s===" % line) + if bad_dir in line: + package_qa_write_error( 1, name, file, d) + bb.error("QA Issue package %s contains bad RPATH %s in file %s" % (name, line, file)) + #bb.note("Fixing RPATH for you in %s" % file) + #os.popen("%s -r /lib %s" % (chrpath,file)) + return False return True def package_qa_check_devdbg(path, name,d): @@ -253,6 +275,10 @@ def package_qa_check_arch(path,name,d): import bb, os target_os = bb.data.getVar('TARGET_OS', d, True) target_arch = bb.data.getVar('TARGET_ARCH', d, True) + + # FIXME: Cross package confuse this check, so just skip them + if bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d): + return True # avoid following links to /usr/bin (e.g. on udev builds) # we will check the files pointed to anyway... @@ -370,9 +396,9 @@ def package_qa_check_rdepends(pkg, workdir, d): # Now do the sanity check!!! for rdepend in rdepends: if "-dbg" in rdepend: - package_qa_write_error( 2, name, rdepend, d ) - bb.error("QA issue, koen give us a better msg!!!") - if package_qa_make_fatal_error( 2, name, rdepend, d ): + package_qa_write_error( 2, pkgname, rdepend, d ) + bb.error("QA issue: %s rdepends on %s" % (pkgname,rdepend)) + if package_qa_make_fatal_error( 2, pkgname, rdepend, d ): sane = False return sane @@ -398,7 +424,7 @@ python do_package_qa () { rdepends_sane = False if not walk_sane or not rdepends_sane: - bb.fatal("QA ran found fatal errors. Please consider fixing them") + bb.fatal("QA run found fatal errors. Please consider fixing them.") bb.note("DONE with PACKAGE QA") } diff --git a/classes/kernel-arch.bbclass b/classes/kernel-arch.bbclass index c50a7d5ebf..9208c3507a 100644 --- a/classes/kernel-arch.bbclass +++ b/classes/kernel-arch.bbclass @@ -11,7 +11,8 @@ valid_archs = "alpha cris ia64 \ arm arm26 \ m32r mips \ sh sh64 um h8300 \ - parisc s390 v850" + parisc s390 v850 \ + avr32 blackfin" def map_kernel_arch(a, d): import bb, re @@ -23,7 +24,8 @@ def map_kernel_arch(a, d): elif re.match('armeb$', a): return 'arm' elif re.match('mipsel$', a): return 'mips' elif re.match('sh(3|4)$', a): return 'sh' - elif a in valid_archs: return a + elif re.match('bfin', a): return 'blackfin' + elif a in valid_archs: return a else: bb.error("cannot map '%s' to a linux kernel architecture" % a) diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 2434ca1f0a..0670da678d 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -143,7 +143,10 @@ kernel_do_install() { install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} install -d ${D}/etc/modutils - + if [ "${KERNEL_MAJOR_VERSION}" = "2.6" ]; then + install -d ${D}/etc/modprobe.d + fi + # Check if scripts/genksyms exists and if so, build it if [ -e scripts/genksyms/ ]; then oe_runmake SUBDIRS="scripts/genksyms" @@ -169,15 +172,25 @@ inherit cml1 EXPORT_FUNCTIONS do_compile do_install do_stage do_configure -PACKAGES = "kernel kernel-image kernel-dev" +# kernel-base becomes kernel-${KERNEL_VERSION} +# kernel-image becomes kernel-image-${KERNEL_VERISON} +PACKAGES = "kernel kernel-base kernel-image kernel-dev" FILES = "" FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" FILES_kernel-dev = "/boot/System.map* /boot/config*" -RDEPENDS_kernel = "kernel-image-${KERNEL_VERSION}" +RDEPENDS_kernel = "kernel-base" +RDEPENDS_kernel-base = "kernel-image" PKG_kernel-image = "kernel-image-${KERNEL_VERSION}" +PKG_kernel-base = "kernel-${KERNEL_VERSION}" ALLOW_EMPTY_kernel = "1" +ALLOW_EMPTY_kernel-base = "1" ALLOW_EMPTY_kernel-image = "1" +# Userspace workarounds for kernel modules issues +# This is shame, fix the kernel instead! +DEPENDS_kernel-module-dtl1-cs = "bluez-dtl1-workaround" +RDEPENDS_kernel-module-dtl1-cs = "bluez-dtl1-workaround" + pkg_postinst_kernel-image () { if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then mkdir -p $D/lib/modules/${KERNEL_VERSION} @@ -335,13 +348,16 @@ python populate_packages_prepend () { # Write out any modconf fragment modconf = bb.data.getVar('module_conf_%s' % basename, d, 1) if modconf: - name = '%s/etc/modutils/%s.conf' % (dvar, basename) + if bb.data.getVar("KERNEL_MAJOR_VERSION", d, 1) == "2.6": + name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) + else: + name = '%s/etc/modutils/%s.conf' % (dvar, basename) f = open(name, 'w') f.write("%s\n" % modconf) f.close() files = bb.data.getVar('FILES_%s' % pkg, d, 1) - files = "%s /etc/modutils/%s /etc/modutils/%s.conf" % (files, basename, basename) + files = "%s /etc/modutils/%s /etc/modutils/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename, basename) bb.data.setVar('FILES_%s' % pkg, files, d) if vals.has_key("description"): @@ -362,13 +378,13 @@ python populate_packages_prepend () { postinst = bb.data.getVar('pkg_postinst_modules', d, 1) postrm = bb.data.getVar('pkg_postrm_modules', d, 1) - do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-image-%s' % bb.data.getVar("KERNEL_VERSION", d, 1)) + do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % bb.data.getVar("KERNEL_VERSION", d, 1)) import re, os metapkg = "kernel-modules" bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) bb.data.setVar('FILES_' + metapkg, "", d) - blacklist = [ 'kernel-dev', 'kernel-image' ] + blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base' ] for l in module_deps.values(): for i in l: pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) diff --git a/classes/lsppchd-image.bbclass b/classes/lsppchd-image.bbclass new file mode 100644 index 0000000000..cb13222d64 --- /dev/null +++ b/classes/lsppchd-image.bbclass @@ -0,0 +1,10 @@ +IMAGE_PREPROCESS_COMMAND_lsppchd += "export KPATH=`ls -tr ${IMAGE_ROOTFS}/boot/uImage-* | tail -1`; ln -sf /boot/${KPATH##*/} ${IMAGE_ROOTFS}/boot/uImage;" +IMAGE_PREPROCESS_COMMAND_lsppchd += "sed -i -es,^id:5:initdefault:,id:3:initdefault:, ${IMAGE_ROOTFS}/etc/inittab;" +IMAGE_PREPROCESS_COMMAND_lsppchd += "sed -i -es,^root::0,root:BTMzOOAQfESg6:0, ${IMAGE_ROOTFS}/etc/passwd;" +IMAGE_PREPROCESS_COMMAND_lsppchd += "sed -i -es,^VERBOSE=no,VERBOSE=very, ${IMAGE_ROOTFS}/etc/default/rcS;" + +lsppchd_pack_image() { +: +} + +IMAGE_POSTPROCESS_COMMAND += "lsppchd_pack_image; " diff --git a/classes/lsppchg-image.bbclass b/classes/lsppchg-image.bbclass new file mode 100644 index 0000000000..553414224d --- /dev/null +++ b/classes/lsppchg-image.bbclass @@ -0,0 +1,10 @@ +IMAGE_PREPROCESS_COMMAND_lsppchg += "export KPATH=`ls -tr ${IMAGE_ROOTFS}/boot/uImage-* | tail -1`; ln -sf /boot/${KPATH##*/} ${IMAGE_ROOTFS}/boot/uImage;" +IMAGE_PREPROCESS_COMMAND_lsppchg += "sed -i -es,^id:5:initdefault:,id:3:initdefault:, ${IMAGE_ROOTFS}/etc/inittab;" +IMAGE_PREPROCESS_COMMAND_lsppchg += "sed -i -es,^root::0,root:BTMzOOAQfESg6:0, ${IMAGE_ROOTFS}/etc/passwd;" +IMAGE_PREPROCESS_COMMAND_lsppchg += "sed -i -es,^VERBOSE=no,VERBOSE=very, ${IMAGE_ROOTFS}/etc/default/rcS;" + +lsppchg_pack_image() { +: +} + +IMAGE_POSTPROCESS_COMMAND += "lsppchg_pack_image; " diff --git a/classes/magicbox-image.bbclass b/classes/magicbox-image.bbclass new file mode 100644 index 0000000000..c75e69cac2 --- /dev/null +++ b/classes/magicbox-image.bbclass @@ -0,0 +1,37 @@ +magicbox_gen_images() { + # find latest kernel + KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/uImage* | tail -n 1` + if [ -z "$KERNEL" ]; then + oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Exiting !" + exit 1 + fi + + #squashfs + #We need to prep the image so that u-boot recognizes it + mv ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs.bin + ${STAGING_BINDIR_NATIVE}/mkimage -A ppc -O linux -T ramdisk -C none -n "OPLinux-uclibc-squashfs" \ + -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs.bin ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs + rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs.bin + + + #squashfs-lzma + #same as squashfs + mv ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs-lzma.bin + ${STAGING_BINDIR_NATIVE}/mkimage -A ppc -O linux -T ramdisk -C none -n "OPLinux-uclibc-squashfs-lzma" \ + -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs-lzma.bin ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma + rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs-lzma.bin + + #kernel+jffs2 in a single image + #Add jffs2 marker at the end of the rootfs file + echo -ne '\xde\xad\xc0\xde' >> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 + + + ( dd if=$KERNEL bs=65536 conv=sync; \ + dd if=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 bs=65536 conv=sync; \ + ) > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.jffs2.flash.bin + +} + + + +IMAGE_POSTPROCESS_COMMAND += "magicbox_gen_images; " diff --git a/classes/meta.bbclass b/classes/meta.bbclass new file mode 100644 index 0000000000..f7d41eec26 --- /dev/null +++ b/classes/meta.bbclass @@ -0,0 +1,5 @@ + +PACKAGES = "" + +BUILD_ALL_DEPS = "1" +do_build[recrdeptask] = "do_build"
\ No newline at end of file diff --git a/classes/n2100-image.bbclass b/classes/n2100-image.bbclass new file mode 100644 index 0000000000..bc6c12e1fb --- /dev/null +++ b/classes/n2100-image.bbclass @@ -0,0 +1,32 @@ +n2100_pack_image() { + # find latest kernel + KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/zImage* | tail -1` + if [ -z "$KERNEL" ]; then + oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Bitbake linux to create one." + exit 1 + fi + ROOTFS=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 + OUTPUT=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.flash.img + PADFILE=${DEPLOY_DIR_IMAGE}/padfile.zzz + HEX_MAX_KERN_SIZE=1C0000 + DEC_MAX_KERN_SIZE=`echo "ibase=16; $HEX_MAX_KERN_SIZE" | bc ` + HEX_MAX_ROOT_SIZE=DC0000 + DEC_MAX_ROOT_SIZE=`echo "ibase=16; $HEX_MAX_ROOT_SIZE" | bc ` + KERNEL_SIZE=`ls -l $KERNEL | awk '{print $5}'` + if [ $KERNEL_SIZE -gt $DEC_MAX_KERN_SIZE ]; then + oefatal "Kernel too large at $KERNEL_SIZE bytes. Max is $DEC_MAX_KERN_SIZE." + exit 1 + fi + ROOT_SIZE=`ls -l $ROOTFS | awk '{print $5}'` + if [ $ROOT_SIZE -gt $DEC_MAX_ROOT_SIZE ]; then + oefatal "Rootfs is too large at $ROOT_SIZE bytes. Max is $DEC_MAX_ROOT_SIZE." + exit 1 + fi + PAD_SIZE=`echo "$DEC_MAX_KERN_SIZE - $KERNEL_SIZE" | bc ` + dd if=/dev/zero of=$PADFILE bs=$PAD_SIZE count=1 2>>/dev/null + cat $KERNEL $PADFILE $ROOTFS > $OUTPUT + rm -f $PADFILE + ls -l $OUTPUT +} + +IMAGE_POSTPROCESS_COMMAND += "n2100_pack_image; " diff --git a/classes/nas100d-image.bbclass b/classes/nas100d-image.bbclass index 0d48ebd476..1150116bdb 100644 --- a/classes/nas100d-image.bbclass +++ b/classes/nas100d-image.bbclass @@ -16,4 +16,5 @@ nas100d_pack_image () { rm -rf ${DEPLOY_DIR_IMAGE}/firmupgrade } -IMAGE_POSTPROCESS_COMMAND += "nas100d_pack_image; " +# nas100d is not a separate machine - use the nslu2 machine override. +IMAGE_POSTPROCESS_COMMAND_nslu2 += "nas100d_pack_image; " diff --git a/classes/native.bbclass b/classes/native.bbclass index 556c0e17e2..43000f96bf 100644 --- a/classes/native.bbclass +++ b/classes/native.bbclass @@ -39,6 +39,9 @@ LDFLAGS_build-darwin = "-L${STAGING_DIR}/${BUILD_SYS}/lib " STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}" STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}" +# Don't use site files for native builds +export CONFIG_SITE = "" + # set the compiler as well. It could have been set to something else export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}" diff --git a/classes/nslu2-image.bbclass b/classes/nslu2-image.bbclass index e1af34fa57..14bf989055 100644 --- a/classes/nslu2-image.bbclass +++ b/classes/nslu2-image.bbclass @@ -16,5 +16,5 @@ nslu2_pack_image () { rm -rf ${DEPLOY_DIR_IMAGE}/slug } -EXTRA_IMAGEDEPENDS += 'slugimage-native nslu2-linksys-firmware ixp4xx-npe upslug2-native' -IMAGE_POSTPROCESS_COMMAND += "nslu2_pack_image; " +EXTRA_IMAGEDEPENDS_nslu2 += 'slugimage-native nslu2-linksys-firmware ixp4xx-npe upslug2-native' +IMAGE_POSTPROCESS_COMMAND_nslu2 += "nslu2_pack_image; " diff --git a/classes/nylon-image.bbclass b/classes/nylon-image.bbclass index e24aa33cf4..6d867eab48 100644 --- a/classes/nylon-image.bbclass +++ b/classes/nylon-image.bbclass @@ -20,4 +20,7 @@ nylon_create_imgz() { rm -r ${DEPLOY_DIR_IMAGE}/tmp } -IMAGE_POSTPROCESS_COMMAND += "nylon_create_imgz;" +IMAGE_POSTPROCESS_COMMAND += "kldsköa" +IMAGE_POSTPROCESS_COMMAND_mtx-1 += "nylon_create_imgz;" +IMAGE_POSTPROCESS_COMMAND_mtx-2 += "nylon_create_imgz;" +IMAGE_POSTPROCESS_COMMAND_mtx-3a += "nylon_create_initrd_uimage;" diff --git a/classes/openmoko-base.bbclass b/classes/openmoko-base.bbclass index 35243c9752..8643daa7a4 100644 --- a/classes/openmoko-base.bbclass +++ b/classes/openmoko-base.bbclass @@ -9,6 +9,7 @@ def openmoko_base_get_subdir(d): if section == 'base' or section == 'libs': return "" elif section in 'apps tools pim'.split(): return "applications" elif section == "panel-plugin": return "panel-plugins" + elif section == "inputmethods": return "inputmethods" else: return section SUBDIR = "${@openmoko_base_get_subdir(d)}" diff --git a/classes/openmoko-panel-plugin.bbclass b/classes/openmoko-panel-plugin.bbclass index 0494b412c6..6a22a92ac8 100644 --- a/classes/openmoko-panel-plugin.bbclass +++ b/classes/openmoko-panel-plugin.bbclass @@ -1,6 +1,6 @@ SECTION = "openmoko/panel-plugin" -DEPENDS += "matchbox-panel-2" +DEPENDS += "matchbox-panel-2 libmokopanelui2" -inherit openmoko +inherit openmoko2 FILES_${PN} = "${libdir}/matchbox-panel/lib*.so* ${datadir}" diff --git a/classes/openmoko2.bbclass b/classes/openmoko2.bbclass new file mode 100644 index 0000000000..17b3bbafa6 --- /dev/null +++ b/classes/openmoko2.bbclass @@ -0,0 +1,33 @@ +inherit autotools pkgconfig + +HOMEPAGE = "http://www.openmoko.org" +OPENMOKO_RELEASE ?= "OM-2007.2" +OPENMOKO_MIRROR ?= "svn://svn.openmoko.org/trunk" + +def openmoko_two_get_license(d): + import bb + openmoko, section = bb.data.getVar('SECTION', d, 1).split("/") + return "LGPL GPL".split()[section != "libs"] + +def openmoko_two_get_subdir(d): + import bb + openmoko, section = bb.data.getVar('SECTION', d, 1).split("/") + if section == 'base': return "" + elif section == 'libs': return "libraries" + elif section in 'apps tools pim'.split(): return "applications" + elif section == "panel-plugin": return "panel-plugins" + elif section == "inputmethods": return "inputmethods" + elif section == "daemons": return "daemons" + else: return section + +LICENSE = "${@openmoko_two_get_license(d)}" +SUBDIR = "${@openmoko_two_get_subdir(d)}" + +SRC_URI := "${OPENMOKO_MIRROR}/src/target/${OPENMOKO_RELEASE}/${SUBDIR};module=${PN};proto=http" +S = "${WORKDIR}/${PN}" + +FILES_${PN} += "${datadir}/icons" + +# SVNREV = "r${SRCREV}" +SVNREV = "${SRCDATE}" + diff --git a/classes/opie.bbclass b/classes/opie.bbclass index c3b9d13226..6324dbf522 100644 --- a/classes/opie.bbclass +++ b/classes/opie.bbclass @@ -15,17 +15,14 @@ inherit palmtop -OPIE_CVS_PV = "1.2.2+cvs${SRCDATE}" +OPIE_CVS_PV ?= "1.2.2+cvs${SRCDATE}" DEPENDS_prepend = "${@["libopie2 ", ""][(bb.data.getVar('PN', d, 1) == 'libopie2')]}" -FILES_${PN}-dbg += " ${palmtopdir}/lib/.debug \ - ${palmtopdir}/bin/.debug \ - ${palmtopdir}/plugins/*/.debug " - # to be consistent, put all targets into workdir # NOTE: leave one space at the end, other files are expecting that -EXTRA_QMAKEVARS_POST += "DESTDIR=${S} " +EXTRA_QMAKEVARS_POST += " DESTDIR=${S} " +EXTRA_QMAKEVARS_POST += " DEFINES+=OPIE_BINDIR='\"${bindir}\"' DEFINES+=OPIE_LIBDIR='\"${libdir}/opie/lib\"' DEFINES+=OPIE_QTDIR='\"${libdir}/opie\"' " # Opie standard TAG value TAG = "${@'v' + bb.data.getVar('PV',d,1).replace('.', '_')}" @@ -83,7 +80,8 @@ python opie_do_opie_install() { S = bb.data.getVar( "S", d, 1 ) D = "%s/image" % bb.data.getVar( "WORKDIR", d, True ) WORKDIR = bb.data.getVar( "WORKDIR", d, True ) - palmtopdir = bb.data.getVar( "palmtopdir", d ) + palmtopdir = bb.data.getVar( "palmtopdir", d, True ) + gnubindir = bb.data.getVar( "bindir", d, True ) APPDESKTOP = bb.data.getVar( "APPDESKTOP", d, True ) or "%s/%s" % ( WORKDIR, desktopdir ) if desktopdir is not None: @@ -93,11 +91,12 @@ python opie_do_opie_install() { os.system( "install -d %s%s%s/" % ( D, palmtopdir, bindir ) ) if APPTYPE == "binary": - os.system( "install -m 0755 %s/%s %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) + os.system( "install -d %s%s/" % ( D, gnubindir ) ) + os.system( "install -m 0755 %s/%s %s%s/" % ( S, APPNAME, D, gnubindir ) ) elif APPTYPE == "quicklaunch": os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) - os.system( "install -d %s%s/bin/" % ( D, palmtopdir ) ) - os.system( "ln -sf %s/bin/quicklauncher %s%s/bin/%s" % ( palmtopdir, D, palmtopdir, APPNAME ) ) + os.system( "install -d %s%s/" % ( D, gnubindir ) ) + os.system( "ln -sf %s/quicklauncher %s%s/%s" % ( gnubindir, D, gnubindir, APPNAME ) ) elif APPTYPE == "plugin": os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) } diff --git a/classes/oplinux-mirrors.bbclass b/classes/oplinux-mirrors.bbclass new file mode 100644 index 0000000000..076cd6f1fe --- /dev/null +++ b/classes/oplinux-mirrors.bbclass @@ -0,0 +1,14 @@ +# Copyright (C) 2007, Stelios Koroneos - Digital OPSiS, All Rights Reserved +# Released under the MIT license (see packages/COPYING) + +MIRRORS_append () { +ftp://.*/.*/ http://digital-opsis.com/oplinux/stable/sources/ +http://.*/.*/ http://digital-opsis.com/oplinux/stable/sources/ +ftp://.*/.*/ http://digital-opsis.com/oplinux/unstable/sources/ +http://.*/.*/ http://digital-opsis.com/oplinux/unstable/sources/ + +ftp://.*/.*/ http://digital-opsis.com/oplinux-uclibc/stable/sources/ +http://.*/.*/ http://digital-opsis.com/oplinux-uclibc/stable/sources/ +ftp://.*/.*/ http://digital-opsis.com/oplinux-uclibc/unstable/sources/ +http://.*/.*/ http://digital-opsis.com/oplinux-uclibc/unstable/sources/ +} diff --git a/classes/own-mirrors.bbclass b/classes/own-mirrors.bbclass new file mode 100644 index 0000000000..32763ed24f --- /dev/null +++ b/classes/own-mirrors.bbclass @@ -0,0 +1,4 @@ +PREMIRRORS() { +http://.*/.* ${SOURCE_MIRROR_URL} +ftp://.*/.* ${SOURCE_MIRROR_URL} +} diff --git a/classes/package.bbclass b/classes/package.bbclass index 07fdb7f890..e044395347 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -116,8 +116,23 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst bb.data.setVar('PACKAGES', ' '.join(packages), d) -PACKAGE_DEPENDS ?= "file-native fakeroot-native" -DEPENDS_prepend =+ "${PACKAGE_DEPENDS} " +PACKAGE_DEPENDS += "file-native" + +python () { + import bb + + if bb.data.getVar('PACKAGES', d, True) != '': + deps = bb.data.getVarFlag('do_package', 'depends', d) or "" + for dep in (bb.data.getVar('PACKAGE_DEPENDS', d, True) or "").split(): + deps += " %s:do_populate_staging" % dep + bb.data.setVarFlag('do_package', 'depends', deps, d) + + deps = bb.data.getVarFlag('do_package_write', 'depends', d) or "" + for dep in (bb.data.getVar('PACKAGE_EXTRA_DEPENDS', d, True) or "").split(): + deps += " %s:do_populate_staging" % dep + bb.data.setVarFlag('do_package_write', 'depends', deps, d) +} + # file(1) output to match to consider a file an unstripped executable FILE_UNSTRIPPED_MATCH ?= "not stripped" #FIXME: this should be "" when any errors are gone! @@ -126,7 +141,7 @@ IGNORE_STRIP_ERRORS ?= "1" runstrip() { # Function to strip a single file, called from RUNSTRIP in populate_packages below # A working 'file' (one which works on the target architecture) - # is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS + # is necessary for this stuff to work, hence the addition to do_package[depends] local ro st @@ -573,6 +588,7 @@ python package_do_shlibs() { bb.mkdirhier(shlibs_dir) needed = {} + private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1) for pkg in packages.split(): needs_ldconfig = False bb.debug(2, "calculating shlib provides for %s" % pkg) @@ -596,7 +612,9 @@ python package_do_shlibs() { needed[pkg].append(m.group(1)) m = re.match("\s+SONAME\s+([^\s]*)", l) if m and not m.group(1) in sonames: - sonames.append(m.group(1)) + # if library is private (only used by package) then do not build shlib for it + if not private_libs or -1 == private_libs.find(m.group(1)): + sonames.append(m.group(1)) if m and libdir_re.match(root): needs_ldconfig = True shlibs_file = os.path.join(shlibs_dir, pkg + ".list") diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index 9697426d5d..9a8db4f8f2 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -1,5 +1,11 @@ +# +# Copyright 2006-2007 OpenedHand Ltd. +# + inherit package -DEPENDS_prepend="${@["dpkg-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" + +PACKAGE_EXTRA_DEPENDS += "dpkg-native fakeroot-native" + BOOTSTRAP_EXTRA_RDEPENDS += "dpkg" DISTRO_EXTRA_RDEPENDS += "dpkg" PACKAGE_WRITE_FUNCS += "do_package_deb" @@ -130,6 +136,7 @@ python do_package_deb () { continue controldir = os.path.join(root, 'DEBIAN') bb.mkdirhier(controldir) + os.chmod(controldir, 0755) try: ctrlfile = file(os.path.join(controldir, 'control'), 'wb') # import codecs @@ -138,13 +145,17 @@ python do_package_deb () { raise bb.build.FuncFailed("unable to open control file for writing.") fields = [] - fields.append(["Version: %s-%s\n", ['PV', 'PR']]) + pe = bb.data.getVar('PE', d, 1) + if pe and int(pe) > 0: + fields.append(["Version: %s:%s-%s\n", ['PE', 'PV', 'PR']]) + else: + fields.append(["Version: %s-%s\n", ['PV', 'PR']]) fields.append(["Description: %s\n", ['DESCRIPTION']]) fields.append(["Section: %s\n", ['SECTION']]) fields.append(["Priority: %s\n", ['PRIORITY']]) fields.append(["Maintainer: %s\n", ['MAINTAINER']]) fields.append(["Architecture: %s\n", ['TARGET_ARCH']]) - fields.append(["OE: %s\n", ['P']]) + fields.append(["OE: %s\n", ['PN']]) fields.append(["Homepage: %s\n", ['HOMEPAGE']]) # Package, Version, Maintainer, Description - mandatory @@ -205,6 +216,7 @@ python do_package_deb () { scriptfile = file(os.path.join(controldir, script), 'w') except OSError: raise bb.build.FuncFailed("unable to open %s script file for writing." % script) + scriptfile.write("#!/bin/sh\n") scriptfile.write(scriptvar) scriptfile.close() os.chmod(os.path.join(controldir, script), 0755) diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index 70bcdf6b7f..b5cc6af3bb 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -1,5 +1,7 @@ inherit package -DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" + +PACKAGE_EXTRA_DEPENDS += "ipkg-utils-native fakeroot-native" + BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg" PACKAGE_WRITE_FUNCS += "do_package_ipk" IMAGE_PKGTYPE ?= "ipk" @@ -142,7 +144,11 @@ python do_package_ipk () { raise bb.build.FuncFailed("unable to open control file for writing.") fields = [] - fields.append(["Version: %s-%s\n", ['PV', 'PR']]) + pe = bb.data.getVar('PE', d, 1) + if pe and int(pe) > 0: + fields.append(["Version: %s:%s-%s\n", ['PE', 'PV', 'PR']]) + else: + fields.append(["Version: %s-%s\n", ['PV', 'PR']]) fields.append(["Description: %s\n", ['DESCRIPTION']]) fields.append(["Section: %s\n", ['SECTION']]) fields.append(["Priority: %s\n", ['PRIORITY']]) diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass index b048b08ebe..e94e763150 100644 --- a/classes/package_tar.bbclass +++ b/classes/package_tar.bbclass @@ -1,5 +1,7 @@ inherit package +PACKAGE_EXTRA_DEPENDS += "tar-native" + PACKAGE_WRITE_FUNCS += "do_package_tar" IMAGE_PKGTYPE ?= "tar" diff --git a/classes/palmtop.bbclass b/classes/palmtop.bbclass index b4bd21ab25..fa25d598e9 100644 --- a/classes/palmtop.bbclass +++ b/classes/palmtop.bbclass @@ -16,5 +16,10 @@ EXTRA_QMAKEVARS_POST += "DEFINES+=QWS CONFIG+=qt ${CPP_SUPPORT_LIB}" EXTRA_QMAKEVARS_POST += '${@base_conditional("PALMTOP_USE_MULTITHREADED_QT", "yes", "CONFIG+=thread", "CONFIG-=thread",d)}' EXTRA_QMAKEVARS_POST += "${@["LIBS+=-lqpe ", ""][(bb.data.getVar('PN', d, 1) == 'libqpe-opie')]}" DEPENDS_prepend = "${@["virtual/libqpe1 uicmoc-native ", ""][(bb.data.getVar('PN', d, 1) == 'libqpe-opie')]}" +QT_LIBRARY = '${@base_conditional("PALMTOP_USE_MULTITHREADED_QT", "yes", "qte-mt", "qte", d)}' -FILES_${PN} = "${palmtopdir}" +PACKAGES = "${PN}-dbg ${PN}-dev ${PN} ${PN}-doc ${PN}-locale" +FILES_${PN} += " ${palmtopdir} " +FILES_${PN}-dbg += " ${palmtopdir}/lib/.debug \ + ${palmtopdir}/bin/.debug \ + ${palmtopdir}/plugins/*/.debug " diff --git a/classes/patch.bbclass b/classes/patch.bbclass index 0a7b94cffc..0cc202820f 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -1,12 +1,25 @@ # Copyright (C) 2006 OpenedHand LTD +# Point to an empty file so any user's custom settings don't break things +QUILTRCFILE ?= "${STAGING_BINDIR_NATIVE}/quiltrc" + def patch_init(d): import os, sys + class NotFoundError(Exception): + def __init__(self, path): + self.path = path + def __str__(self): + return "Error: %s not found." % self.path + def md5sum(fname): import md5, sys - f = file(fname, 'rb') + try: + f = file(fname, 'rb') + except IOError: + raise NotFoundError(fname) + m = md5.new() while True: d = f.read(8096) @@ -24,11 +37,6 @@ def patch_init(d): def __str__(self): return "Command Error: exit status: %d Output:\n%s" % (self.status, self.output) - class NotFoundError(Exception): - def __init__(self, path): - self.path = path - def __str__(self): - return "Error: %s not found." % self.path def runcmd(args, dir = None): import commands @@ -123,11 +131,14 @@ def patch_init(d): i = 0 self.patches.insert(i, patch) - def _applypatch(self, patch, force = None, reverse = None): + def _applypatch(self, patch, force = False, reverse = False, run = True): shellcmd = ["cat", patch['file'], "|", "patch", "-p", patch['strippath']] if reverse: shellcmd.append('-R') + if not run: + return "sh" + "-c" + " ".join(shellcmd) + if not force: shellcmd.append('--dry-run') @@ -140,7 +151,7 @@ def patch_init(d): output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) return output - def Push(self, force = None, all = None): + def Push(self, force = False, all = False, run = True): bb.note("self._current is %s" % self._current) bb.note("patches is %s" % self.patches) if all: @@ -157,7 +168,7 @@ def patch_init(d): else: self._current = 0 bb.note("applying patch %s" % self.patches[self._current]) - self._applypatch(self.patches[self._current], force) + return self._applypatch(self.patches[self._current], force) def Pop(self, force = None, all = None): @@ -171,8 +182,11 @@ def patch_init(d): """""" class QuiltTree(PatchSet): - def _runcmd(self, args): - runcmd(["quilt"] + args, self.dir) + def _runcmd(self, args, run = True): + quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1) + if not run: + return ["quilt"] + ["--quiltrc"] + [quiltrc] + args + runcmd(["quilt"] + ["--quiltrc"] + [quiltrc] + args, self.dir) def _quiltpatchpath(self, file): return os.path.join(self.dir, "patches", os.path.basename(file)) @@ -246,7 +260,7 @@ def patch_init(d): self.patches.insert(self._current or 0, patch) - def Push(self, force = None, all = None): + def Push(self, force = False, all = False, run = True): # quilt push [-f] args = ["push"] @@ -254,6 +268,8 @@ def patch_init(d): args.append("-f") if all: args.append("-a") + if not run: + return self._runcmd(args, run) self._runcmd(args) @@ -340,16 +356,34 @@ def patch_init(d): olddir = os.path.abspath(os.curdir) os.chdir(self.patchset.dir) - try: - self.patchset.Push(True) - except CmdError, v: - # Patch application failed - if sys.exc_value.output.strip() == "No patches applied": - return - print(sys.exc_value) - print('NOTE: dropping user into a shell, so that patch rejects can be fixed manually.') - - os.system('/bin/sh') + try: + self.patchset.Push(False) + except CmdError, v: + # Patch application failed + patchcmd = self.patchset.Push(True, False, False) + + t = bb.data.getVar('T', d, 1) + if not t: + bb.msg.fatal(bb.msg.domain.Build, "T not set") + bb.mkdirhier(t) + import random + rcfile = "%s/bashrc.%s.%s" % (t, str(os.getpid()), random.random()) + f = open(rcfile, "w") + f.write("echo '*** Manual patch resolution mode ***'\n") + f.write("echo 'Dropping to a shell, so patch rejects can be fixed manually.'\n") + f.write("echo 'Run \"quilt refresh\" when patch is corrected, press CTRL+D to exit.'\n") + f.write("echo ''\n") + f.write(" ".join(patchcmd) + "\n") + f.write("#" + bb.data.getVar('TERMCMDRUN', d, 1)) + f.close() + os.chmod(rcfile, 0775) + + os.environ['TERMWINDOWTITLE'] = "Bitbake: Please fix patch rejects manually" + os.environ['TERMRCFILE'] = rcfile + rc = os.system(bb.data.getVar('TERMCMDRUN', d, 1)) + if os.WIFEXITED(rc) and os.WEXITSTATUS(rc) != 0: + bb.msg.fatal(bb.msg.domain.Build, ("Cannot proceed with manual patch resolution - '%s' not found. " \ + + "Check TERMCMDRUN variable.") % bb.data.getVar('TERMCMDRUN', d, 1)) # Construct a new PatchSet after the user's changes, compare the # sets, checking patches for modifications, and doing a remote @@ -390,6 +424,17 @@ def patch_init(d): addtask patch after do_unpack do_patch[dirs] = "${WORKDIR}" + +python () { + import bb + # do_patch tasks require PATCHTOOL-native to have staged + patchdeps = bb.data.getVar("PATCHTOOL", d, True) + if patchdeps: + patchdeps = "%s-native" % patchdeps + if not patchdeps in bb.data.getVar("PROVIDES", d, True): + bb.data.setVarFlag('do_patch', 'depends', patchdeps + ":do_populate_staging", d) +} + python patch_do_patch() { import re import bb.fetch @@ -451,38 +496,40 @@ python patch_do_patch() { 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 "mindate" in parm or "maxdate" in parm: + 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 srcdate == "now": + srcdate = bb.data.getVar('DATE', d, 1) - if (maxdate < srcdate) or (mindate > srcdate): - if (maxdate < srcdate): + if "maxdate" in parm and parm["maxdate"] < srcdate: bb.note("Patch '%s' is outdated" % pname) + continue - if (mindate > srcdate): + if "mindate" in parm and parm["mindate"] > srcdate: bb.note("Patch '%s' is predated" % pname) + continue - continue + + if "minrev" in parm: + srcrev = bb.data.getVar('SRCREV', d, 1) + if srcrev and srcrev < parm["minrev"]: + bb.note("Patch '%s' applies to later revisions" % pname) + continue + + if "maxrev" in parm: + srcrev = bb.data.getVar('SRCREV', d, 1) + if srcrev and srcrev > parm["maxrev"]: + bb.note("Patch '%s' applies to earlier revisions" % pname) + continue bb.note("Applying patch '%s'" % pname) try: patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True) - except NotFoundError: + except: import sys raise bb.build.FuncFailed(str(sys.exc_value)) resolver.Resolve() diff --git a/classes/pkgconfig.bbclass b/classes/pkgconfig.bbclass index f2054b0b07..3256977517 100644 --- a/classes/pkgconfig.bbclass +++ b/classes/pkgconfig.bbclass @@ -17,12 +17,21 @@ def get_pkgconfig_mangle(d): s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'" s += " -e 's:OEPREFIX:${STAGING_LIBDIR}/..:'" s += " -e 's:OEEXECPREFIX:${STAGING_LIBDIR}/..:'" + s += " -e 's:-L${WORKDIR}\S*: :g'" + s += " -e 's:-I${WORKDIR}\S*: :g'" + return s +do_install_append () { + for pc in `find ${D} -name '*.pc' -type f | grep -v -- '-uninstalled.pc$'`; do + sed -i ${@get_pkgconfig_mangle(d)} -e 's:${D}::g' ${pc} + done +} + do_stage_append () { for pc in `find ${S} -name '*.pc' -type f | grep -v -- '-uninstalled.pc$'`; do pcname=`basename $pc` install -d ${PKG_CONFIG_PATH} - cat $pc | sed ${@get_pkgconfig_mangle(d)} > ${PKG_CONFIG_PATH}/$pcname + cat $pc | sed ${@get_pkgconfig_mangle(d)} -e 's:${D}${libdir}\S*:${STAGING_LIBDIR}:g' -e 's:${D}${prefix}/include\S*:${STAGING_INCDIR}:g' > ${PKG_CONFIG_PATH}/$pcname done } diff --git a/classes/qmake-base.bbclass b/classes/qmake-base.bbclass index 09694e97b8..b623b34aaa 100644 --- a/classes/qmake-base.bbclass +++ b/classes/qmake-base.bbclass @@ -13,7 +13,7 @@ export OE_QMAKE_CXXFLAGS="-fno-exceptions -fno-rtti ${CXXFLAGS}" export OE_QMAKE_LDFLAGS="${LDFLAGS}" export OE_QMAKE_LINK="${CCLD}" export OE_QMAKE_AR="${AR}" -export OE_QMAKE_STRIP="${STRIP}" +export OE_QMAKE_STRIP="echo" export OE_QMAKE_UIC="${STAGING_BINDIR_NATIVE}/uic" export OE_QMAKE_MOC="${STAGING_BINDIR_NATIVE}/moc" export OE_QMAKE_RCC="non-existant" diff --git a/classes/qpf.bbclass b/classes/qpf.bbclass index d6e58871d5..67761bd4be 100644 --- a/classes/qpf.bbclass +++ b/classes/qpf.bbclass @@ -9,15 +9,11 @@ do_compile() { } pkg_postinst_fonts() { -#!/bin/sh -set -e . /etc/profile ${sbindir}/update-qtfontdir } pkg_postrm_fonts() { -#!/bin/sh -set -e . /etc/profile ${sbindir}/update-qtfontdir -f } diff --git a/classes/qt4x11.bbclass b/classes/qt4x11.bbclass index cb836cc362..7046ef1cb9 100644 --- a/classes/qt4x11.bbclass +++ b/classes/qt4x11.bbclass @@ -6,6 +6,7 @@ DEPENDS_prepend = "${@["qt4x11 ", ""][(bb.data.getVar('PN', d, 1) == 'qt4-x11-fr export QTDIR = "${STAGING_DIR}/${HOST_SYS}/qt4" export QMAKESPEC = "${QTDIR}/mkspecs/${TARGET_OS}-oe-g++" export OE_QMAKE_UIC = "${STAGING_BINDIR_NATIVE}/uic4" +export OE_QMAKE_UIC3 = "${STAGING_BINDIR_NATIVE}/uic34" export OE_QMAKE_MOC = "${STAGING_BINDIR_NATIVE}/moc4" export OE_QMAKE_RCC = "${STAGING_BINDIR_NATIVE}/rcc4" export OE_QMAKE_QMAKE = "${STAGING_BINDIR_NATIVE}/qmake2" diff --git a/classes/rm_work.bbclass b/classes/rm_work.bbclass index 1b87004143..e3c92b8572 100644 --- a/classes/rm_work.bbclass +++ b/classes/rm_work.bbclass @@ -18,5 +18,12 @@ do_rm_work () { done } +addtask rmall after do_rm_work +do_rmall[recrdeptask] = "do_rm_work" +do_rmall() { + : +} + + addtask rm_work before do_build addtask rm_work after do_populate_staging diff --git a/classes/rootfs_deb.bbclass b/classes/rootfs_deb.bbclass index 59909d6852..67fa661308 100644 --- a/classes/rootfs_deb.bbclass +++ b/classes/rootfs_deb.bbclass @@ -1,5 +1,8 @@ -DEPENDS_prepend = "dpkg-native apt-native fakeroot-native " -DEPENDS_append = " ${EXTRA_IMAGEDEPENDS}" +# +# Copyright 2006-2007 Openedhand Ltd. +# + +do_rootfs[depends] += "dpkg-native:do_populate_staging apt-native:do_populate_staging" fakeroot rootfs_deb_do_rootfs () { set +e @@ -52,21 +55,21 @@ fakeroot rootfs_deb_do_rootfs () { } if [ ! -z "${LINGUAS_INSTALL}" ]; then - apt-get install glibc-localedata-i18n - if [ $? -eq 1 ]; then - exit 1 + apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated + if [ $? -ne 0 ]; then + exit $? fi for i in ${LINGUAS_INSTALL}; do - apt-get install $i - if [ $? -eq 1 ]; then - exit 1 + apt-get install $i --force-yes --allow-unauthenticated + if [ $? -ne 0 ]; then + exit $? fi done fi if [ ! -z "${PACKAGE_INSTALL}" ]; then for i in ${PACKAGE_INSTALL}; do - apt-get install $i + apt-get install $i --force-yes --allow-unauthenticated if [ $? -eq 1 ]; then exit 1 fi @@ -134,3 +137,7 @@ rootfs_deb_log_check() { true } +remove_packaging_data_files() { + rm -rf ${IMAGE_ROOTFS}/usr/lib/ipkg/ + rm -rf ${IMAGE_ROOTFS}/usr/dpkg/ +} diff --git a/classes/rootfs_ipk.bbclass b/classes/rootfs_ipk.bbclass index fdd42ee429..75c85e8f3d 100644 --- a/classes/rootfs_ipk.bbclass +++ b/classes/rootfs_ipk.bbclass @@ -5,13 +5,12 @@ # See image.bbclass for a usage of this. # -DEPENDS_prepend="ipkg-native ipkg-utils-native fakeroot-native " -DEPENDS_append=" ${EXTRA_IMAGEDEPENDS}" -RDEPENDS += "ipkg ipkg-collateral" +do_rootfs[depends] += "ipkg-native:do_populate_staging ipkg-utils-native:do_populate_staging" -IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}" +IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS} ${@base_conditional("PACKAGE_INSTALL_NO_DEPS", "1", "-nodeps", "", d)}" -PACKAGE_INSTALL += "ipkg ipkg-collateral" +DISTRO_EXTRA_RDEPENDS += " ipkg ipkg-collateral " +PACKAGE_INSTALL_NO_DEPS ?= "0" rootfs_ipk_do_indexes () { set -x diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index 958ab91fa6..016b0d500b 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -49,6 +49,9 @@ def check_sanity(e): print "Foo %s" % minversion return + if 0 == os.getuid(): + raise_sanity_error("Do not use Bitbake as root.") + messages = "" if (LooseVersion(__version__) < LooseVersion(minversion)): @@ -86,7 +89,7 @@ def check_sanity(e): if not check_app_exists('${BUILD_PREFIX}g++', e.data): missing = missing + "C++ Compiler (${BUILD_PREFIX}g++)," - required_utilities = "patch diffstat texi2html makeinfo cvs svn git bzip2 tar gzip gawk" + required_utilities = "patch help2man diffstat texi2html makeinfo cvs svn git bzip2 tar gzip gawk md5sum bison" for util in required_utilities.split(): if not check_app_exists( util, e.data ): @@ -108,6 +111,16 @@ python check_sanity_eventhandler() { from bb import note, error, data, __version__ from bb.event import getName + try: + from distutils.version import LooseVersion + except ImportError: + def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1 + + if (LooseVersion(bb.__version__) > LooseVersion("1.8.6")): + if getName(e) == "ConfigParsed": + check_sanity(e) + return NotHandled + if getName(e) == "BuildStarted": check_sanity(e) diff --git a/classes/sdk.bbclass b/classes/sdk.bbclass index bcabbc79bd..0050b2e48e 100644 --- a/classes/sdk.bbclass +++ b/classes/sdk.bbclass @@ -2,8 +2,10 @@ # or indirectly via dependency. No need to be in 'world'. EXCLUDE_FROM_WORLD = "1" -SDK_NAME = "${TARGET_ARCH}/oe" -PACKAGE_ARCH = "${BUILD_ARCH}" +SDK_NAME = "${DISTRO}/${TARGET_ARCH}" + +OLD_PACKAGE_ARCH := ${PACKAGE_ARCH} +PACKAGE_ARCH = "${BUILD_ARCH}-${OLD_PACKAGE_ARCH}-sdk" HOST_ARCH = "${BUILD_ARCH}" HOST_VENDOR = "${BUILD_VENDOR}" @@ -21,6 +23,26 @@ exec_prefix = "${prefix}" base_prefix = "${exec_prefix}" FILES_${PN} = "${prefix}" - - - +FILES_${PN}-dbg += "${prefix}/bin/.debug \ + ${prefix}/sbin/.debug \ + " + +sdk_ipk_do_indexes () { + set -x + + ipkgarchs="${PACKAGE_ARCHS}" + + if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then + touch ${DEPLOY_DIR_IPK}/Packages + ipkg-make-index -r ${DEPLOY_DIR_IPK}/Packages -p ${DEPLOY_DIR_IPK}/Packages -l ${DEPLOY_DIR_IPK}/Packages.filelist -m ${DEPLOY_DIR_IPK} + fi + + for arch in $ipkgarchs; do + if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then + if [ -e ${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk/ ] ; then + touch ${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk/Packages + ipkg-make-index -r ${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk/Packages -p ${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk/Packages -l ${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk/Packages.filelist -m ${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk/ + fi + fi + done +} diff --git a/classes/seppuku.bbclass b/classes/seppuku.bbclass index 5757df7efb..a3b8b36dd0 100644 --- a/classes/seppuku.bbclass +++ b/classes/seppuku.bbclass @@ -5,6 +5,25 @@ # This class requires python2.4 because of the urllib2 usage # +def seppuku_spliturl(url): + """ + Split GET URL to return the host base and the query + as a param dictionary + """ + import urllib + (uri,query) = urllib.splitquery(url) + param = {} + for par in query.split("&"): + (key,value) = urllib.splitvalue(par) + if not key or len(key) == 0 or not value: + continue + key = urllib.unquote(key) + value = urllib.unquote(value) + param[key] = value + + return (uri,param) + + def seppuku_login(opener, login, user, password): """ @@ -13,7 +32,7 @@ def seppuku_login(opener, login, user, password): the resulting page then @param opened = cookie enabled urllib2 opener - @param login = http://bugzilla.openmoko.org/cgi-bin/bugzilla/query.cgi? + @param login = http://bugs.openembedded.org/query.cgi? @param user = Your username @param password = Your password """ @@ -48,10 +67,13 @@ def seppuku_find_bug_report_old(): HTMLParser.__init__(self) self.state = self.STATE_NONE self.bugs = [] + self.bug = None def handle_starttag(self, tag, attr): if self.state == self.STATE_NONE and tag.lower() == "tr": - if len(attr) == 1 and attr[0] == ('class', 'bz_normal bz_P2 '): + if len(attr) == 1 and attr[0][0] == 'class' and \ + ('bz_normal' in attr[0][1] or 'bz_blocker' in attr[0][1] or 'bz_enhancement' in attr[0][1] or 'bz_major' in attr[0][1] or 'bz_minor' in attr[0][1] or 'bz_trivial' in attr[0][1] or 'bz_critical' in attr[0][1] or 'bz_wishlist' in attr[0][1]) \ + and 'bz_P' in attr[0][1]: self.state = self.STATE_FOUND_TR elif self.state == self.STATE_FOUND_TR and tag.lower() == "td": self.state += 1 @@ -61,6 +83,7 @@ def seppuku_find_bug_report_old(): if self.state != self.STATE_NONE: self.bugs.append( (self.bug,self.status) ) self.state = self.STATE_NONE + self.bug = None if self.state > 1 and tag.lower() == "td": self.state += 1 @@ -72,7 +95,11 @@ def seppuku_find_bug_report_old(): return if self.state == self.STATE_FOUND_NUMBER: - self.bug = data + """ + #1995 in bugs.oe.org has [SEC] additionally to the number and we want to ignore it + """ + if not self.bug: + self.bug = data elif self.state == self.STATE_FOUND_STATUS: self.status = data @@ -83,20 +110,25 @@ def seppuku_find_bug_report_old(): -def seppuku_find_bug_report(opener, query, product, component, bugname): +def seppuku_find_bug_report(debug_file, opener, query, product, component, bugname): """ Find a bug report with the sane name and return the bug id and the status. @param opener = urllib2 opener - @param query = e.g. https://bugzilla.openmoko.org/cgi-bin/bugzilla/query.cgi? + @param query = e.g. http://bugs.openembedded.org/query.cgi? @param product = search for this product @param component = search for this component @param bugname = the bug to search for - https://bugzilla.openmoko.org/cgi-bin/bugzilla/buglist.cgi?short_desc_type=substring&short_desc=manual+test+bug&product=OpenMoko&emailreporter2=1&emailtype2=substring&email2=freyther%40yahoo.com + http://bugs.openembedded.org/buglist.cgi?short_desc_type=substring&short_desc=manual+test+bug&product=Openembedded&emailreporter2=1&emailtype2=substring&email2=freyther%40yahoo.com but it does not support ctype=csv... """ + import urllib + product = urllib.quote(product) + component = urllib.quote(component) + bugname = urllib.quote(bugname) + result = opener.open("%(query)s?product=%(product)s&component=%(component)s&short_desc_type=substring&short_desc=%(bugname)s" % vars()) if result.code != 200: raise "Can not query the bugzilla at all" @@ -104,41 +136,58 @@ def seppuku_find_bug_report(opener, query, product, component, bugname): scanner = seppuku_find_bug_report_old() scanner.feed(txt) if len(scanner.result()) == 0: + print >> debug_file, "Scanner failed to scan the html site" + print >> debug_file, "%(query)s?product=%(product)s&component=%(component)s&short_desc_type=substring&short_desc=%(bugname)s" % vars() + print >> debug_file, txt return (False,None) else: # silently pick the first result + print >> debug_file, "Result of bug search is " + print >> debug_file, txt (number,status) = scanner.result()[0] return (not status in ["CLOS", "RESO", "VERI"],number) -def seppuku_reopen_bug(opener, file, product, component, bug_number, bugname, text): +def seppuku_reopen_bug(poster, file, product, component, bug_number, bugname, text): """ Reopen a bug report and append to the comment Same as with opening a new report, some bits need to be inside the url - http://bugzilla.openmoko.org/cgi-bin/bugzilla/process_bug.cgi?id=239&bug_file_loc=http%3A%2F%2F&version=2007&longdesclength=2&product=OpenMoko&component=autobuilds&comment=bla&priority=P2&bug_severity=normal&op_sys=Linux&rep_platform=Neo1973&knob=reopen&target_milestone=Phase+0&short_desc=foo + http://bugs.openembedded.org/process_bug.cgi?id=239&bug_file_loc=http%3A%2F%2F&version=Angstrom&longdesclength=2&product=Openembedded&component=Build&comment=bla&priority=P2&bug_severity=normal&op_sys=Linux&rep_platform=Other&knob=reopen&short_desc=foo """ - import urllib, urllib2 - param = urllib.urlencode( { "product" : product, "component" : component, "longdesclength" : 2, - "short_desc" : bugname, "knob" : "reopen", "id" : bug_number, "comment" : text } ) + import urllib2 + (uri, param) = seppuku_spliturl( file ) + + # Prepare the post + param["product"] = product + param["component"] = component + param["longdesclength"] = 2 + param["short_desc"] = bugname + param["knob"] = "reopen" + param["id"] = bug_number + param["comment"] = text + try: - result = opener.open( file + param ) + result = poster.open( uri, param ) except urllib2.HTTPError, e: print e.geturl() print e.info() return False + except Exception, e: + print e + return False if result.code != 200: return False else: return True -def seppuku_file_bug(opener, file, product, component, bugname, text): +def seppuku_file_bug(poster, file, product, component, bugname, text): """ Create a completely new bug report - http://bugzilla.openmoko.org/cgi-bin/bugzilla/post_bug.cgi?bug_file_loc=http%3A%2F%2F&version=2007&product=OpenMoko&component=autobuilds&short_desc=foo&comment=bla&priority=P2&bug_severity=normal&op_sys=Linux&rep_platform=Neo1973 + http://bugs.openembedded.org/post_bug.cgi?bug_file_loc=http%3A%2F%2F&version=Angstrom&product=Openembedded&component=Build&short_desc=foo&comment=bla&priority=P2&bug_severity=normal&op_sys=Linux&rep_platform=Other You are forced to add some default values to the bugzilla query and stop with '&' @@ -150,23 +199,64 @@ def seppuku_file_bug(opener, file, product, component, bugname, text): @param text Text """ - import urllib,urllib2 - param = urllib.urlencode( { "product" : product, "component" : component, "short_desc" : bugname, "comment" : text } ) + import urllib2 + (uri, param) = seppuku_spliturl( file ) + param["product"] = product + param["component"] = component + param["short_desc"] = bugname + param["comment"] = text + try: - result = opener.open( file + param ) + result = poster.open( uri, param ) except urllib2.HTTPError, e: print e.geturl() print e.info() - raise e + return False + except Exception, e: + print e return False + # scan the result for a bug number + # it will look like + # '<a href="show_bug.cgi?id=308">Back To BUG# 308</a>' + import re + res = re.findall(("\>Back To BUG\# (?P<int>\d+)\</a\>"), result.read() ) + if result.code != 200 or len(res) != 1: + return None + else: + return res[0] + +def seppuku_create_attachment(debug, poster, attach_query, product, component, bug_number, text, file): + """ + + Create a new attachment for the failed report + """ + + if not bug_number: + import bb + bb.note("Can't create an attachment, the bug is not present") + return False + + import urllib2 + param = { "bugid" : bug_number, "action" : "insert", "data" : file, "description" : "Build log", "ispatch" : "0", "contenttypemethod" : "list", "contenttypeselection" : "text/plain", "comment" : text } + + try: + result = poster.open( attach_query, param ) + except urllib2.HTTPError, e: + print e.geturl() + print e.info() + return False + except Exception, e: + print e + return False + + print >> debug, result.read() if result.code != 200: return False else: return True - addhandler seppuku_eventhandler python seppuku_eventhandler() { """ @@ -177,7 +267,12 @@ python seppuku_eventhandler() { from bb import data, mkdirhier, build import bb, os, glob - bb.note( "Ran" ) + # Try to load our exotic libraries + try: + import MultipartPostHandler + except: + bb.note("You need to put the MultipartPostHandler into your PYTHONPATH. Download it from http://pipe.scs.fsu.edu/PostHandler/MultipartPostHandler.py") + return NotHandled try: import urllib2, cookielib @@ -194,50 +289,73 @@ python seppuku_eventhandler() { elif name == "TaskFailed" or name == "NoProvider": cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) + poster = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj),MultipartPostHandler.MultipartPostHandler) login = bb.data.getVar("SEPPUKU_LOGIN", data, True) query = bb.data.getVar("SEPPUKU_QUERY", data, True) newbug = bb.data.getVar("SEPPUKU_NEWREPORT", data, True) reopen = bb.data.getVar("SEPPUKU_ADDCOMMENT", data, True) + attach = bb.data.getVar("SEPPUKU_ATTACHMENT", data, True) user = bb.data.getVar("SEPPUKU_USER", data, True) passw = bb.data.getVar("SEPPUKU_PASS", data, True) product = bb.data.getVar("SEPPUKU_PRODUCT", data, True) component = bb.data.getVar("SEPPUKU_COMPONENT", data, True) + # evil hack to figure out what is going on + debug_file = open(os.path.join(bb.data.getVar("TMPDIR", data, True),"..","seppuku-log"),"a") if not seppuku_login(opener, login, user, passw): bb.note("Login to bugzilla failed") + print >> debug_file, "Login to bugzilla failed" return NotHandled else: - print "Logged into the box" + print >> debug_file, "Logged into the box" + file = None if name == "TaskFailed": bugname = "%(package)s-%(pv)s-%(pr)s-%(task)s" % { "package" : bb.data.getVar("PN", data, True), "pv" : bb.data.getVar("PV", data, True), "pr" : bb.data.getVar("PR", data, True), "task" : e.task } log_file = glob.glob("%s/log.%s.*" % (bb.data.getVar('T', event.data, True), event.task)) + text = "The package failed to build at %s" % bb.data.getVar('DATETIME', data, True) if len(log_file) != 0: - to_file = bb.data.getVar('TINDER_LOG', event.data, True) - text = "".join(open(log_file[0], 'r').readlines()) + print >> debug_file, "Adding log file %s" % log_file[0] + file = open(log_file[0], 'r') + else: + print >> debug_file, "No log file found for the glob" elif name == "NoProvider": bugname = "noprovider for %s runtime: %s" % (event.getItem, event.getisRuntime) text = "Please fix it" else: + print >> debug_file, "Unknown name '%s'" % name assert False - (bug_open, bug_number) = seppuku_find_bug_report(opener, query, product, component, bugname) - - bb.note("Bug is open: %s and bug number: %s" % (bug_open, bug_number)) + (bug_open, bug_number) = seppuku_find_bug_report(debug_file, opener, query, product, component, bugname) + print >> debug_file, "Bug is open: %s and bug number: %s" % (bug_open, bug_number) # The bug is present and still open, no need to attach an error log if bug_number and bug_open: - bb.note("The bug is known as '%s'" % bug_number) + print >> debug_file, "The bug is known as '%s'" % bug_number return NotHandled if bug_number and not bug_open: - if not seppuku_reopen_bug(opener, reopen, product, component, bug_number, bugname, text): - bb.note("Failed to reopen the bug report") - elif not seppuku_file_bug(opener, newbug, product, component, bugname, text): - bb.note("Filing a bugreport failed") + if not seppuku_reopen_bug(poster, reopen, product, component, bug_number, bugname, text): + print >> debug_file, "Failed to reopen the bug report" + else: + print >> debug_file, "Reopened the bug report" + else: + bug_number = seppuku_file_bug(poster, newbug, product, component, bugname, text) + if not bug_number: + print >> debug_file, "Filing a bugreport failed" + else: + print >> debug_file, "The new bug_number: '%s'" % bug_number + + if file: + if not seppuku_create_attachment(debug_file, poster, attach, product, component, bug_number, text, file): + print >> debug_file, "Failed to attach the build log" + else: + print >> debug_file, "Created an attachment for '%s' '%s' '%s'" % (product, component, bug_number) + else: + print >> debug_file, "Not trying to create an attachment" return NotHandled } diff --git a/classes/siteinfo.bbclass b/classes/siteinfo.bbclass index 80e6e32af7..4191f4edc1 100644 --- a/classes/siteinfo.bbclass +++ b/classes/siteinfo.bbclass @@ -29,6 +29,9 @@ def get_siteinfo_list(d): "arm-linux-gnueabi": "endian-little bit-32 common-glibc arm-common arm-linux",\ "arm-linux-uclibc": "endian-little bit-32 common-uclibc arm-common",\ "arm-linux-uclibcgnueabi": "endian-little bit-32 common-uclibc arm-common arm-linux-uclibc",\ + "avr32-linux": "endian-big bit-32 common-glibc avr32-common",\ + "avr32-linux-uclibc": "endian-big bit-32 common-uclibc avr32-common",\ + "bfin-uclinux-uclibc": "endian-little bit-32 common-uclibc bfin-common",\ "i386-linux": "endian-little bit-32 common-glibc ix86-common",\ "i486-linux": "endian-little bit-32 common-glibc ix86-common",\ "i586-linux": "endian-little bit-32 common-glibc ix86-common",\ @@ -40,9 +43,9 @@ def get_siteinfo_list(d): "mipsel-linux": "endian-little bit-32 common-glibc",\ "mipsel-linux-uclibc": "endian-little bit-32 common-uclibc",\ "powerpc-darwin": "endian-big bit-32 common-darwin",\ - "ppc-linux": "endian-big bit-32 common-glibc",\ - "powerpc-linux": "endian-big bit-32 common-glibc",\ - "powerpc-linux-uclibc": "endian-big bit-32 common-uclibc",\ + "ppc-linux": "endian-big bit-32 common-glibc powerpc-common",\ + "powerpc-linux": "endian-big bit-32 common-glibc powerpc-common",\ + "powerpc-linux-uclibc": "endian-big bit-32 common-uclibc powerpc-common",\ "sh3-linux": "endian-little bit-32 common-glibc sh-common",\ "sh4-linux": "endian-little bit-32 common-glibc sh-common",\ "sh4-linux-uclibc": "endian-little bit-32 common-uclibc sh-common",\ diff --git a/classes/storcenter-image.bbclass b/classes/storcenter-image.bbclass new file mode 100644 index 0000000000..de77f1b417 --- /dev/null +++ b/classes/storcenter-image.bbclass @@ -0,0 +1,30 @@ +storcenter_pack_image() { + # find latest kernel + KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/uImage* | tail -1` + if [ -z "$KERNEL" ]; then + oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Bitbake linux-storcenter to create one." + exit 1 + fi + ROOTFS=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 + OUTPUT=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.flash.img + PADFILE=${DEPLOY_DIR_IMAGE}/padfile.zzz + HEX_MAX_KERN_SIZE=170000 + DEC_MAX_KERN_SIZE=`echo "ibase=16; $HEX_MAX_KERN_SIZE" | bc ` + HEX_MAX_ROOT_SIZE=590000 + DEC_MAX_ROOT_SIZE=`echo "ibase=16; $HEX_MAX_ROOT_SIZE" | bc ` + KERNEL_SIZE=`ls -l $KERNEL | awk '{print $5}'` + if [ $KERNEL_SIZE -gt $DEC_MAX_KERN_SIZE ]; then + oefatal "Kernel too large at $KERNEL_SIZE bytes. Max is $DEC_MAX_KERN_SIZE." + exit 1 + fi + ROOT_SIZE=`ls -l $ROOTFS | awk '{print $5}'` + if [ $ROOT_SIZE -gt $DEC_MAX_ROOT_SIZE ]; then + oefatal "Rootfs is too large at $ROOT_SIZE bytes. Max is $DEC_MAX_ROOT_SIZE." + exit 1 + fi + PAD_SIZE=`echo "$DEC_MAX_KERN_SIZE - $KERNEL_SIZE" | bc ` + dd if=/dev/zero of=$PADFILE bs=$PAD_SIZE count=1 2>>/dev/null + cat $KERNEL $PADFILE $ROOTFS > $OUTPUT + rm -f $PADFILE + ls -l $OUTPUT +} diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index 3f5183cc8f..d1d9f49fac 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -371,6 +371,10 @@ addhandler tinderclient_eventhandler python tinderclient_eventhandler() { from bb import note, error, data from bb.event import NotHandled + + if e.data is None: + return NotHandled + do_tinder_report = data.getVar('TINDER_REPORT', e.data, True) if do_tinder_report and do_tinder_report == "1": tinder_do_tinder_report(e) diff --git a/classes/turbostation-image.bbclass b/classes/turbostation-image.bbclass new file mode 100644 index 0000000000..5a0768c687 --- /dev/null +++ b/classes/turbostation-image.bbclass @@ -0,0 +1,32 @@ +turbostation_pack_image() { + # find latest kernel + KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/uImage* | tail -1` + if [ -z "$KERNEL" ]; then + oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Bitbake linux-turbostation to create one." + exit 1 + fi + ROOTFS=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 + OUTPUT=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.flash.img + PADFILE=${DEPLOY_DIR_IMAGE}/padfile.zzz + HEX_MAX_KERN_SIZE=200000 + DEC_MAX_KERN_SIZE=`echo "ibase=16; $HEX_MAX_KERN_SIZE" | bc ` + HEX_MAX_ROOT_SIZE=D00000 + DEC_MAX_ROOT_SIZE=`echo "ibase=16; $HEX_MAX_ROOT_SIZE" | bc ` + KERNEL_SIZE=`ls -l $KERNEL | awk '{print $5}'` + if [ $KERNEL_SIZE -gt $DEC_MAX_KERN_SIZE ]; then + oefatal "Kernel too large at $KERNEL_SIZE bytes. Max is $DEC_MAX_KERN_SIZE." + exit 1 + fi + ROOT_SIZE=`ls -l $ROOTFS | awk '{print $5}'` + if [ $ROOT_SIZE -gt $DEC_MAX_ROOT_SIZE ]; then + oefatal "Rootfs is too large at $ROOT_SIZE bytes. Max is $DEC_MAX_ROOT_SIZE." + exit 1 + fi + PAD_SIZE=`echo "$DEC_MAX_KERN_SIZE - $KERNEL_SIZE" | bc ` + dd if=/dev/zero of=$PADFILE bs=$PAD_SIZE count=1 2>>/dev/null + cat $KERNEL $PADFILE $ROOTFS > $OUTPUT + rm -f $PADFILE + ls -l $OUTPUT +} + +IMAGE_POSTPROCESS_COMMAND += "turbostation_pack_image; " diff --git a/classes/update-rc.d.bbclass b/classes/update-rc.d.bbclass index 9821eec5b2..3051b7933f 100644 --- a/classes/update-rc.d.bbclass +++ b/classes/update-rc.d.bbclass @@ -7,17 +7,15 @@ INIT_D_DIR = "${sysconfdir}/init.d" updatercd_postinst() { if test "x$D" != "x"; then - D="-r $D" + OPT="-r $D" else - D="-s" + OPT="-s" fi -update-rc.d $D ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} +update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} } updatercd_prerm() { -if test "x$D" != "x"; then - D="-r $D" -else +if test "x$D" = "x"; then ${INIT_D_DIR}/${INITSCRIPT_NAME} stop fi } diff --git a/classes/xfce.bbclass b/classes/xfce.bbclass index 8124dc877c..ecc00825bc 100644 --- a/classes/xfce.bbclass +++ b/classes/xfce.bbclass @@ -6,14 +6,9 @@ HOMEPAGE = "http://www.xfce.org" LICENSE = "LGPL-2" +DEPENDS += "startup-notification" -def xfce_extension(ver): - ext = "gz" - if ver == "4.3.99.2": - ext = "bz2" - return ext - -SRC_URI = "http://www.us.xfce.org/archive/xfce-${PV}/src/${PN}-${PV}.tar.${@xfce_extension("${PV}")}" +SRC_URI = "http://www.us.xfce.org/archive/xfce-${PV}/src/${PN}-${PV}.tar.bz2" inherit autotools |