diff options
author | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2007-10-07 00:34:07 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2007-10-07 00:34:07 +0000 |
commit | 2f8521c6d1173dd650d9ae2bba8c18e690fa3b1f (patch) | |
tree | 06bc2b997b60797bc42f696f3427f92890089d2b /classes | |
parent | 0d0bf315513039bd8560ac91865c7174e789d675 (diff) | |
parent | 6e90aae26efa66553063b74b9afa9563b70fb982 (diff) |
merge of '603b2d0c7e4ad80e5779bd3bbdb822331cc0ea2b'
and '6ab53da82d157971966f5a17d0c29d54df22cac9'
Diffstat (limited to 'classes')
35 files changed, 814 insertions, 469 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass index 9998982bd1..999d409914 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -374,6 +374,9 @@ oe_machinstall() { fi } +# Remove and re-create ${D} so that is it guaranteed to be empty +do_install[cleandirs] = "${D}" + addtask listtasks do_listtasks[nostamp] = "1" python do_listtasks() { @@ -482,8 +485,11 @@ python base_do_fetch() { (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)) + if not base_chk_file(parser, pn, pv,uri, localpath, d): + if type != "file": + bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) + else: + bb.debug("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) except Exception: raise bb.build.FuncFailed("Checksum of '%s' failed" % uri) } @@ -573,10 +579,6 @@ python base_do_unpack() { 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 - # RP: Insane. localpath shouldn't have parameters - # RP: Scehdule for removal with bitbake 1.8.8 - local = re.sub(';.*$', '', local) local = os.path.realpath(local) ret = oe_unpack_file(local, localdata, url) if not ret: @@ -681,7 +683,8 @@ do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${T ${STAGING_DATADIR} \ ${S} ${B}" -addtask populate_staging after do_package_write +# Could be compile but populate_staging and do_install shouldn't run at the same time +addtask populate_staging after do_install python do_populate_staging () { bb.build.exec_func('do_stage', d) @@ -724,7 +727,7 @@ def explode_deps(s): def packaged(pkg, d): import os, bb - return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) + return os.access(bb.data.expand('${PKGDATA_DIR}/runtime/%s.packaged' % pkg, d), os.R_OK) def read_pkgdatafile(fn): pkgdata = {} @@ -750,23 +753,23 @@ def read_pkgdatafile(fn): def has_subpkgdata(pkg, d): import bb, os - fn = bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s' % pkg, d) + fn = bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d) return os.access(fn, os.R_OK) def read_subpkgdata(pkg, d): import bb, os - fn = bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s' % pkg, d) + fn = bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d) return read_pkgdatafile(fn) def has_pkgdata(pn, d): import bb, os - fn = bb.data.expand('${STAGING_DIR}/pkgdata/%s' % pn, d) + fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) return os.access(fn, os.R_OK) def read_pkgdata(pn, d): import bb, os - fn = bb.data.expand('${STAGING_DIR}/pkgdata/%s' % pn, d) + fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) return read_pkgdatafile(fn) python read_subpackage_metadata () { @@ -847,7 +850,6 @@ def base_after_parse(d): paths = [] for p in [ "${PF}", "${P}", "${PN}", "files", "" ]: - paths.append(bb.data.expand(os.path.join("${FILE_DIRNAME}", p, "${MACHINE}"), d)) path = bb.data.expand(os.path.join("${FILE_DIRNAME}", p, "${MACHINE}"), d) if os.path.isdir(path): paths.append(path) @@ -864,65 +866,10 @@ def base_after_parse(d): bb.data.setVar('PACKAGE_ARCH', "${MACHINE_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_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 diff --git a/classes/debian.bbclass b/classes/debian.bbclass index a0c78a25f4..a38f10d629 100644 --- a/classes/debian.bbclass +++ b/classes/debian.bbclass @@ -4,11 +4,13 @@ STAGING_PKGMAPS_DIR = "${STAGING_DIR}/pkgmaps/debian" # We therefore have to make sure we build all runtime packages # before building the current package to make the packages runtime # depends are correct -BUILD_ALL_DEPS = "1" - +# # Better expressed as ensure all RDEPENDS package before we package # This means we can't have circular RDEPENDS/RRECOMMENDS -do_package_write[rdeptask] = "do_package" +do_package_write_ipk[rdeptask] = "do_package" +do_package_write_deb[rdeptask] = "do_package" +do_package_write_tar[rdeptask] = "do_package" +do_package_write_rpm[rdeptask] = "do_package" python debian_package_name_hook () { import glob, copy, stat, errno, re diff --git a/classes/distutils.bbclass b/classes/distutils.bbclass index d23c2a3b2e..c07a9911cd 100644 --- a/classes/distutils.bbclass +++ b/classes/distutils.bbclass @@ -9,7 +9,15 @@ distutils_do_compile() { 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." + oefatal "python setup.py install_headers execution failed." +} + +distutils_stage_all() { + install -d ${STAGING_INCDIR}/../${PYTHON_DIR}/site-packages + PYTHONPATH=${STAGING_INCDIR}/../${PYTHON_DIR}/site-packages \ + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + ${STAGING_BINDIR_NATIVE}/python setup.py install --prefix=${STAGING_INCDIR}/.. --install-data=${STAGING_INCDIR}/../share || \ + oefatal "python setup.py install (stage) execution failed." } distutils_do_install() { @@ -35,6 +43,7 @@ distutils_do_install() { done fi + rm -f ${D}${libdir}/${PYTHON_DIR}/site-packages/easy-install.pth } EXPORT_FUNCTIONS do_compile do_install diff --git a/classes/efl_base.bbclass b/classes/efl_base.bbclass index 7f170d70f2..3865441779 100644 --- a/classes/efl_base.bbclass +++ b/classes/efl_base.bbclass @@ -1,10 +1,5 @@ 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', '')}" @@ -17,4 +12,3 @@ do_stage() { 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/gnome.bbclass b/classes/gnome.bbclass index 8643989b73..b29d86cefd 100644 --- a/classes/gnome.bbclass +++ b/classes/gnome.bbclass @@ -1,6 +1,6 @@ def gnome_verdir(v): import re - m = re.match("([0-9]+)\.([0-9]+)\..*", v) + m = re.match("^([0-9]+)\.([0-9]+)", v) return "%s.%s" % (m.group(1), m.group(2)) SECTION ?= "x11/gnome" @@ -13,8 +13,6 @@ FILES_${PN} += "${datadir}/application-registry ${datadir}/mime-info \ inherit autotools pkgconfig gconf -EXTRA_AUTORECONF += "-I ${STAGING_DIR}/${HOST_SYS}/share/aclocal/gnome2-macros" - gnome_stage_includes() { autotools_stage_includes } diff --git a/classes/gtk-binver.bbclass b/classes/gtk-binver.bbclass index 8398cc5424..52082492e7 100644 --- a/classes/gtk-binver.bbclass +++ b/classes/gtk-binver.bbclass @@ -1,7 +1,7 @@ def gtkbinver_find(d): import bb try: - for line in file( "%s/gtk+-2.0.pc" % bb.data.getVar('PKG_CONFIG_PATH', d, 1) ).readlines(): + for line in file( "%s/gtk+-2.0.pc" % bb.data.getVar('PKG_CONFIG_DIR', d, 1) ).readlines(): if line.startswith( "gtk_binary_version" ): # bb.note( "gtk_binary_version = '%s'" % line.split("=")[1].strip() ) return line.split("=")[1].strip() diff --git a/classes/image.bbclass b/classes/image.bbclass index 248ccab60b..3420e3f53a 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -1,10 +1,14 @@ inherit rootfs_${IMAGE_PKGTYPE} +LICENSE = "MIT" PACKAGES = "" +RDEPENDS += "${IMAGE_INSTALL}" + +IMAGE_BASENAME[export] = "1" +export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}" # We need to recursively follow RDEPENDS and RRECOMMENDS for images -BUILD_ALL_DEPS = "1" -do_rootfs[recrdeptask] = "do_package_write do_deploy do_populate_staging" +do_rootfs[recrdeptask] += "do_deploy do_populate_staging" # Images are generally built explicitly, do not need to be part of world. EXCLUDE_FROM_WORLD = "1" @@ -51,15 +55,14 @@ def get_devtable_list(d): return str IMAGE_POSTPROCESS_COMMAND ?= "" +MACHINE_POSTPROCESS_COMMAND ?= "" +ROOTFS_POSTPROCESS_COMMAND ?= "" # some default locales 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}" do_build[nostamp] = "1" @@ -69,9 +72,9 @@ do_build[nostamp] = "1" fakeroot do_rootfs () { set -x rm -rf ${IMAGE_ROOTFS} + mkdir -p ${IMAGE_ROOTFS} if [ "${USE_DEVFS}" != "1" ]; then - mkdir -p ${IMAGE_ROOTFS}/dev for devtable in ${@get_devtable_list(d)}; do makedevs -r ${IMAGE_ROOTFS} -D $devtable done diff --git a/classes/insane.bbclass b/classes/insane.bbclass index d54d6c7b9e..83f8c43bba 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -101,7 +101,7 @@ def package_qa_get_elf(path, bits32): def my_assert(expectation, result): if not expectation == result: #print "'%x','%x'" % (ord(expectation), ord(result)) - raise "This does not work as expected" + raise Exception("This does not work as expected") my_assert = staticmethod(my_assert) def __init__(self, name): @@ -124,13 +124,13 @@ def package_qa_get_elf(path, bits32): self.sex = self.data[ELFFile.EI_DATA] if self.sex == chr(ELFFile.ELFDATANONE): - raise "Can't be" + raise Exception("self.sex == ELFDATANONE") elif self.sex == chr(ELFFile.ELFDATA2LSB): self.sex = "<" elif self.sex == chr(ELFFile.ELFDATA2MSB): self.sex = ">" else: - raise "Even more worse" + raise Exception("Unknown self.sex") def osAbi(self): return ord(self.data[ELFFile.EI_OSABI]) @@ -376,7 +376,7 @@ def package_qa_check_rdepends(pkg, workdir, d): bb.data.setVar('ROOT', '', localdata) bb.data.setVar('ROOT_%s' % pkg, root, localdata) - pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) + pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, True) if not pkgname: pkgname = pkg bb.data.setVar('PKG', pkgname, localdata) diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 0670da678d..5976f42c71 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -142,6 +142,7 @@ kernel_do_install() { install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} + install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} install -d ${D}/etc/modutils if [ "${KERNEL_MAJOR_VERSION}" = "2.6" ]; then install -d ${D}/etc/modprobe.d @@ -160,6 +161,18 @@ kernel_do_configure() { yes '' | oe_runmake oldconfig } +do_menuconfig() { + export TERMWINDOWTITLE="${PN} Kernel Configuration" + export SHELLCMDS="make menuconfig" + ${TERMCMDRUN} + if [ $? -ne 0 ]; then + echo "Fatal: '${TERMCMD}' not found. Check TERMCMD variable." + exit 1 + fi +} +do_menuconfig[nostamp] = "1" +addtask menuconfig after do_patch + pkg_postinst_kernel () { cd /${KERNEL_IMAGEDEST}; update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true } @@ -174,12 +187,15 @@ EXPORT_FUNCTIONS do_compile do_install do_stage do_configure # kernel-base becomes kernel-${KERNEL_VERSION} # kernel-image becomes kernel-image-${KERNEL_VERISON} -PACKAGES = "kernel kernel-base kernel-image kernel-dev" +PACKAGES = "kernel kernel-base kernel-image kernel-dev kernel-vmlinux" FILES = "" FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" FILES_kernel-dev = "/boot/System.map* /boot/config*" +FILES_kernel-vmlinux = "/boot/vmlinux*" RDEPENDS_kernel = "kernel-base" -RDEPENDS_kernel-base = "kernel-image" +# Allow machines to override this dependency if kernel image files are +# not wanted in images as standard +RDEPENDS_kernel-base ?= "kernel-image" PKG_kernel-image = "kernel-image-${KERNEL_VERSION}" PKG_kernel-base = "kernel-${KERNEL_VERSION}" ALLOW_EMPTY_kernel = "1" diff --git a/classes/meta.bbclass b/classes/meta.bbclass index f7d41eec26..d35c40bccd 100644 --- a/classes/meta.bbclass +++ b/classes/meta.bbclass @@ -1,5 +1,4 @@ PACKAGES = "" -BUILD_ALL_DEPS = "1" do_build[recrdeptask] = "do_build"
\ No newline at end of file diff --git a/classes/mono.bbclass b/classes/mono.bbclass new file mode 100644 index 0000000000..c50274ed0c --- /dev/null +++ b/classes/mono.bbclass @@ -0,0 +1,218 @@ +def mono_get_file_table(packageversion, d): + # The packageversion is currently ignored, but might be used in the future + # if more than one mono version is available and different versions + # need to use different tables + + import bb, sys, os, glob, commands + curdir = os.path.dirname( bb.data.getVar('FILE', d, 1) ) + if curdir not in sys.path: sys.path.append( curdir ) + from mono_files import debian_mono_file_table + + # mono-jay is not being built (for all platforms at least) + IGNORE = ("mono-jay", ) + file_table = [ + # Standard package + {"name": "mono-doc"}, + + # Virtual packages + {"name": "mono"}, + {"name": "mono-runtime"}, + + # Not provided by Debian: + {"name": "libnunit2.2-cil", + "patterns": [ + "/usr/lib/mono/gac/nunit.*/2.2.*", + "/usr/lib/mono/1.0/nunit.*.dll", + "/usr/lib/pkgconfig/mono-nunit.pc", + ], + "assemblies": [ + ("nunit.core", "2.2.0.0"), + ("nunit.framework", "2.2.0.0"), + ("nunit.util", "2.2.0.0"), + ("nunit.mocks", "2.2.8.0"), + ], + }, + {"name": "libmono-cecil0.5-cil", + "patterns": [ + "/usr/lib/mono/gac/Mono.Cecil/0.5.*", + ], + "assemblies": [ + ("Mono.Cecil", "0.5.*"), + ], + }, + {"name": "libmono-db2-1.0-cil", + "patterns": [ + "/usr/lib/mono/gac/IBM.Data.DB2/1.0*", + "/usr/lib/mono/1.0/IBM.Data.DB2.dll", + ], + "assemblies": [ + ("IBM.Data.DB2", "1.0*"), + ], + }, + ] + debian_mono_file_table + + file_table = [e for e in file_table + if not (e.has_key("name") and e["name"] in IGNORE)] + + return file_table + +def mono_find_provides_and_requires(files, d): + provides = [] + requires = [] + + import bb, os, commands + + pathprefix = "export PATH=%s; export LANG=; export LC_ALL=; " % bb.data.getVar('PATH', d, 1) + for filename in files: + if not filename.endswith(".dll") and not filename.endswith(".exe"): + continue + if not os.path.isfile(filename) or os.path.islink(filename): + continue + + ## Provides + name, version = None, None + + ret, result = commands.getstatusoutput("%smonodis --assembly '%s'" % (pathprefix, filename)) + if ret: + bb.error("raw_provides_and_requires: monodis --assembly '%s' failed, dependency information will be inaccurate" % filename) + continue + for line in result.splitlines(): + if not ":" in line: continue + key, value = line.split(":", 1) + if key.strip() == "Name": + name = value.strip() + elif key.strip() == "Version": + version = value.strip() + if name is not None and version is not None: + if (name, version) not in provides: + provides.append( (name, version) ) + + ## Requires + name, version = None, None + ret, result = commands.getstatusoutput("%smonodis --assemblyref '%s'" % (pathprefix, filename)) + if ret: + bb.error("raw_provides_and_requires: monodis --assemblyref '%s' failed, dependency information will be inaccurate" % filename) + continue + for line in result.splitlines(): + if not "=" in line: continue + key, value = line.split("=", 1) + if ":" in key and key.split(":",1)[1].strip() == "Version": + version = value.strip() + elif key.strip() == "Name": + name = value.strip() + if name is not None and version is not None: + if (name, version) not in requires: + requires.append( (name, version) ) + name, version = None, None + + # Remove everything from requires that's already in provides as it's not actually required + # to be provided externally + requires = [e for e in requires if not e in provides] + return provides, requires + +python mono_do_clilibs() { + import bb, os, re, os.path + + exclude_clilibs = bb.data.getVar('EXCLUDE_FROM_CLILIBS', d, 0) + if exclude_clilibs: + bb.note("not generating clilibs") + return + + lib_re = re.compile("^lib.*\.so") + libdir_re = re.compile(".*/lib$") + + packages = bb.data.getVar('PACKAGES', d, 1) + + workdir = bb.data.getVar('WORKDIR', d, 1) + if not workdir: + bb.error("WORKDIR not defined") + return + + staging = bb.data.getVar('STAGING_DIR', d, 1) + if not staging: + bb.error("STAGING_DIR not defined") + return + + pkgdest = bb.data.getVar('PKGDEST', d, 1) + + clilibs_dir = os.path.join(staging, "clilibs") + bb.mkdirhier(clilibs_dir) + + provides, requires = {}, {} + private_libs = bb.data.getVar('PRIVATE_CLILIBS', d, 1) + for pkg in packages.split(): + bb.debug(2, "calculating clilib provides for %s" % pkg) + + files_to_check = [] + top = os.path.join(pkgdest, pkg) + for root, dirs, files in os.walk(top): + for file in files: + path = os.path.join(root, file) + if file.endswith(".exe") or file.endswith(".dll"): + files_to_check.append( path ) + provides[pkg], requires[pkg] = mono_find_provides_and_requires(files_to_check, d) + clilibs_file = os.path.join(clilibs_dir, pkg + ".list") + if os.path.exists(clilibs_file): + os.remove(clilibs_file) + if len(provides[pkg]) > 0: + fd = open(clilibs_file, 'w') + for s in provides[pkg]: + fd.write(" ".join(s) + '\n') + fd.close() + + clilib_provider = {} + list_re = re.compile('^(.*)\.list$') + for file in os.listdir(clilibs_dir): + m = list_re.match(file) + if m: + dep_pkg = m.group(1) + fd = open(os.path.join(clilibs_dir, file)) + lines = fd.readlines() + fd.close() + for l in lines: + clilib_provider[tuple(l.rstrip().split())] = dep_pkg + + for pkg in packages.split(): + bb.debug(2, "calculating clilib requirements for %s" % pkg) + + deps = [] + for n in requires[pkg]: + if n in clilib_provider.keys(): + dep_pkg = clilib_provider[n] + + if dep_pkg == pkg: + continue + + if not dep_pkg in deps: + deps.append(dep_pkg) + else: + bb.note("Couldn't find CLI library provider for %s" % (n,)) + + deps_file = os.path.join(pkgdest, pkg + ".clilibdeps") + if os.path.exists(deps_file): + os.remove(deps_file) + if len(deps) > 0: + fd = open(deps_file, 'w') + for dep in deps: + fd.write(dep + '\n') + fd.close() +} + +def mono_after_parse(d): + import bb + # Insert mono_do_clilibs into PACKAGEFUNCS + # Needs to be called after populate_packages, but before read_shlibdeps + PACKAGEFUNCS = bb.data.getVar("PACKAGEFUNCS", d, 1) + if PACKAGEFUNCS: + PACKAGEFUNCS = PACKAGEFUNCS.split() + if "read_shlibdeps" in PACKAGEFUNCS: + i = PACKAGEFUNCS.index("read_shlibdeps") + PACKAGEFUNCS.insert(i, "mono_do_clilibs") + elif "populate_packages" in PACKAGEFUNCS: + i = PACKAGEFUNCS.index("populate_packages") + PACKAGEFUNCS.insert(i+1, "mono_do_clilibs") + bb.data.setVar("PACKAGEFUNCS", " ".join(PACKAGEFUNCS), d) + +python () { + mono_after_parse(d) +} diff --git a/classes/multimachine.bbclass b/classes/multimachine.bbclass index 4187a00ec3..945d22bfe0 100644 --- a/classes/multimachine.bbclass +++ b/classes/multimachine.bbclass @@ -1,6 +1,7 @@ STAMP = "${TMPDIR}/stamps/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}/${PF}" WORKDIR = "${TMPDIR}/work/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}/${PF}" STAGING_KERNEL_DIR = "${STAGING_DIR}/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}/kernel" +PKGDATA_DIR = "${STAGING_DIR}/pkgdata/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}" # Find any machine specific sub packages and if present, mark the # whole package as machine specific for multimachine purposes. diff --git a/classes/native.bbclass b/classes/native.bbclass index 43000f96bf..104d5a49da 100644 --- a/classes/native.bbclass +++ b/classes/native.bbclass @@ -11,13 +11,6 @@ PACKAGE_ARCH = "${BUILD_ARCH}" # RPROVIDES becomes unnecessary. RPROVIDES = "${PN}" -# Need to resolve package RDEPENDS as well as DEPENDS -BUILD_ALL_DEPS = "1" - -# Break the circular dependency as a result of DEPENDS -# in package.bbclass -PACKAGE_DEPENDS = "" - TARGET_ARCH = "${BUILD_ARCH}" TARGET_OS = "${BUILD_OS}" TARGET_VENDOR = "${BUILD_VENDOR}" @@ -98,3 +91,5 @@ do_stage () { do_install () { true } + +PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" diff --git a/classes/openmoko2.bbclass b/classes/openmoko2.bbclass index 872dd4915c..ef734e4311 100644 --- a/classes/openmoko2.bbclass +++ b/classes/openmoko2.bbclass @@ -29,5 +29,5 @@ S = "${WORKDIR}/${PN}" FILES_${PN} += "${datadir}/icons" -# SVNREV = "r${SRCREV}" -SVNREV = "${SRCDATE}" +SVNREV = "r${SRCREV}" +#SVNREV = "${SRCDATE}" diff --git a/classes/package.bbclass b/classes/package.bbclass index 95e4acd4d6..b114049b8e 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -2,6 +2,8 @@ # General packaging help functions # +PKGDEST = "${WORKDIR}/install" + def legitimize_package_name(s): """ Make sure package names are legitimate strings @@ -120,75 +122,68 @@ 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) - + deps = (bb.data.getVarFlag('do_package', 'deptask', d) or "").split() # shlibs requires any DEPENDS to have already packaged for the *.list files - bb.data.setVarFlag('do_package', 'deptask', 'do_package', d) + deps.append("do_package") + bb.data.setVarFlag('do_package', 'deptask', " ".join(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! -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 do_package[depends] - - local ro st - - st=0 - if { file "$1" || { - oewarn "file $1: failed (forced strip)" >&2 - echo '${FILE_UNSTRIPPED_MATCH}' - } - } | grep -q '${FILE_UNSTRIPPED_MATCH}' - then - oenote "${STRIP} $1" - ro= - test -w "$1" || { - ro=1 - chmod +w "$1" - } - mkdir -p $(dirname "$1")/.debug - debugfile="$(dirname "$1")/.debug/$(basename "$1")" - '${OBJCOPY}' --only-keep-debug "$1" "$debugfile" - '${STRIP}' "$1" - st=$? - '${OBJCOPY}' --add-gnu-debuglink="$debugfile" "$1" - test -n "$ro" && chmod -w "$1" - if test $st -ne 0 - then - oewarn "runstrip: ${STRIP} $1: strip failed" >&2 - if [ x${IGNORE_STRIP_ERRORS} = x1 ] - then - #FIXME: remove this, it's for error detection - if file "$1" 2>/dev/null >&2 - then - (oefatal "${STRIP} $1: command failed" >/dev/tty) - else - (oefatal "file $1: command failed" >/dev/tty) - fi - st=0 - fi - fi - else - oenote "runstrip: skip $1" - fi - return $st -} +def runstrip(file, d): + # Function to strip a single file, called from populate_packages below + # A working 'file' (one which works on the target architecture) + # is necessary for this stuff to work, hence the addition to do_package[depends] + + import bb, os, commands, stat + + pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, 1) + + ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, file)) + + if ret: + bb.error("runstrip: 'file %s' failed (forced strip)" % file) + + if "not stripped" not in result: + bb.debug(1, "runstrip: skip %s" % file) + return 0 + + strip = bb.data.getVar("STRIP", d, 1) + objcopy = bb.data.getVar("OBJCOPY", d, 1) + + newmode = None + if not os.access(file, os.W_OK): + origmode = os.stat(file)[stat.ST_MODE] + newmode = origmode | stat.S_IWRITE + os.chmod(file, newmode) + + extraflags = "" + if ".so" in file and "shared" in result: + extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded" + elif "shared" in result or "executable" in result: + extraflags = "--remove-section=.comment --remove-section=.note" + + bb.mkdirhier(os.path.join(os.path.dirname(file), ".debug")) + debugfile=os.path.join(os.path.dirname(file), ".debug", os.path.basename(file)) + stripcmd = "'%s' %s '%s'" % (strip, extraflags, file) + bb.debug(1, "runstrip: %s" % stripcmd) + + os.system("%s'%s' --only-keep-debug '%s' '%s'" % (pathprefix, objcopy, file, debugfile)) + ret = os.system("%s%s" % (pathprefix, stripcmd)) + os.system("%s'%s' --add-gnu-debuglink='%s' '%s'" % (pathprefix, objcopy, debugfile, file)) + + if newmode: + os.chmod(file, origmode) + + if ret: + bb.error("runstrip: '%s' strip command failed" % stripcmd) + + return 1 # # Package data handling routines @@ -376,39 +371,27 @@ python populate_packages () { package_list.append(pkg) if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): - stripfunc = "" for root, dirs, files in os.walk(dvar): for f in files: file = os.path.join(root, f) if not os.path.islink(file) and not os.path.isdir(file) and isexec(file): - stripfunc += "\trunstrip %s || st=1\n" % (file) - if not stripfunc == "": - from bb import build - localdata = bb.data.createCopy(d) - # strip - bb.data.setVar('RUNSTRIP', '\tlocal st\n\tst=0\n%s\treturn $st' % stripfunc, localdata) - bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata) - bb.build.exec_func('RUNSTRIP', localdata) + runstrip(file, d) + + pkgdest = bb.data.getVar('PKGDEST', d, 1) + os.system('rm -rf %s' % pkgdest) for pkg in package_list: localdata = bb.data.createCopy(d) - root = os.path.join(workdir, "install", pkg) - - os.system('rm -rf %s' % root) + root = os.path.join(pkgdest, pkg) + bb.mkdirhier(root) - bb.data.setVar('ROOT', '', localdata) - bb.data.setVar('ROOT_%s' % pkg, root, localdata) bb.data.setVar('PKG', pkg, localdata) - overrides = bb.data.getVar('OVERRIDES', localdata, 1) if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') - bb.data.setVar('OVERRIDES', overrides+':'+pkg, localdata) - + bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) bb.data.update_data(localdata) - root = bb.data.getVar('ROOT', localdata, 1) - bb.mkdirhier(root) filesvar = bb.data.getVar('FILES', localdata, 1) or "" files = filesvar.split() for file in files: @@ -461,7 +444,7 @@ python populate_packages () { for pkg in package_list: dangling_links[pkg] = [] pkg_files[pkg] = [] - inst_root = os.path.join(workdir, "install", pkg) + inst_root = os.path.join(pkgdest, pkg) for root, dirs, files in os.walk(inst_root): for f in files: path = os.path.join(root, f) @@ -499,6 +482,8 @@ python populate_packages () { populate_packages[dirs] = "${D}" python emit_pkgdata() { + from glob import glob + def write_if_exists(f, pkg, var): def encode(str): import codecs @@ -510,16 +495,16 @@ python emit_pkgdata() { f.write('%s_%s: %s\n' % (var, pkg, encode(val))) packages = bb.data.getVar('PACKAGES', d, 1) - if not packages: - return - data_file = bb.data.expand("${STAGING_DIR}/pkgdata/${PN}", d) + data_file = bb.data.expand("${PKGDATA_DIR}/${PN}", d) f = open(data_file, 'w') f.write("PACKAGES: %s\n" % packages) f.close() + workdir = bb.data.getVar('WORKDIR', d, 1) + for pkg in packages.split(): - subdata_file = bb.data.expand("${STAGING_DIR}/pkgdata/runtime/%s" % pkg, d) + subdata_file = bb.data.expand("${PKGDATA_DIR}/runtime/%s" % pkg, d) sf = open(subdata_file, 'w') write_if_exists(sf, pkg, 'DESCRIPTION') write_if_exists(sf, pkg, 'RDEPENDS') @@ -537,8 +522,15 @@ python emit_pkgdata() { write_if_exists(sf, pkg, 'pkg_preinst') write_if_exists(sf, pkg, 'pkg_prerm') sf.close() + + allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1) + root = "%s/install/%s" % (workdir, pkg) + os.chdir(root) + g = glob('*') + if g or allow_empty == "1": + file(bb.data.expand('${PKGDATA_DIR}/runtime/%s.packaged' % pkg, d), 'w').close() } -emit_pkgdata[dirs] = "${STAGING_DIR}/pkgdata/runtime" +emit_pkgdata[dirs] = "${PKGDATA_DIR}/runtime" ldconfig_postinst_fragment() { if [ x"$D" = "x" ]; then @@ -558,9 +550,6 @@ python package_do_shlibs() { libdir_re = re.compile(".*/lib$") packages = bb.data.getVar('PACKAGES', d, 1) - if not packages: - bb.debug(1, "no packages to build; not calculating shlibs") - return workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: @@ -582,6 +571,8 @@ python package_do_shlibs() { bb.error("TARGET_SYS not defined") return + pkgdest = bb.data.getVar('PKGDEST', d, 1) + shlibs_dir = os.path.join(staging, target_sys, "shlibs") old_shlibs_dir = os.path.join(staging, "shlibs") bb.mkdirhier(shlibs_dir) @@ -594,7 +585,7 @@ python package_do_shlibs() { needed[pkg] = [] sonames = list() - top = os.path.join(workdir, "install", pkg) + top = os.path.join(pkgdest, pkg) for root, dirs, files in os.walk(top): for file in files: soname = None @@ -680,7 +671,7 @@ python package_do_shlibs() { else: bb.note("Couldn't find shared library provider for %s" % n) - deps_file = os.path.join(workdir, "install", pkg + ".shlibdeps") + deps_file = os.path.join(pkgdest, pkg + ".shlibdeps") if os.path.exists(deps_file): os.remove(deps_file) if len(deps): @@ -694,9 +685,6 @@ python package_do_pkgconfig () { import re, os packages = bb.data.getVar('PACKAGES', d, 1) - if not packages: - bb.debug(1, "no packages to build; not calculating pkgconfig dependencies") - return workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: @@ -713,6 +701,8 @@ python package_do_pkgconfig () { bb.error("TARGET_SYS not defined") return + pkgdest = bb.data.getVar('PKGDEST', d, 1) + shlibs_dir = os.path.join(staging, target_sys, "shlibs") old_shlibs_dir = os.path.join(staging, "shlibs") bb.mkdirhier(shlibs_dir) @@ -726,7 +716,7 @@ python package_do_pkgconfig () { for pkg in packages.split(): pkgconfig_provided[pkg] = [] pkgconfig_needed[pkg] = [] - top = os.path.join(workdir, "install", pkg) + top = os.path.join(pkgdest, pkg) for root, dirs, files in os.walk(top): for file in files: m = pc_re.match(file) @@ -789,7 +779,7 @@ python package_do_pkgconfig () { found = True if found == False: bb.note("couldn't find pkgconfig module '%s' in any package" % n) - deps_file = os.path.join(workdir, "install", pkg + ".pcdeps") + deps_file = os.path.join(pkgdest, pkg + ".pcdeps") if os.path.exists(deps_file): os.remove(deps_file) if len(deps): @@ -800,23 +790,17 @@ python package_do_pkgconfig () { } python read_shlibdeps () { - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + packages = bb.data.getVar('PACKAGES', d, 1).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()) + for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": + depsfile = bb.data.expand("${PKGDEST}/" + pkg + extension, d) + if os.access(depsfile, os.R_OK): + fd = file(depsfile) + lines = fd.readlines() + fd.close() + for l in lines: + rdepends.append(l.rstrip()) bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) } @@ -840,7 +824,7 @@ python package_depchains() { def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): def packaged(pkg, d): - return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) + return os.access(bb.data.expand('${PKGDATA_DIR}/runtime/%s.packaged' % pkg, d), os.R_OK) #bb.note('rdepends for %s is %s' % (base, rdepends)) @@ -910,27 +894,25 @@ PACKAGEFUNCS ?= "package_do_split_locales \ emit_pkgdata" python package_do_package () { + packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + if len(packages) < 1: + bb.debug(1, "No packages to build, skipping do_package") + return + for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): bb.build.exec_func(f, d) } do_package[dirs] = "${D}" addtask package before do_build after do_install - - -PACKAGE_WRITE_FUNCS ?= "read_subpackage_metadata" - -python package_do_package_write () { - for f in (bb.data.getVar('PACKAGE_WRITE_FUNCS', d, 1) or '').split(): - bb.build.exec_func(f, d) +# Dummy task to mark when all packaging is complete +do_package_write () { + : } -do_package_write[dirs] = "${D}" addtask package_write before do_build after do_package - EXPORT_FUNCTIONS do_package do_package_write - # # Helper functions for the package writing classes # diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index c322af1f15..b85ffe254f 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -4,13 +4,18 @@ inherit package -PACKAGE_EXTRA_DEPENDS += "dpkg-native fakeroot-native" - BOOTSTRAP_EXTRA_RDEPENDS += "dpkg" DISTRO_EXTRA_RDEPENDS += "dpkg" -PACKAGE_WRITE_FUNCS += "do_package_deb" IMAGE_PKGTYPE ?= "deb" +# Map TARGET_ARCH to Debian's ideas about architectures +DPKG_ARCH ?= "${TARGET_ARCH}" +DPKG_ARCH_x86 ?= "i386" +DPKG_ARCH_i486 ?= "i386" +DPKG_ARCH_i586 ?= "i386" +DPKG_ARCH_i686 ?= "i386" +DPKG_ARCH_pentium ?= "i386" + python package_deb_fn () { from bb import data bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) @@ -41,7 +46,7 @@ python do_package_deb_install () { if (exitstatus != 0 ): raise bb.build.FuncFailed(output) - f = open(os.path.join(tmpdir, "stamps", "do_packages"), "w") + f = open(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"), "w") f.close() # NOTE: this env stuff is racy at best, we need something more capable @@ -64,9 +69,7 @@ python do_package_deb_install () { } python do_package_deb () { - import copy # to back up env data - import sys - import re + import sys, re, fcntl, copy workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: @@ -91,18 +94,29 @@ python do_package_deb () { return tmpdir = bb.data.getVar('TMPDIR', d, 1) - # Invalidate the packages file - if os.access(os.path.join(tmpdir, "stamps", "do_packages"),os.R_OK): - os.unlink(os.path.join(tmpdir, "stamps", "do_packages")) + + if os.access(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN"),os.R_OK): + os.unlink(os.path.join(tmpdir, "stamps", "DEB_PACKAGE_INDEX_CLEAN")) if packages == []: bb.debug(1, "No packages; nothing to do") return + def lockfile(name): + lf = open(name, "a+") + fcntl.flock(lf.fileno(), fcntl.LOCK_EX) + return lf + + def unlockfile(lf): + fcntl.flock(lf.fileno(), fcntl.LOCK_UN) + lf.close + for pkg in packages.split(): localdata = bb.data.createCopy(d) root = "%s/install/%s" % (workdir, pkg) + lf = lockfile(root + ".lock") + bb.data.setVar('ROOT', '', localdata) bb.data.setVar('ROOT_%s' % pkg, root, localdata) pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) @@ -133,7 +147,9 @@ python do_package_deb () { if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": from bb import note note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) + unlockfile(lf) continue + controldir = os.path.join(root, 'DEBIAN') bb.mkdirhier(controldir) os.chmod(controldir, 0755) @@ -154,7 +170,7 @@ python do_package_deb () { 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(["Architecture: %s\n", ['DPKG_ARCH']]) fields.append(["OE: %s\n", ['PN']]) fields.append(["Homepage: %s\n", ['HOMEPAGE']]) @@ -168,7 +184,7 @@ python do_package_deb () { data = bb.data.getVar(i, d, 1) if data is None: raise KeyError(f) - if i == 'TARGET_ARCH' and bb.data.getVar('PACKAGE_ARCH', d, 1) == 'all': + if i == 'DPKG_ARCH' and bb.data.getVar('PACKAGE_ARCH', d, 1) == 'all': data = 'all' l2.append(data) return l2 @@ -246,5 +262,20 @@ python do_package_deb () { os.rmdir(controldir) except OSError: pass - del localdata + + unlockfile(lf) +} + +python () { + import bb + if bb.data.getVar('PACKAGES', d, True) != '': + bb.data.setVarFlag('do_package_write_deb', 'depends', 'dpkg-native:do_populate_staging fakeroot-native:do_populate_staging', d) } + +python do_package_write_deb () { + bb.build.exec_func("read_subpackage_metadata", d) + bb.build.exec_func("do_package_deb", d) +} +do_package_write_deb[dirs] = "${D}" +addtask package_write_deb before do_package_write after do_package + diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index 9200055495..a12899e2a1 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -1,11 +1,11 @@ inherit package -PACKAGE_EXTRA_DEPENDS += "ipkg-utils-native fakeroot-native" - BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg" -PACKAGE_WRITE_FUNCS += "do_package_ipk" IMAGE_PKGTYPE ?= "ipk" +IPKGCONF_TARGET = "${STAGING_ETCDIR_NATIVE}/ipkg.conf" +IPKGCONF_SDK = "${STAGING_ETCDIR_NATIVE}/ipkg-sdk.conf" + python package_ipk_fn () { from bb import data bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) @@ -49,11 +49,11 @@ python package_ipk_install () { if (not os.access(os.path.join(ipkdir,"Packages"), os.R_OK) or - not os.access(os.path.join(tmpdir, "stamps", "do_packages"),os.R_OK): + not os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),os.R_OK): ret = os.system('ipkg-make-index -p %s %s ' % (os.path.join(ipkdir, "Packages"), ipkdir)) if (ret != 0 ): raise bb.build.FuncFailed - f=open(os.path.join(tmpdir, "stamps" ,"do_packages"),"w") + f = open(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),"w") f.close() ret = os.system('ipkg-cl -o %s -f %s update' % (rootfs, conffile)) @@ -62,10 +62,59 @@ python package_ipk_install () { raise bb.build.FuncFailed } +# +# Update the Packages index files in ${DEPLOY_DIR_IPK} +# +package_update_index_ipk () { + set -x + + ipkgarchs="${PACKAGE_ARCHS}" + + if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then + return + fi + + 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} + + for arch in $ipkgarchs; do + if [ -e ${DEPLOY_DIR_IPK}/$arch/ ] ; then + touch ${DEPLOY_DIR_IPK}/$arch/Packages + ipkg-make-index -r ${DEPLOY_DIR_IPK}/$arch/Packages -p ${DEPLOY_DIR_IPK}/$arch/Packages -l ${DEPLOY_DIR_IPK}/$arch/Packages.filelist -m ${DEPLOY_DIR_IPK}/$arch/ + fi + 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 + done +} + +# +# Generate an ipkg conf file ${IPKGCONF_TARGET} suitable for use against +# the target system and an ipkg conf file ${IPKGCONF_SDK} suitable for +# use against the host system in sdk builds +# +package_generate_ipkg_conf () { + mkdir -p ${STAGING_ETCDIR_NATIVE}/ + echo "src oe file:${DEPLOY_DIR_IPK}" > ${IPKGCONF_TARGET} + echo "src oe file:${DEPLOY_DIR_IPK}" > ${IPKGCONF_SDK} + ipkgarchs="${PACKAGE_ARCHS}" + priority=1 + for arch in $ipkgarchs; do + echo "arch $arch $priority" >> ${IPKGCONF_TARGET} + echo "arch ${BUILD_ARCH}-$arch-sdk $priority" >> ${IPKGCONF_SDK} + priority=$(expr $priority + 5) + if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then + echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >> ${IPKGCONF_TARGET} + fi + if [ -e ${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk/Packages ] ; then + echo "src oe-${BUILD_ARCH}-$arch-sdk file:${DEPLOY_DIR_IPK}/${BUILD_ARCH}-$arch-sdk" >> ${IPKGCONF_SDK} + fi + done +} + python do_package_ipk () { - import copy # to back up env data - import sys - import re + import sys, re, fcntl, copy workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: @@ -94,18 +143,29 @@ python do_package_ipk () { return tmpdir = bb.data.getVar('TMPDIR', d, 1) - # Invalidate the packages file - if os.access(os.path.join(tmpdir, "stamps", "do_packages"),os.R_OK): - os.unlink(os.path.join(tmpdir, "stamps" ,"do_packages")) + + if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK): + os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN")) if packages == []: bb.debug(1, "No packages; nothing to do") return + def lockfile(name): + lf = open(name, "a+") + fcntl.flock(lf.fileno(), fcntl.LOCK_EX) + return lf + + def unlockfile(lf): + fcntl.flock(lf.fileno(), fcntl.LOCK_UN) + lf.close + for pkg in packages.split(): localdata = bb.data.createCopy(d) root = "%s/install/%s" % (workdir, pkg) + lf = lockfile(root + ".lock") + bb.data.setVar('ROOT', '', localdata) bb.data.setVar('ROOT_%s' % pkg, root, localdata) pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) @@ -134,6 +194,7 @@ python do_package_ipk () { if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": from bb import note note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) + unlockfile(lf) continue controldir = os.path.join(root, 'CONTROL') @@ -154,7 +215,7 @@ python do_package_ipk () { fields.append(["Priority: %s\n", ['PRIORITY']]) fields.append(["Maintainer: %s\n", ['MAINTAINER']]) fields.append(["Architecture: %s\n", ['PACKAGE_ARCH']]) - fields.append(["OE: %s\n", ['P']]) + fields.append(["OE: %s\n", ['PN']]) fields.append(["Homepage: %s\n", ['HOMEPAGE']]) def pullData(l, d): @@ -231,8 +292,6 @@ python do_package_ipk () { if ret != 0: raise bb.build.FuncFailed("ipkg-build execution failed") - file(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), 'w').close() - for script in ["preinst", "postinst", "prerm", "postrm", "control" ]: scriptfile = os.path.join(controldir, script) try: @@ -243,5 +302,18 @@ python do_package_ipk () { os.rmdir(controldir) except OSError: pass - del localdata + unlockfile(lf) +} + +python () { + import bb + if bb.data.getVar('PACKAGES', d, True) != '': + bb.data.setVarFlag('do_package_write_ipk', 'depends', 'ipkg-utils-native:do_populate_staging fakeroot-native:do_populate_staging', d) +} + +python do_package_write_ipk () { + bb.build.exec_func("read_subpackage_metadata", d) + bb.build.exec_func("do_package_ipk", d) } +do_package_write_ipk[dirs] = "${D}" +addtask package_write_ipk before do_package_write after do_package diff --git a/classes/package_rpm.bbclass b/classes/package_rpm.bbclass index 4955792916..7fc5e8ea96 100644 --- a/classes/package_rpm.bbclass +++ b/classes/package_rpm.bbclass @@ -2,7 +2,6 @@ inherit package inherit rpm_core RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}" -PACKAGE_WRITE_FUNCS += "do_package_rpm" IMAGE_PKGTYPE ?= "rpm" python write_specfile() { @@ -54,7 +53,6 @@ python write_specfile() { except OSError: raise bb.build.FuncFailed("unable to open spec file for writing.") -# fd = sys.__stdout__ fd = specfile for var in out_vartranslate.keys(): if out_vartranslate[var][0] == "%": @@ -123,7 +121,7 @@ python do_package_rpm () { bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata) bb.data.update_data(localdata) -# stuff + root = bb.data.getVar('ROOT', localdata) basedir = os.path.dirname(root) pkgoutdir = outdir @@ -132,3 +130,17 @@ python do_package_rpm () { bb.build.exec_func('write_specfile', localdata) del localdata } + +python () { + import bb + if bb.data.getVar('PACKAGES', d, True) != '': + bb.data.setVarFlag('do_package_write_rpm', 'depends', 'rpm-native:do_populate_staging', d) +} + + +python do_package_write_rpm () { + bb.build.exec_func("read_subpackage_metadata", d) + bb.build.exec_func("do_package_rpm", d) +} +do_package_write_rpm[dirs] = "${D}" +addtask package_write_rpm before do_build after do_package diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass index e94e763150..cb4c42b261 100644 --- a/classes/package_tar.bbclass +++ b/classes/package_tar.bbclass @@ -1,8 +1,5 @@ inherit package -PACKAGE_EXTRA_DEPENDS += "tar-native" - -PACKAGE_WRITE_FUNCS += "do_package_tar" IMAGE_PKGTYPE ?= "tar" python package_tar_fn () { @@ -78,7 +75,7 @@ python do_package_tar () { bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata) bb.data.update_data(localdata) -# stuff + root = bb.data.getVar('ROOT', localdata) bb.mkdirhier(root) basedir = os.path.dirname(root) @@ -97,9 +94,18 @@ python do_package_tar () { ret = os.system("tar -czvf %s %s" % (tarfn, '.')) if ret != 0: bb.error("Creation of tar %s failed." % tarfn) +} + +python () { + import bb + if bb.data.getVar('PACKAGES', d, True) != '': + bb.data.setVarFlag('do_package_write_tar', 'depends', 'tar-native:do_populate_staging', d) +} - file(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), 'w').close() -# end stuff - del localdata +python do_package_write_tar () { + bb.build.exec_func("read_subpackage_metadata", d) + bb.build.exec_func("do_package_tar", d) } +do_package_write_tar[dirs] = "${D}" +addtask package_write_tar before do_build after do_package diff --git a/classes/pkgconfig.bbclass b/classes/pkgconfig.bbclass index 3256977517..c795c8a709 100644 --- a/classes/pkgconfig.bbclass +++ b/classes/pkgconfig.bbclass @@ -31,7 +31,7 @@ do_install_append () { 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)} -e 's:${D}${libdir}\S*:${STAGING_LIBDIR}:g' -e 's:${D}${prefix}/include\S*:${STAGING_INCDIR}:g' > ${PKG_CONFIG_PATH}/$pcname + install -d ${PKG_CONFIG_DIR} + 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_DIR}/$pcname done } diff --git a/classes/qmake-base.bbclass b/classes/qmake-base.bbclass deleted file mode 100644 index b623b34aaa..0000000000 --- a/classes/qmake-base.bbclass +++ /dev/null @@ -1,44 +0,0 @@ -DEPENDS_prepend = "qmake-native " - -OE_QMAKE_PLATFORM = "${TARGET_OS}-oe-g++" -QMAKESPEC := "${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}" - -# We override this completely to eliminate the -e normally passed in -EXTRA_OEMAKE = ' MAKEFLAGS= ' - -export OE_QMAKE_CC="${CC}" -export OE_QMAKE_CFLAGS="${CFLAGS}" -export OE_QMAKE_CXX="${CXX}" -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="echo" -export OE_QMAKE_UIC="${STAGING_BINDIR_NATIVE}/uic" -export OE_QMAKE_MOC="${STAGING_BINDIR_NATIVE}/moc" -export OE_QMAKE_RCC="non-existant" -export OE_QMAKE_QMAKE="${STAGING_BINDIR_NATIVE}/qmake" -export OE_QMAKE_RPATH="-Wl,-rpath-link," - -# default to qte2 via bb.conf, inherit qt3x11 to configure for qt3x11 -export OE_QMAKE_INCDIR_QT="${QTDIR}/include" -export OE_QMAKE_LIBDIR_QT="${QTDIR}/lib" -export OE_QMAKE_LIBS_QT="qte" -export OE_QMAKE_LIBS_X11="" - -oe_qmake_mkspecs () { - mkdir -p mkspecs/${OE_QMAKE_PLATFORM} - for f in ${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}/*; do - if [ -L $f ]; then - lnk=`readlink $f` - if [ -f mkspecs/${OE_QMAKE_PLATFORM}/$lnk ]; then - ln -s $lnk mkspecs/${OE_QMAKE_PLATFORM}/`basename $f` - else - cp $f mkspecs/${OE_QMAKE_PLATFORM}/ - fi - else - cp $f mkspecs/${OE_QMAKE_PLATFORM}/ - fi - done -} - diff --git a/classes/qmake.bbclass b/classes/qmake.bbclass index 4f2fceff35..34f59ef9f7 100644 --- a/classes/qmake.bbclass +++ b/classes/qmake.bbclass @@ -1,57 +1,14 @@ -inherit qmake-base +inherit qmake_base -qmake_do_configure() { - case ${QMAKESPEC} in - *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++) - ;; - *-oe-g++) - die Unsupported target ${TARGET_OS} for oe-g++ qmake spec - ;; - *) - oenote Searching for qmake spec file - paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-${TARGET_ARCH}-g++" - paths="${QMAKE_MKSPEC_PATH}/${TARGET_OS}-g++ $paths" +DEPENDS_prepend = "qmake-native " - if (echo "${TARGET_ARCH}"|grep -q 'i.86'); then - paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-x86-g++ $paths" - fi - for i in $paths; do - if test -e $i; then - export QMAKESPEC=$i - break - fi - done - ;; - esac +export OE_QMAKE_UIC="${STAGING_BINDIR_NATIVE}/uic" +export OE_QMAKE_MOC="${STAGING_BINDIR_NATIVE}/moc" +export OE_QMAKE_QMAKE="${STAGING_BINDIR_NATIVE}/qmake" +export OE_QMAKE_CXXFLAGS="-fno-exceptions -fno-rtti ${CXXFLAGS}" +export OE_QMAKE_LINK="${CCLD}" +export OE_QMAKE_INCDIR_QT="${QTDIR}/include" +export OE_QMAKE_LIBDIR_QT="${QTDIR}/lib" +export OE_QMAKE_LIBS_QT="qte" +export OE_QMAKE_LIBS_X11="" - oenote "using qmake spec in ${QMAKESPEC}, using profiles '${QMAKE_PROFILES}'" - - if [ -z "${QMAKE_PROFILES}" ]; then - PROFILES="`ls *.pro`" - else - PROFILES="${QMAKE_PROFILES}" - fi - - if [ -z "$PROFILES" ]; then - die "QMAKE_PROFILES not set and no profiles found in $PWD" - fi - - if [ ! -z "${EXTRA_QMAKEVARS_POST}" ]; then - AFTER="-after" - QMAKE_VARSUBST_POST="${EXTRA_QMAKEVARS_POST}" - oenote "qmake postvar substitution: ${EXTRA_QMAKEVARS_POST}" - fi - - if [ ! -z "${EXTRA_QMAKEVARS_PRE}" ]; then - QMAKE_VARSUBST_PRE="${EXTRA_QMAKEVARS_PRE}" - oenote "qmake prevar substitution: ${EXTRA_QMAKEVARS_PRE}" - fi - -#oenote "Calling '${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST'" - unset QMAKESPEC || true - ${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST || die "Error calling ${OE_QMAKE_QMAKE} on $PROFILES" -} - -EXPORT_FUNCTIONS do_configure - -addtask configure after do_unpack do_patch before do_compile diff --git a/classes/qmake2.bbclass b/classes/qmake2.bbclass new file mode 100644 index 0000000000..d0f59d2cd4 --- /dev/null +++ b/classes/qmake2.bbclass @@ -0,0 +1,20 @@ +# +# QMake variables for Qt4 +# +inherit qmake_base + +DEPENDS_prepend = "qmake2-native uicmoc4-native " + +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" +export OE_QMAKE_LINK = "${CXX}" +export OE_QMAKE_CXXFLAGS = "${CXXFLAGS}" +export OE_QMAKE_INCDIR_QT = "${QTDIR}/include" +export OE_QMAKE_LIBDIR_QT = "${QTDIR}/lib" +export OE_QMAKE_LIBS_QT = "qt" +export OE_QMAKE_LIBS_X11 = "-lXext -lX11 -lm" diff --git a/classes/qmake_base.bbclass b/classes/qmake_base.bbclass new file mode 100644 index 0000000000..ea8903c278 --- /dev/null +++ b/classes/qmake_base.bbclass @@ -0,0 +1,88 @@ + +OE_QMAKE_PLATFORM = "${TARGET_OS}-oe-g++" +QMAKESPEC := "${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}" + +# We override this completely to eliminate the -e normally passed in +EXTRA_OEMAKE = ' MAKEFLAGS= ' + +export OE_QMAKE_CC="${CC}" +export OE_QMAKE_CFLAGS="${CFLAGS}" +export OE_QMAKE_CXX="${CXX}" +export OE_QMAKE_LDFLAGS="${LDFLAGS}" +export OE_QMAKE_AR="${AR}" +export OE_QMAKE_STRIP="echo" +export OE_QMAKE_RPATH="-Wl,-rpath-link," + +# default to qte2 via bb.conf, inherit qt3x11 to configure for qt3x11 + +oe_qmake_mkspecs () { + mkdir -p mkspecs/${OE_QMAKE_PLATFORM} + for f in ${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}/*; do + if [ -L $f ]; then + lnk=`readlink $f` + if [ -f mkspecs/${OE_QMAKE_PLATFORM}/$lnk ]; then + ln -s $lnk mkspecs/${OE_QMAKE_PLATFORM}/`basename $f` + else + cp $f mkspecs/${OE_QMAKE_PLATFORM}/ + fi + else + cp $f mkspecs/${OE_QMAKE_PLATFORM}/ + fi + done +} + +qmake_base_do_configure() { + case ${QMAKESPEC} in + *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++) + ;; + *-oe-g++) + die Unsupported target ${TARGET_OS} for oe-g++ qmake spec + ;; + *) + oenote Searching for qmake spec file + paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-${TARGET_ARCH}-g++" + paths="${QMAKE_MKSPEC_PATH}/${TARGET_OS}-g++ $paths" + + if (echo "${TARGET_ARCH}"|grep -q 'i.86'); then + paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-x86-g++ $paths" + fi + for i in $paths; do + if test -e $i; then + export QMAKESPEC=$i + break + fi + done + ;; + esac + + oenote "using qmake spec in ${QMAKESPEC}, using profiles '${QMAKE_PROFILES}'" + + if [ -z "${QMAKE_PROFILES}" ]; then + PROFILES="`ls *.pro`" + else + PROFILES="${QMAKE_PROFILES}" + fi + + if [ -z "$PROFILES" ]; then + die "QMAKE_PROFILES not set and no profiles found in $PWD" + fi + + if [ ! -z "${EXTRA_QMAKEVARS_POST}" ]; then + AFTER="-after" + QMAKE_VARSUBST_POST="${EXTRA_QMAKEVARS_POST}" + oenote "qmake postvar substitution: ${EXTRA_QMAKEVARS_POST}" + fi + + if [ ! -z "${EXTRA_QMAKEVARS_PRE}" ]; then + QMAKE_VARSUBST_PRE="${EXTRA_QMAKEVARS_PRE}" + oenote "qmake prevar substitution: ${EXTRA_QMAKEVARS_PRE}" + fi + +#oenote "Calling '${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST'" + unset QMAKESPEC || true + ${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST || die "Error calling ${OE_QMAKE_QMAKE} on $PROFILES" +} + +EXPORT_FUNCTIONS do_configure + +addtask configure after do_unpack do_patch before do_compile diff --git a/classes/qt3e.bbclass b/classes/qt3e.bbclass index 58a6779af6..98c47adb90 100644 --- a/classes/qt3e.bbclass +++ b/classes/qt3e.bbclass @@ -1,5 +1,5 @@ # -# override variables set by qmake-base to compile Qt/X11 apps +# override variables set by qmake_base to compile Qt/X11 apps # export QTDIR="${STAGING_DIR}/${HOST_SYS}/qte3" export QTEDIR="${STAGING_DIR}/${HOST_SYS}/qte3" diff --git a/classes/qt3x11.bbclass b/classes/qt3x11.bbclass index 95ed4f538a..67f2cf7348 100644 --- a/classes/qt3x11.bbclass +++ b/classes/qt3x11.bbclass @@ -1,7 +1,7 @@ DEPENDS_prepend = "${@["qt3x11 ", ""][(bb.data.getVar('PN', d, 1) == 'qt-x11-free')]}" EXTRA_QMAKEVARS_POST += "CONFIG+=thread" # -# override variables set by qmake-base to compile Qt/X11 apps +# override variables set by qmake_base to compile Qt/X11 apps # export QTDIR = "${STAGING_DIR}/${HOST_SYS}/qt3" export OE_QMAKE_UIC = "${STAGING_BINDIR_NATIVE}/uic3" diff --git a/classes/qt4x11.bbclass b/classes/qt4x11.bbclass index 7046ef1cb9..76a45c33cb 100644 --- a/classes/qt4x11.bbclass +++ b/classes/qt4x11.bbclass @@ -1,18 +1,3 @@ -DEPENDS_prepend = "qmake2-native " DEPENDS_prepend = "${@["qt4x11 ", ""][(bb.data.getVar('PN', d, 1) == 'qt4-x11-free')]}" -# -# override variables set by qmake-base to compile Qt4/X11 apps -# -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" -export OE_QMAKE_LINK = "${CXX}" -export OE_QMAKE_CXXFLAGS = "${CXXFLAGS}" -export OE_QMAKE_INCDIR_QT = "${QTDIR}/include" -export OE_QMAKE_LIBDIR_QT = "${QTDIR}/lib" -export OE_QMAKE_LIBS_QT = "qt" -export OE_QMAKE_LIBS_X11 = "-lXext -lX11 -lm" + +inherit qmake2 diff --git a/classes/rm_work.bbclass b/classes/rm_work.bbclass index 45812bbb81..8569148212 100644 --- a/classes/rm_work.bbclass +++ b/classes/rm_work.bbclass @@ -14,15 +14,13 @@ do_rm_work () { for dir in * do if [ `basename ${S}` = $dir ]; then - rm -rf $dir/* + rm -rf $dir elif [ $dir != 'temp' ]; then rm -rf $dir fi done } -# Uncomment me when we can use bitbake 1.8.8 -#addtask rm_work after do_${RMWORK_ORIG_TASK} -addtask rm_work after do_build +addtask rm_work after do_${RMWORK_ORIG_TASK} do_rm_work_all () { : diff --git a/classes/rootfs_deb.bbclass b/classes/rootfs_deb.bbclass index 67fa661308..d3e5832251 100644 --- a/classes/rootfs_deb.bbclass +++ b/classes/rootfs_deb.bbclass @@ -3,10 +3,12 @@ # do_rootfs[depends] += "dpkg-native:do_populate_staging apt-native:do_populate_staging" +do_rootfs[recrdeptask] += "do_package_write_deb" fakeroot rootfs_deb_do_rootfs () { set +e - mkdir -p ${IMAGE_ROOTFS}/var/dpkg/{info,updates} + mkdir -p ${IMAGE_ROOTFS}/var/dpkg/info + mkdir -p ${IMAGE_ROOTFS}/var/dpkg/updates rm -f ${STAGING_DIR}/etc/apt/sources.list.rev rm -f ${STAGING_DIR}/etc/apt/preferences @@ -54,23 +56,25 @@ fakeroot rootfs_deb_do_rootfs () { cat ${IMAGE_ROOTFS}/var/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" } - if [ ! -z "${LINGUAS_INSTALL}" ]; then - 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 --force-yes --allow-unauthenticated + if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then + if [ ! -z "${LINGUAS_INSTALL}" ]; then + apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated if [ $? -ne 0 ]; then - exit $? + exit 1 fi - done + for i in ${LINGUAS_INSTALL}; do + apt-get install $i --force-yes --allow-unauthenticated + if [ $? -ne 0 ]; then + exit 1 + fi + done + fi fi if [ ! -z "${PACKAGE_INSTALL}" ]; then for i in ${PACKAGE_INSTALL}; do apt-get install $i --force-yes --allow-unauthenticated - if [ $? -eq 1 ]; then + if [ $? -ne 0 ]; then exit 1 fi find ${IMAGE_ROOTFS} -name \*.dpkg-new | for i in `cat`; do @@ -108,9 +112,17 @@ fakeroot rootfs_deb_do_rootfs () { if [ -e ${IMAGE_ROOTFS}/usr/dpkg/alternatives ]; then rmdir ${IMAGE_ROOTFS}/usr/dpkg/alternatives fi - ln -s /usr/lib/ipkg/alternatives ${IMAGE_ROOTFS}/usr/dpkg/alternatives - ln -s /usr/dpkg/info ${IMAGE_ROOTFS}/usr/lib/ipkg/info - ln -s /usr/dpkg/status ${IMAGE_ROOTFS}/usr/lib/ipkg/status + if [ ! -e ${IMAGE_ROOTFS}/usr/lib/ipkg ] ; then + mkdir -p ${IMAGE_ROOTFS}/usr/lib/ipkg + fi + + if [ ! -e ${IMAGE_ROOTFS}/etc/ipkg ] ; then + mkdir -p ${IMAGE_ROOTFS}/etc/ipkg + fi + + ln -sf /usr/lib/ipkg/alternatives ${IMAGE_ROOTFS}/usr/dpkg/alternatives + ln -sf /usr/dpkg/info ${IMAGE_ROOTFS}/usr/lib/ipkg/info + ln -sf /usr/dpkg/status ${IMAGE_ROOTFS}/usr/lib/ipkg/status ${ROOTFS_POSTPROCESS_COMMAND} @@ -130,7 +142,7 @@ rootfs_deb_log_check() { echo -e "log_check: Matched keyword: [$keyword_die]\n" echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die" echo "" - do_exit=1 + do_exit=1 fi done test "$do_exit" = 1 && exit 1 diff --git a/classes/rootfs_ipk.bbclass b/classes/rootfs_ipk.bbclass index 75c85e8f3d..6babee30a2 100644 --- a/classes/rootfs_ipk.bbclass +++ b/classes/rootfs_ipk.bbclass @@ -6,58 +6,31 @@ # do_rootfs[depends] += "ipkg-native:do_populate_staging ipkg-utils-native:do_populate_staging" +do_rootfs[recrdeptask] += "do_package_write_ipk" -IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS} ${@base_conditional("PACKAGE_INSTALL_NO_DEPS", "1", "-nodeps", "", d)}" +IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} ${@base_conditional("PACKAGE_INSTALL_NO_DEPS", "1", "-nodeps", "", d)}" DISTRO_EXTRA_RDEPENDS += " ipkg ipkg-collateral " PACKAGE_INSTALL_NO_DEPS ?= "0" -rootfs_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}/$arch/ ] ; then - touch ${DEPLOY_DIR_IPK}/$arch/Packages - ipkg-make-index -r ${DEPLOY_DIR_IPK}/$arch/Packages -p ${DEPLOY_DIR_IPK}/$arch/Packages -l ${DEPLOY_DIR_IPK}/$arch/Packages.filelist -m ${DEPLOY_DIR_IPK}/$arch/ - fi - fi - done -} - fakeroot rootfs_ipk_do_rootfs () { set -x - rootfs_ipk_do_indexes + package_update_index_ipk + package_generate_ipkg_conf - mkdir -p ${IMAGE_ROOTFS}/dev mkdir -p ${T} - #Add deploy/ipk as well for backward compat - echo "src oe file:${DEPLOY_DIR_IPK}" > ${T}/ipkg.conf - ipkgarchs="${PACKAGE_ARCHS}" - - priority=1 - for arch in $ipkgarchs; do - echo "arch $arch $priority" >> ${T}/ipkg.conf - priority=$(expr $priority + 5) - if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then - echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >> ${T}/ipkg.conf - fi - done ipkg-cl ${IPKG_ARGS} update - if [ ! -z "${LINGUAS_INSTALL}" ]; then - ipkg-cl ${IPKG_ARGS} install glibc-localedata-i18n - for i in ${LINGUAS_INSTALL}; do - ipkg-cl ${IPKG_ARGS} install $i - done + + # Uclibc builds don't provide this stuff... + if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then + if [ ! -z "${LINGUAS_INSTALL}" ]; then + ipkg-cl ${IPKG_ARGS} install glibc-localedata-i18n + for i in ${LINGUAS_INSTALL}; do + ipkg-cl ${IPKG_ARGS} install $i + done + fi fi if [ ! -z "${PACKAGE_INSTALL}" ]; then ipkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL} @@ -67,7 +40,7 @@ fakeroot rootfs_ipk_do_rootfs () { export OFFLINE_ROOT=${IMAGE_ROOTFS} export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} mkdir -p ${IMAGE_ROOTFS}/etc/ipkg/ - grep "^arch" ${T}/ipkg.conf >${IMAGE_ROOTFS}/etc/ipkg/arch.conf + grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/ipkg/arch.conf for i in ${IMAGE_ROOTFS}${libdir}/ipkg/info/*.preinst; do if [ -f $i ] && ! sh $i; then @@ -107,3 +80,7 @@ rootfs_ipk_log_check() { test "$do_exit" = 1 && exit 1 true } + +remove_packaging_data_files() { + rm -rf ${IMAGE_ROOTFS}/usr/lib/ipkg/ +} diff --git a/classes/sdk.bbclass b/classes/sdk.bbclass index 0050b2e48e..8067798000 100644 --- a/classes/sdk.bbclass +++ b/classes/sdk.bbclass @@ -2,8 +2,6 @@ # or indirectly via dependency. No need to be in 'world'. EXCLUDE_FROM_WORLD = "1" -SDK_NAME = "${DISTRO}/${TARGET_ARCH}" - OLD_PACKAGE_ARCH := ${PACKAGE_ARCH} PACKAGE_ARCH = "${BUILD_ARCH}-${OLD_PACKAGE_ARCH}-sdk" @@ -18,7 +16,7 @@ CFLAGS = "${BUILD_CFLAGS}" CXXFLAGS = "${BUILD_CFLAGS}" LDFLAGS = "${BUILD_LDFLAGS}" -prefix = "/usr/local/${SDK_NAME}" +prefix = "${SDK_PREFIX}" exec_prefix = "${prefix}" base_prefix = "${exec_prefix}" @@ -26,23 +24,3 @@ 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 7241ae3e7a..101f621303 100644 --- a/classes/seppuku.bbclass +++ b/classes/seppuku.bbclass @@ -335,16 +335,23 @@ python seppuku_eventhandler() { (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 + # The bug is present and still open, attach an error log if bug_number and bug_open: print >> debug_file, "The bug is known as '%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 for bug #%s" % bug_number + 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 for bug #%s" % bug_number return NotHandled if bug_number and not bug_open: if not seppuku_reopen_bug(poster, reopen, product, component, bug_number, bugname, text): - print >> debug_file, "Failed to reopen the bug report" + print >> debug_file, "Failed to reopen the bug #%s" % bug_number else: - print >> debug_file, "Reopened the bug report" + print >> debug_file, "Reopened the bug #%s" % bug_number else: bug_number = seppuku_file_bug(poster, newbug, product, component, bugname, text) if not bug_number: @@ -354,11 +361,11 @@ python seppuku_eventhandler() { if bug_number and 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" + print >> debug_file, "Failed to attach the build log for bug #%" % bug_number 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" + print >> debug_file, "Not trying to create an attachment for bug #%" % bug_number return NotHandled } diff --git a/classes/siteinfo.bbclass b/classes/siteinfo.bbclass index 4191f4edc1..c41a3ff369 100644 --- a/classes/siteinfo.bbclass +++ b/classes/siteinfo.bbclass @@ -42,6 +42,8 @@ def get_siteinfo_list(d): "i686-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ "mipsel-linux": "endian-little bit-32 common-glibc",\ "mipsel-linux-uclibc": "endian-little bit-32 common-uclibc",\ + "mips-linux": "endian-big bit-32 common-glibc",\ + "mips-linux-uclibc": "endian-big bit-32 common-uclibc",\ "powerpc-darwin": "endian-big bit-32 common-darwin",\ "ppc-linux": "endian-big bit-32 common-glibc powerpc-common",\ "powerpc-linux": "endian-big bit-32 common-glibc powerpc-common",\ diff --git a/classes/task.bbclass b/classes/task.bbclass new file mode 100644 index 0000000000..4edd704829 --- /dev/null +++ b/classes/task.bbclass @@ -0,0 +1,27 @@ +# Task packages are only used to pull in other packages +# via their dependencies. They are empty. +ALLOW_EMPTY = "1" + +# By default, only the task package itself is in PACKAGES. +# -dbg and -dev flavours are handled by the anonfunc below. +# This means that task recipes used to build multiple task +# packages have to modify PACKAGES after inheriting task.bbclass. +PACKAGES = "${PN}" + +# By default, task packages do not depend on a certain architecture. +# Only if dependencies are modified by MACHINE_FEATURES, packages +# need to be set to MACHINE_ARCH after inheriting task.bbclass +PACKAGE_ARCH = "all" + +# This automatically adds -dbg and -dev flavours of all PACKAGES +# to the list. Their dependencies (RRECOMMENDS) are handled as usual +# by package_depchains in a following step. +python () { + packages = bb.data.getVar('PACKAGES', d, 1).split() + genpackages = [] + for pkg in packages: + for postfix in ['-dbg', '-dev']: + genpackages.append(pkg+postfix) + bb.data.setVar('PACKAGES', ' '.join(packages+genpackages), d) +} + diff --git a/classes/xilinx-bsp.bbclass b/classes/xilinx-bsp.bbclass new file mode 100644 index 0000000000..fd09946061 --- /dev/null +++ b/classes/xilinx-bsp.bbclass @@ -0,0 +1,53 @@ +# Copyright (C) 2007, Stelios Koroneos - Digital OPSiS, All Rights Reserved +# Released under the MIT license (see packages/COPYING) +# +#This class handles all the intricasies of getting the required files from the +#ISE/EDK/project to the kernel and prepare the kernel for compilation. +#The Xilinx EDK supports 2 different architectures : PowerPC (ppc 405) and Microblaze +#Only the PowerPC BSP has been tested so far +#For this to work correctly you need to add XILINX_BSP_PATH and XILINX_BOARD to your +#local.conf +#XILINX_BSP_PATH should have the complete path to your project dir +#XILINX_BOARD should have the board type i.e ML403 +# +#Currently supported boards +#Xilinx ML403 +#More to come soon ;) + +do_configure_prepend() { + + +#first check that the XILINX_BSP_PATH and XILINX_BOARD have been defined in local.conf +if [ -z "${XILINX_BSP_PATH}" ]; then + oefatal "XILINX_BSP_PATH not defined ! Exiting..." + exit 1 + +else + if [ -z "${XILINX_BOARD}" ]; then + oefatal "XILINX_BOARD not defined ! Exiting" + exit 1 + fi + +fi +#now depending on the board type and arch do what is nessesary + +case "${XILINX_BOARD}" in + ML403) + oenote "ML403 board setup" + cp -a ${XILINX_BSP_PATH}/ppc405_0/libsrc/linux_2_6_v1_00_a/linux/arch/ppc/platforms/4xx/xparameters/xparameters_ml40x.h \ + ${S}/arch/ppc/platforms/4xx/xparameters/xparameters_ml403.h + ;; + + * ) + oefatal "! Unknow Xilinx board ! Exiting..." + exit 1 + ;; +esac + + +} + + + + + |