diff options
Diffstat (limited to 'classes')
99 files changed, 3168 insertions, 1117 deletions
diff --git a/classes/angstrom.bbclass b/classes/angstrom.bbclass new file mode 100644 index 0000000000..4a810a638a --- /dev/null +++ b/classes/angstrom.bbclass @@ -0,0 +1,19 @@ +# anonymous support class for angstrom +# +# Features: +# +# * blacklist handling, set ANGSTROM_BLACKLIST_pn-blah = "message" +# + +python () { + import bb + + blacklist = bb.data.getVar("ANGSTROM_BLACKLIST", d, 1) + pkgnm = bb.data.getVar("PN", d, 1) + + if blacklist: + bb.note("Angstrom DOES NOT support %s because %s" % (pkgnm, blacklist)) + raise bb.parse.SkipPackage("Angstrom DOES NOT support %s because %s" % (pkgnm, blacklist)) + +} + diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass index fd8687ebb6..1ea4b6f1d0 100644 --- a/classes/autotools.bbclass +++ b/classes/autotools.bbclass @@ -1,11 +1,7 @@ -inherit base - # use autotools_stage_all for native packages AUTOTOOLS_NATIVE_STAGE_INSTALL = "1" def autotools_dep_prepend(d): - import bb; - if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1): return '' @@ -20,18 +16,22 @@ def autotools_dep_prepend(d): deps += 'libtool-native ' if not bb.data.inherits_class('native', d) \ and not bb.data.inherits_class('cross', d) \ + and not bb.data.inherits_class('sdk', d) \ and not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1): deps += 'libtool-cross ' return deps + 'gnu-config-native ' EXTRA_OEMAKE = "" + DEPENDS_prepend = "${@autotools_dep_prepend(d)}" +DEPENDS_virtclass-native_prepend = "${@autotools_dep_prepend(d)}" +DEPENDS_virtclass-nativesdk_prepend = "${@autotools_dep_prepend(d)}" + acpaths = "default" EXTRA_AUTORECONF = "--exclude=autopoint" def autotools_set_crosscompiling(d): - import bb if not bb.data.inherits_class('native', d): return " cross_compiling=yes" return "" @@ -114,7 +114,7 @@ autotools_do_configure() { else CONFIGURE_AC=configure.ac fi - if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then + if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then : do nothing -- we still have an old unmodified configure.ac else @@ -122,12 +122,12 @@ autotools_do_configure() { echo "no" | glib-gettextize --force --copy fi fi - if grep "^[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then + mkdir -p m4 + if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then oenote Executing intltoolize --copy --force --automake intltoolize --copy --force --automake fi oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths - mkdir -p m4 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed." cd $olddir fi @@ -144,8 +144,10 @@ autotools_do_install() { oe_runmake 'DESTDIR=${D}' install } -do_install_append() { - for i in `find ${D} -name "*.la"` ; do \ +PACKAGE_PREPROCESS_FUNCS += "autotools_prepackage_lamangler" + +autotools_prepackage_lamangler () { + for i in `find ${PKGD} -name "*.la"` ; do \ sed -i -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${libdir}/\1,g' $i sed -i -e s:${CROSS_DIR}/${HOST_SYS}::g $i sed -i -e s:${CROSS_DIR}::g $i @@ -172,14 +174,11 @@ autotools_stage_includes() { } autotools_stage_dir() { - from="$1" - to="$2" - # This will remove empty directories so we can ignore them - rmdir "$from" 2> /dev/null || true - if [ -d "$from" ]; then - mkdir -p "$to" - cp -fpPR "$from"/* "$to" - fi + sysroot_stage_dir $1 ${STAGE_TEMP_PREFIX}$2 +} + +autotools_stage_libdir() { + sysroot_stage_libdir $1 ${STAGE_TEMP_PREFIX}$2 } autotools_stage_all() { @@ -190,50 +189,9 @@ autotools_stage_all() { rm -rf ${STAGE_TEMP} mkdir -p ${STAGE_TEMP} oe_runmake DESTDIR="${STAGE_TEMP}" install - autotools_stage_dir ${STAGE_TEMP}/${includedir} ${STAGING_INCDIR} - if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then - autotools_stage_dir ${STAGE_TEMP}/${bindir} ${STAGING_DIR_HOST}${layout_bindir} - autotools_stage_dir ${STAGE_TEMP}/${sbindir} ${STAGING_DIR_HOST}${layout_sbindir} - autotools_stage_dir ${STAGE_TEMP}/${base_bindir} ${STAGING_DIR_HOST}${layout_base_bindir} - autotools_stage_dir ${STAGE_TEMP}/${base_sbindir} ${STAGING_DIR_HOST}${layout_base_sbindir} - autotools_stage_dir ${STAGE_TEMP}/${libexecdir} ${STAGING_DIR_HOST}${layout_libexecdir} - if [ "${prefix}/lib" != "${libdir}" ]; then - # python puts its files in here, make sure they are staged as well - autotools_stage_dir ${STAGE_TEMP}/${prefix}/lib ${STAGING_DIR_HOST}${layout_prefix}/lib - fi - fi - if [ -d ${STAGE_TEMP}/${libdir} ] - then - olddir=`pwd` - cd ${STAGE_TEMP}/${libdir} - las=$(find . -name \*.la -type f) - cd $olddir - echo "Found la files: $las" - for i in $las - do - sed -e 's/^installed=yes$/installed=no/' \ - -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \ - -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \ - -i ${STAGE_TEMP}/${libdir}/$i - done - autotools_stage_dir ${STAGE_TEMP}/${libdir} ${STAGING_LIBDIR} - fi - # Ok, this is nasty. pkgconfig.bbclass is usually used to install .pc files, - # however some packages rely on the presence of .pc files to enable/disable - # their configurataions in which case we better should not install everything - # unconditionally, but rather depend on the actual results of make install. - # The good news though: a) there are not many packages doing this and - # b) packaged staging will fix that anyways. :M: - if [ "${AUTOTOOLS_STAGE_PKGCONFIG}" = "1" ] - then - if [ -e ${STAGE_TEMP}/${libdir}/pkgconfig/ ] ; then - echo "cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/" - cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/ - fi - fi rm -rf ${STAGE_TEMP}/${mandir} || true rm -rf ${STAGE_TEMP}/${infodir} || true - autotools_stage_dir ${STAGE_TEMP}/${datadir} ${STAGING_DATADIR} + sysroot_stage_dirs ${STAGE_TEMP} ${STAGE_TEMP_PREFIX} rm -rf ${STAGE_TEMP} } diff --git a/classes/autotools_stage.bbclass b/classes/autotools_stage.bbclass index 3007eef969..ff0f4cd880 100644 --- a/classes/autotools_stage.bbclass +++ b/classes/autotools_stage.bbclass @@ -3,4 +3,3 @@ inherit autotools do_stage () { autotools_stage_all } - diff --git a/classes/base.bbclass b/classes/base.bbclass index 18afc1a2fe..e6cfeccc46 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -10,18 +10,97 @@ def base_path_join(a, *p): path += '/' + b return path +def base_path_relative(src, dest): + """ Return a relative path from src to dest. + + >>> base_path_relative("/usr/bin", "/tmp/foo/bar") + ../../tmp/foo/bar + + >>> base_path_relative("/usr/bin", "/usr/lib") + ../lib + + >>> base_path_relative("/tmp", "/tmp/foo/bar") + foo/bar + """ + from os.path import sep, pardir, normpath, commonprefix + + destlist = normpath(dest).split(sep) + srclist = normpath(src).split(sep) + + # Find common section of the path + common = commonprefix([destlist, srclist]) + commonlen = len(common) + + # Climb back to the point where they differentiate + relpath = [ pardir ] * (len(srclist) - commonlen) + if commonlen < len(destlist): + # Add remaining portion + relpath += destlist[commonlen:] + + return sep.join(relpath) + +def base_path_out(path, d): + """ Prepare a path for display to the user. """ + rel = base_path_relative(d.getVar("TOPDIR", 1), path) + if len(rel) > len(path): + return path + else: + return rel + # for MD5/SHA handling -def base_chk_load_parser(config_path): - import ConfigParser, os, bb +def base_chk_load_parser(config_paths): + import ConfigParser 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) + if len(parser.read(config_paths)) < 1: + raise ValueError("no ini files could be found") return parser +def base_chk_file_vars(parser, localpath, params, data): + try: + name = params["name"] + except KeyError: + return False + flagName = "%s.md5sum" % name + want_md5sum = bb.data.getVarFlag("SRC_URI", flagName, data) + flagName = "%s.sha256sum" % name + want_sha256sum = bb.data.getVarFlag("SRC_URI", flagName, data) + + if (want_sha256sum == None and want_md5sum == None): + # no checksums to check, nothing to do + return False + + if not os.path.exists(localpath): + localpath = base_path_out(localpath, data) + bb.note("The localpath does not exist '%s'" % localpath) + raise Exception("The path does not exist '%s'" % localpath) + + if want_md5sum: + try: + md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath)) + md5data = (md5pipe.readline().split() or [ "" ])[0] + md5pipe.close() + except OSError, e: + raise Exception("Executing md5sum failed") + if want_md5sum != md5data: + bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (want_md5sum, md5data)) + raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (want_md5sum, md5data)) + + if want_sha256sum: + try: + shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath)) + sha256data = (shapipe.readline().split() or [ "" ])[0] + shapipe.close() + except OSError, e: + raise Exception("Executing shasum failed") + if want_sha256sum != sha256data: + bb.note("The SHA256Sums did not match. Wanted: '%s' and Got: '%s'" % (want_sha256sum, sha256data)) + raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (want_sha256sum, sha256data)) + + return True + + def base_chk_file(parser, pn, pv, src_uri, localpath, data): - import os, bb no_checksum = False # Try PN-PV-SRC_URI first and then try PN-SRC_URI # we rely on the get method to create errors @@ -41,13 +120,14 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): # md5 and sha256 should be valid now if not os.path.exists(localpath): + localpath = base_path_out(localpath, data) 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) + md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath)) md5data = (md5pipe.readline().split() or [ "" ])[0] md5pipe.close() except OSError: @@ -91,15 +171,16 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): def base_dep_prepend(d): - import bb # # Ideally this will check a flag so we will operate properly in # the case where host == build == target, for now we don't work in # that case though. # - deps = "shasum-native " - if bb.data.getVar('PN', d, True) == "shasum-native": + deps = "shasum-native coreutils-native" + if bb.data.getVar('PN', d, True) == "shasum-native" or bb.data.getVar('PN', d, True) == "stagemanager-native": deps = "" + if bb.data.getVar('PN', d, True) == "coreutils-native": + deps = "shasum-native" # 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 @@ -111,7 +192,6 @@ def base_dep_prepend(d): return deps def base_read_file(filename): - import bb try: f = file( filename, "r" ) except IOError, reason: @@ -120,22 +200,25 @@ def base_read_file(filename): return f.read().strip() return None +def base_ifelse(condition, iftrue = True, iffalse = False): + if condition: + return iftrue + else: + return iffalse + def base_conditional(variable, checkvalue, truevalue, falsevalue, d): - import bb if bb.data.getVar(variable,d,1) == checkvalue: return truevalue else: return falsevalue def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): - import bb if float(bb.data.getVar(variable,d,1)) <= float(checkvalue): return truevalue else: return falsevalue def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): - import bb result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue) if result <= 0: return truevalue @@ -143,7 +226,6 @@ def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): return falsevalue def base_contains(variable, checkvalues, truevalue, falsevalue, d): - import bb matches = 0 if type(checkvalues).__name__ == "str": checkvalues = [checkvalues] @@ -155,33 +237,25 @@ def base_contains(variable, checkvalues, truevalue, falsevalue, d): return falsevalue def base_both_contain(variable1, variable2, checkvalue, d): - import bb if bb.data.getVar(variable1,d,1).find(checkvalue) != -1 and bb.data.getVar(variable2,d,1).find(checkvalue) != -1: return checkvalue else: return "" DEPENDS_prepend="${@base_dep_prepend(d)} " +DEPENDS_virtclass-native_prepend="${@base_dep_prepend(d)} " +DEPENDS_virtclass-nativesdk_prepend="${@base_dep_prepend(d)} " -# Returns PN with various suffixes removed -# or PN if no matching suffix was found. -def base_package_name(d): - import bb; - - pn = bb.data.getVar('PN', d, 1) - if pn.endswith("-native"): - pn = pn[0:-7] - elif pn.endswith("-cross"): - pn = pn[0:-6] - elif pn.endswith("-initial"): - pn = pn[0:-8] - elif pn.endswith("-intermediate"): - pn = pn[0:-13] - - return pn +def base_prune_suffix(var, suffixes, d): + # See if var ends with any of the suffixes listed and + # remove it if found + for suffix in suffixes: + if var.endswith(suffix): + return var.replace(suffix, "") + return var def base_set_filespath(path, d): - import os, bb + bb.note("base_set_filespath usage is deprecated, %s should be fixed" % d.getVar("P", 1)) filespath = [] # The ":" ensures we have an 'empty' override overrides = (bb.data.getVar("OVERRIDES", d, 1) or "") + ":" @@ -190,8 +264,6 @@ def base_set_filespath(path, d): filespath.append(os.path.join(p, o)) return ":".join(filespath) -FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}" - def oe_filter(f, str, d): from re import match return " ".join(filter(lambda x: match(f, x, 0), str.split())) @@ -401,7 +473,6 @@ oe_libinstall() { } def package_stagefile(file, d): - import bb, os if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1": destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1)) @@ -468,29 +539,25 @@ python base_do_clean() { """clear the build and temp directories""" dir = bb.data.expand("${WORKDIR}", d) if dir == '//': raise bb.build.FuncFailed("wrong DATADIR") - bb.note("removing " + dir) + bb.note("removing " + base_path_out(dir, d)) os.system('rm -rf ' + dir) dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d) - bb.note("removing " + dir) + bb.note("removing " + base_path_out(dir, d)) os.system('rm -f '+ dir) } -#Uncomment this for bitbake 1.8.12 -#addtask rebuild after do_${BB_DEFAULT_TASK} -addtask rebuild +python do_cleanall() { + pass +} +do_cleanall[recrdeptask] = "do_clean" +addtask cleanall after do_clean + +addtask rebuild after do_${BB_DEFAULT_TASK} do_rebuild[dirs] = "${TOPDIR}" do_rebuild[nostamp] = "1" python base_do_rebuild() { """rebuild a package""" - from bb import __version__ - 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(__version__) < LooseVersion('1.8.11')): - bb.build.exec_func('do_clean', d) - bb.build.exec_task('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1), d) } addtask mrproper @@ -510,7 +577,6 @@ do_distclean[dirs] = "${TOPDIR}" do_distclean[nostamp] = "1" python base_do_distclean() { """clear downloaded sources, build and temp directories""" - import os bb.build.exec_func('do_clean', d) @@ -527,7 +593,7 @@ python base_do_distclean() { except bb.MalformedUrl, e: bb.debug(1, 'Unable to generate local path for malformed uri: %s' % e) else: - bb.note("removing %s" % local) + bb.note("removing %s" % base_path_out(local, d)) try: if os.path.exists(local + ".md5"): os.remove(local + ".md5") @@ -573,6 +639,9 @@ python base_do_fetch() { except bb.fetch.NoMethodError: (type, value, traceback) = sys.exc_info() raise bb.build.FuncFailed("No method: %s" % value) + except bb.MalformedUrl: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("Malformed URL: %s" % value) try: bb.fetch.go(localdata) @@ -592,15 +661,20 @@ python base_do_fetch() { # 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 + checksum_paths = bb.data.getVar('BBPATH', d, True).split(":") + # reverse the list to give precedence to directories that + # appear first in BBPATH + checksum_paths.reverse() + + checksum_files = ["%s/conf/checksums.ini" % path for path in checksum_paths] try: - parser = base_chk_load_parser(check_sum) + parser = base_chk_load_parser(checksum_files) + except ValueError: + bb.note("No conf/checksums.ini found, not checking checksums") + return except: - bb.note("Creating the CheckSum parser failed") + bb.note("Creating the CheckSum parser failed: %s:%s" % (sys.exc_info()[0], sys.exc_info()[1])) return pv = bb.data.getVar('PV', d, True) @@ -609,15 +683,15 @@ python base_do_fetch() { # 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) + (type,host,path,_,_,params) = bb.decodeurl(url) uri = "%s://%s%s" % (type,host,path) try: - if type == "http" or type == "https" or type == "ftp" or type == "ftps": - if not base_chk_file(parser, pn, pv,uri, localpath, d): - if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS",d, True): - bb.fatal("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) + if type in [ "http", "https", "ftp", "ftps" ]: + if not (base_chk_file_vars(parser, localpath, params, d) or base_chk_file(parser, pn, pv,uri, localpath, d)): + if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS", d, True): + bb.fatal("%s-%s: %s has no checksum defined, cannot check archive integrity" % (pn,pv,uri)) else: - bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri)) + bb.note("%s-%s: %s has no checksum defined, archive integrity not checked" % (pn,pv,uri)) except Exception: raise bb.build.FuncFailed("Checksum of '%s' failed" % uri) } @@ -673,9 +747,14 @@ base_do_buildall() { : } +def subprocess_setup(): + import signal + # Python installs a SIGPIPE handler by default. This is usually not what + # non-Python subprocesses expect. + signal.signal(signal.SIGPIPE, signal.SIG_DFL) def oe_unpack_file(file, data, url = None): - import bb, os + import subprocess if not url: url = "file://%s" % file dots = file.split(".") @@ -701,15 +780,18 @@ def oe_unpack_file(file, data, url = None): cmd = '%s -a' % cmd cmd = '%s %s' % (cmd, file) elif os.path.isdir(file): - filesdir = os.path.realpath(bb.data.getVar("FILESDIR", data, 1)) destdir = "." - if file[0:len(filesdir)] == filesdir: - destdir = file[len(filesdir):file.rfind('/')] - destdir = destdir.strip('/') - if len(destdir) < 1: - destdir = "." - elif not os.access("%s/%s" % (os.getcwd(), destdir), os.F_OK): - os.makedirs("%s/%s" % (os.getcwd(), destdir)) + filespath = bb.data.getVar("FILESPATH", data, 1).split(":") + for fp in filespath: + if file[0:len(fp)] == fp: + destdir = file[len(fp):file.rfind('/')] + destdir = destdir.strip('/') + if len(destdir) < 1: + destdir = "." + elif not os.access("%s/%s" % (os.getcwd(), destdir), os.F_OK): + os.makedirs("%s/%s" % (os.getcwd(), destdir)) + break + cmd = 'cp -pPR %s %s/%s/' % (file, os.getcwd(), destdir) else: (type, host, path, user, pswd, parm) = bb.decodeurl(url) @@ -740,8 +822,8 @@ def oe_unpack_file(file, data, url = None): os.chdir(newdir) cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) - bb.note("Unpacking %s to %s/" % (file, os.getcwd())) - ret = os.system(cmd) + bb.note("Unpacking %s to %s/" % (base_path_out(file, data), base_path_out(os.getcwd(), data))) + ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) os.chdir(save_cwd) @@ -750,7 +832,7 @@ def oe_unpack_file(file, data, url = None): addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" python base_do_unpack() { - import re, os + import re localdata = bb.data.createCopy(d) bb.data.update_data(localdata) @@ -763,22 +845,53 @@ python base_do_unpack() { try: local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata) except bb.MalformedUrl, e: - raise FuncFailed('Unable to generate local path for malformed uri: %s' % e) + raise bb.build.FuncFailed('Unable to generate local path for malformed uri: %s' % e) + if not local: + raise bb.build.FuncFailed('Unable to locate local file for %s' % url) local = os.path.realpath(local) ret = oe_unpack_file(local, localdata, url) if not ret: raise bb.build.FuncFailed() } -def base_get_scmbasepath(d): - import bb - path_to_bbfiles = bb.data.getVar( 'BBFILES', d, 1 ).split() - return path_to_bbfiles[0][:path_to_bbfiles[0].rindex( "packages" )] +METADATA_SCM = "${@base_get_scm(d)}" +METADATA_REVISION = "${@base_get_scm_revision(d)}" +METADATA_BRANCH = "${@base_get_scm_branch(d)}" + +def base_get_scm(d): + from bb import which + baserepo = os.path.dirname(os.path.dirname(which(d.getVar("BBPATH", 1), "classes/base.bbclass"))) + for (scm, scmpath) in {"svn": ".svn", + "git": ".git", + "monotone": "_MTN"}.iteritems(): + if os.path.exists(os.path.join(baserepo, scmpath)): + return "%s %s" % (scm, baserepo) + return "<unknown> %s" % baserepo + +def base_get_scm_revision(d): + (scm, path) = d.getVar("METADATA_SCM", 1).split() + try: + if scm != "<unknown>": + return globals()["base_get_metadata_%s_revision" % scm](path, d) + else: + return scm + except KeyError: + return "<unknown>" -def base_get_metadata_monotone_branch(d): +def base_get_scm_branch(d): + (scm, path) = d.getVar("METADATA_SCM", 1).split() + try: + if scm != "<unknown>": + return globals()["base_get_metadata_%s_branch" % scm](path, d) + else: + return scm + except KeyError: + return "<unknown>" + +def base_get_metadata_monotone_branch(path, d): monotone_branch = "<unknown>" try: - monotone_branch = file( "%s/_MTN/options" % base_get_scmbasepath(d) ).read().strip() + monotone_branch = file( "%s/_MTN/options" % path ).read().strip() if monotone_branch.startswith( "database" ): monotone_branch_words = monotone_branch.split() monotone_branch = monotone_branch_words[ monotone_branch_words.index( "branch" )+1][1:-1] @@ -786,10 +899,10 @@ def base_get_metadata_monotone_branch(d): pass return monotone_branch -def base_get_metadata_monotone_revision(d): +def base_get_metadata_monotone_revision(path, d): monotone_revision = "<unknown>" try: - monotone_revision = file( "%s/_MTN/revision" % base_get_scmbasepath(d) ).read().strip() + monotone_revision = file( "%s/_MTN/revision" % path ).read().strip() if monotone_revision.startswith( "format_version" ): monotone_revision_words = monotone_revision.split() monotone_revision = monotone_revision_words[ monotone_revision_words.index( "old_revision" )+1][1:-1] @@ -797,82 +910,41 @@ def base_get_metadata_monotone_revision(d): pass return monotone_revision -def base_get_metadata_svn_revision(d): +def base_get_metadata_svn_revision(path, d): revision = "<unknown>" try: - revision = file( "%s/.svn/entries" % base_get_scmbasepath(d) ).readlines()[3].strip() + revision = file( "%s/.svn/entries" % path ).readlines()[3].strip() except IOError: pass return revision -def base_get_metadata_git_branch(d): - import os - branch = os.popen('cd %s; git branch | grep "^* " | tr -d "* "' % base_get_scmbasepath(d)).read() +def base_get_metadata_git_branch(path, d): + branch = os.popen('cd %s; PATH=%s git symbolic-ref HEAD 2>/dev/null' % (path, d.getVar("PATH", 1))).read().rstrip() if len(branch) != 0: - return branch + return branch.replace("refs/heads/", "") return "<unknown>" -def base_get_metadata_git_revision(d): - import os - rev = os.popen("cd %s; git log -n 1 --pretty=oneline --" % base_get_scmbasepath(d)).read().split(" ")[0] +def base_get_metadata_git_revision(path, d): + rev = os.popen("cd %s; PATH=%s git show-ref HEAD 2>/dev/null" % (path, d.getVar("PATH", 1))).read().split(" ")[0].rstrip() if len(rev) != 0: return rev return "<unknown>" -def base_detect_revision(d): - scms = [base_get_metadata_monotone_revision, \ - base_get_metadata_svn_revision, \ - base_get_metadata_git_revision] - - for scm in scms: - rev = scm(d) - if rev <> "<unknown>": - return rev - - return "<unknown>" - -def base_detect_branch(d): - scms = [base_get_metadata_monotone_branch, \ - base_get_metadata_git_branch] - - for scm in scms: - rev = scm(d) - if rev <> "<unknown>": - return rev.strip() - - return "<unknown>" - - - -METADATA_BRANCH ?= "${@base_detect_branch(d)}" -METADATA_REVISION ?= "${@base_detect_revision(d)}" addhandler base_eventhandler python base_eventhandler() { from bb import note, error, data from bb.event import Handled, NotHandled, getName - import os - messages = {} - messages["Completed"] = "completed" - messages["Succeeded"] = "completed" - messages["Started"] = "started" - messages["Failed"] = "failed" name = getName(e) - msg = "" - if name.startswith("Pkg"): - msg += "package %s: " % data.getVar("P", e.data, 1) - msg += messages.get(name[3:]) or name[3:] - elif name.startswith("Task"): - msg += "package %s: task %s: " % (data.getVar("PF", e.data, 1), e.task) - msg += messages.get(name[4:]) or name[4:] - elif name.startswith("Build"): - msg += "build %s: " % e.name - msg += messages.get(name[5:]) or name[5:] + if name == "TaskCompleted": + msg = "package %s: task %s is complete." % (data.getVar("PF", e.data, 1), e.task) elif name == "UnsatisfiedDep": - msg += "package %s: dependency %s %s" % (e.pkg, e.dep, name[:-3].lower()) + msg = "package %s: dependency %s %s" % (e.pkg, e.dep, name[:-3].lower()) + else: + return NotHandled # Only need to output when using 1.8 or lower, the UI code handles it # otherwise @@ -882,12 +954,12 @@ python base_eventhandler() { if name.startswith("BuildStarted"): bb.data.setVar( 'BB_VERSION', bb.__version__, e.data ) - statusvars = ['BB_VERSION', 'METADATA_BRANCH', 'METADATA_REVISION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TARGET_FPU'] + statusvars = bb.data.getVar("BUILDCFG_VARS", e.data, 1).split() statuslines = ["%-17s = \"%s\"" % (i, bb.data.getVar(i, e.data, 1) or '') for i in statusvars] - statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines) + statusmsg = "\n%s\n%s\n" % (bb.data.getVar("BUILDCFG_HEADER", e.data, 1), "\n".join(statuslines)) print statusmsg - needed_vars = [ "TARGET_ARCH", "TARGET_OS" ] + needed_vars = bb.data.getVar("BUILDCFG_NEEDEDVARS", e.data, 1).split() pesteruser = [] for v in needed_vars: val = bb.data.getVar(v, e.data, 1) @@ -937,12 +1009,87 @@ base_do_compile() { fi } -base_do_stage () { - : + +sysroot_stage_dir() { + src="$1" + dest="$2" + # This will remove empty directories so we can ignore them + rmdir "$src" 2> /dev/null || true + if [ -d "$src" ]; then + mkdir -p "$dest" + cp -fpPR "$src"/* "$dest" + fi +} + +sysroot_stage_libdir() { + src="$1" + dest="$2" + + olddir=`pwd` + cd $src + las=$(find . -name \*.la -type f) + cd $olddir + echo "Found la files: $las" + for i in $las + do + sed -e 's/^installed=yes$/installed=no/' \ + -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \ + -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \ + -i $src/$i + done + sysroot_stage_dir $src $dest +} + +sysroot_stage_dirs() { + from="$1" + to="$2" + + sysroot_stage_dir $from${includedir} $to${STAGING_INCDIR} + if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then + sysroot_stage_dir $from${bindir} $to${STAGING_DIR_HOST}${bindir} + sysroot_stage_dir $from${sbindir} $to${STAGING_DIR_HOST}${sbindir} + sysroot_stage_dir $from${base_bindir} $to${STAGING_DIR_HOST}${base_bindir} + sysroot_stage_dir $from${base_sbindir} $to${STAGING_DIR_HOST}${base_sbindir} + sysroot_stage_dir $from${libexecdir} $to${STAGING_DIR_HOST}${libexecdir} + if [ "${prefix}/lib" != "${libdir}" ]; then + # python puts its files in here, make sure they are staged as well + autotools_stage_dir $from/${prefix}/lib $to${STAGING_DIR_HOST}${prefix}/lib + fi + fi + if [ -d $from${libdir} ] + then + sysroot_stage_libdir $from/${libdir} $to${STAGING_LIBDIR} + fi + if [ -d $from${base_libdir} ] + then + sysroot_stage_libdir $from${base_libdir} $to${STAGING_DIR_HOST}${base_libdir} + fi + sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR} +} + +sysroot_stage_all() { + sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR} } -do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${layout_bindir} ${STAGING_DIR_TARGET}/${layout_libdir} \ - ${STAGING_DIR_TARGET}/${layout_includedir} \ +def is_legacy_staging(d): + stagefunc = bb.data.getVar('do_stage', d, True) + legacy = True + if stagefunc is None: + legacy = False + elif stagefunc.strip() == "autotools_stage_all": + legacy = False + elif stagefunc.strip() == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": + legacy = False + elif bb.data.getVar('NATIVE_INSTALL_WORKS', d, 1) == "1": + legacy = False + if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1": + legacy = True + if bb.data.getVar('FORCE_LEGACY_STAGING', d, 1) == "1": + legacy = True + return legacy + +do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \ + ${STAGING_DIR_TARGET}/${includedir} \ ${STAGING_BINDIR_NATIVE} ${STAGING_LIBDIR_NATIVE} \ ${STAGING_INCDIR_NATIVE} \ ${STAGING_DATADIR} \ @@ -951,8 +1098,61 @@ do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${layout_bindir} ${STAGING_DI # Could be compile but populate_staging and do_install shouldn't run at the same time addtask populate_staging after do_install +SYSROOT_PREPROCESS_FUNCS ?= "" +SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" +SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" + +python populate_staging_prehook () { + return +} + +python populate_staging_posthook () { + return +} + +packagedstaging_fastpath () { + : +} + python do_populate_staging () { - bb.build.exec_func('do_stage', d) + # + # if do_stage exists, we're legacy. In that case run the do_stage, + # modify the SYSROOT_DESTDIR variable and then run the staging preprocess + # functions against staging directly. + # + # Otherwise setup a destdir, copy the results from do_install + # and run the staging preprocess against that + # + pstageactive = (bb.data.getVar("PSTAGING_ACTIVE", d, True) == "1") + lockfile = bb.data.getVar("SYSROOT_LOCK", d, True) + stagefunc = bb.data.getVar('do_stage', d, True) + legacy = is_legacy_staging(d) + if legacy: + bb.data.setVar("SYSROOT_DESTDIR", "", d) + bb.note("Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) + if bb.data.getVarFlags('do_stage', d) is None: + bb.fatal("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True)) + lock = bb.utils.lockfile(lockfile) + bb.build.exec_func('populate_staging_prehook', d) + bb.build.exec_func('do_stage', d) + for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): + bb.build.exec_func(f, d) + bb.build.exec_func('populate_staging_posthook', d) + bb.utils.unlockfile(lock) + else: + dest = bb.data.getVar('D', d, True) + sysrootdest = bb.data.expand('${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}', d) + bb.mkdirhier(sysrootdest) + + bb.build.exec_func("sysroot_stage_all", d) + #os.system('cp -pPR %s/* %s/' % (dest, sysrootdest)) + for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split(): + bb.build.exec_func(f, d) + bb.build.exec_func("packagedstaging_fastpath", d) + + lock = bb.utils.lockfile(lockfile) + os.system(bb.data.expand('cp -pPR ${SYSROOT_DESTDIR}${TMPDIR}/* ${TMPDIR}/', d)) + bb.utils.unlockfile(lock) } addtask install after do_compile @@ -972,6 +1172,8 @@ addtask build after do_populate_staging do_build = "" do_build[func] = "1" +inherit packagedata + # Functions that update metadata based on files outputted # during the build process. @@ -992,75 +1194,6 @@ def explode_deps(s): r.append(i) return r -def packaged(pkg, d): - import os, bb - return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK) - -def read_pkgdatafile(fn): - pkgdata = {} - - def decode(str): - import codecs - c = codecs.getdecoder("string_escape") - return c(str)[0] - - import os - if os.access(fn, os.R_OK): - import re - f = file(fn, 'r') - lines = f.readlines() - f.close() - r = re.compile("([^:]+):\s*(.*)") - for l in lines: - m = r.match(l) - if m: - pkgdata[m.group(1)] = decode(m.group(2)) - - return pkgdata - -def get_subpkgedata_fn(pkg, d): - import bb, os - archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ") - archs.reverse() - pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d) - targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d) - for arch in archs: - fn = pkgdata + arch + targetdir + pkg - if os.path.exists(fn): - return fn - return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d) - -def has_subpkgdata(pkg, d): - import bb, os - return os.access(get_subpkgedata_fn(pkg, d), os.R_OK) - -def read_subpkgdata(pkg, d): - import bb - return read_pkgdatafile(get_subpkgedata_fn(pkg, d)) - -def has_pkgdata(pn, d): - import bb, os - fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) - return os.access(fn, os.R_OK) - -def read_pkgdata(pn, d): - import bb - fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) - return read_pkgdatafile(fn) - -python read_subpackage_metadata () { - import bb - data = read_pkgdata(bb.data.getVar('PN', d, 1), d) - - for key in data.keys(): - bb.data.setVar(key, data[key], d) - - for pkg in bb.data.getVar('PACKAGES', d, 1).split(): - sdata = read_subpkgdata(pkg, d) - for key in sdata.keys(): - bb.data.setVar(key, sdata[key], d) -} - # Make sure MACHINE isn't exported # (breaks binutils at least) MACHINE[unexport] = "1" @@ -1076,7 +1209,7 @@ DISTRO[unexport] = "1" def base_after_parse(d): - import bb, os, exceptions + import exceptions source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0) if not source_mirror_fetch: @@ -1159,19 +1292,12 @@ def base_after_parse(d): bb.data.setVar('MULTIMACH_ARCH', multiarch, d) python () { - import bb - from bb import __version__ base_after_parse(d) + if is_legacy_staging(d): + bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) + if bb.data.getVarFlags('do_stage', d) is None: + bb.error("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True)) - # Remove this for bitbake 1.8.12 - 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(__version__) >= LooseVersion('1.8.11')): - deps = bb.data.getVarFlag('do_rebuild', 'deps', d) or [] - deps.append('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1)) - bb.data.setVarFlag('do_rebuild', 'deps', deps, d) } def check_app_exists(app, d): @@ -1181,16 +1307,6 @@ def check_app_exists(app, d): path = data.getVar('PATH', d, 1) return len(which(path, app)) != 0 -def check_gcc3(data): - - gcc3_versions = 'gcc-3.4 gcc34 gcc-3.4.4 gcc-3.4.6 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32' - - for gcc3 in gcc3_versions.split(): - if check_app_exists(gcc3, data): - return gcc3 - - return False - # Patch handling inherit patch @@ -1198,7 +1314,7 @@ inherit patch # Move to autotools.bbclass? inherit siteinfo -EXPORT_FUNCTIONS do_setscene do_clean do_mrproper do_distclean do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_stage do_rebuild do_fetchall +EXPORT_FUNCTIONS do_setscene do_clean do_mrproper do_distclean do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_rebuild do_fetchall MIRRORS[func] = "0" MIRRORS () { @@ -1221,7 +1337,6 @@ ${DEBIAN_MIRROR} ftp://ftp.es.debian.org/debian/pool ${DEBIAN_MIRROR} ftp://ftp.se.debian.org/debian/pool ${DEBIAN_MIRROR} ftp://ftp.tr.debian.org/debian/pool ${GNU_MIRROR} ftp://mirrors.kernel.org/gnu -${GNU_MIRROR} ftp://ftp.matrix.com.br/pub/gnu ${GNU_MIRROR} ftp://ftp.cs.ubc.ca/mirror2/gnu ${GNU_MIRROR} ftp://sunsite.ust.hk/pub/gnu ${GNU_MIRROR} ftp://ftp.ayamura.org/pub/gnu @@ -1255,6 +1370,10 @@ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://gd.tuwien.ac.at/utils/adm ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://sunsite.ualberta.ca/pub/Mirror/lsof/ ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ ftp://the.wiretapped.net/pub/security/host-security/lsof/ http://www.apache.org/dist http://archive.apache.org/dist +ftp://.*/.* http://mirrors.openembedded.org/ +https?$://.*/.* http://mirrors.openembedded.org/ +ftp://.*/.* http://sources.openembedded.org/ +https?$://.*/.* http://sources.openembedded.org/ } diff --git a/classes/binconfig.bbclass b/classes/binconfig.bbclass index 5789903178..b3b2236709 100644 --- a/classes/binconfig.bbclass +++ b/classes/binconfig.bbclass @@ -1,10 +1,7 @@ -inherit base - FILES_${PN}-dev += "${bindir}/*-config" # The namespaces can clash here hence the two step replace def get_binconfig_mangle(d): - import bb.data s = "-e ''" if not bb.data.inherits_class('native', d): optional_quote = r"\(\"\?\)" @@ -18,8 +15,8 @@ def get_binconfig_mangle(d): s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'" s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'" s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'" - s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${layout_prefix}:'" - s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${layout_exec_prefix}:'" + s += " -e 's:OEPREFIX:${STAGING_DIR_HOST}${prefix}:'" + s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${exec_prefix}:'" s += " -e 's:-I${WORKDIR}:-I${STAGING_INCDIR}:'" s += " -e 's:-L${WORKDIR}:-L${STAGING_LIBDIR}:'" if bb.data.getVar("OE_BINCONFIG_EXTRA_MANGLE", d): @@ -28,34 +25,34 @@ def get_binconfig_mangle(d): BINCONFIG_GLOB ?= "*-config" -do_install_append() { - - #the 'if' protects native packages, since we can't easily check for bb.data.inherits_class('native', d) in shell - if [ -e ${D}${bindir} ] ; then - for config in `find ${S} -name '${BINCONFIG_GLOB}'`; do - cat $config | sed \ - -e 's:${STAGING_LIBDIR}:${libdir}:g;' \ - -e 's:${STAGING_INCDIR}:${includedir}:g;' \ - -e 's:${STAGING_DATADIR}:${datadir}:' \ - -e 's:${STAGING_DIR_HOST}${layout_prefix}:${prefix}:' > ${D}${bindir}/`basename $config` - done - fi +PACKAGE_PREPROCESS_FUNCS += "binconfig_package_preprocess" - for lafile in `find ${D} -name "*.la"` ; do +binconfig_package_preprocess () { + for config in `find ${PKGD} -name '${BINCONFIG_GLOB}'`; do + sed -i \ + -e 's:${STAGING_LIBDIR}:${libdir}:g;' \ + -e 's:${STAGING_INCDIR}:${includedir}:g;' \ + -e 's:${STAGING_DATADIR}:${datadir}:' \ + -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \ + $config + done + for lafile in `find ${PKGD} -name "*.la"` ; do sed -i \ -e 's:${STAGING_LIBDIR}:${libdir}:g;' \ -e 's:${STAGING_INCDIR}:${includedir}:g;' \ -e 's:${STAGING_DATADIR}:${datadir}:' \ - -e 's:${STAGING_DIR_HOST}${layout_prefix}:${prefix}:' \ + -e 's:${STAGING_DIR_HOST}${prefix}:${prefix}:' \ $lafile done } -do_stage_append() { +SYSROOT_PREPROCESS_FUNCS += "binconfig_sysroot_preprocess" + +binconfig_sysroot_preprocess () { for config in `find ${S} -name '${BINCONFIG_GLOB}'`; do configname=`basename $config` - install -d ${STAGING_BINDIR_CROSS} - cat $config | sed ${@get_binconfig_mangle(d)} > ${STAGING_BINDIR_CROSS}/$configname - chmod u+x ${STAGING_BINDIR_CROSS}/$configname + install -d ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS} + cat $config | sed ${@get_binconfig_mangle(d)} > ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname + chmod u+x ${SYSROOT_DESTDIR}${STAGING_BINDIR_CROSS}/$configname done } diff --git a/classes/canadian-cross.bbclass b/classes/canadian-cross.bbclass index 474fb1d2ba..514aaeb414 100644 --- a/classes/canadian-cross.bbclass +++ b/classes/canadian-cross.bbclass @@ -1,3 +1,8 @@ +# +# Note this class is deprecated and replaced by cross-canadian.bbclass +# + + # Canadian cross packages are built indirectly via dependency, # no need for them to be a direct target of 'world' EXCLUDE_FROM_WORLD = "1" @@ -41,31 +46,31 @@ oldincludedir = "${exec_prefix}/include" # Path prefixes export base_prefix = "${STAGING_DIR_HOST}" -export prefix = "${STAGING_DIR_HOST}${layout_prefix}" -export exec_prefix = "${STAGING_DIR_HOST}${layout_exec_prefix}" +export prefix = "${STAGING_DIR_HOST}/usr" +export exec_prefix = "${STAGING_DIR_HOST}/usr" # Base paths -export base_bindir = "${STAGING_DIR_HOST}${layout_base_bindir}" -export base_sbindir = "${STAGING_DIR_HOST}${layout_base_sbindir}" -export base_libdir = "${STAGING_DIR_HOST}${layout_base_libdir}" +export base_bindir = "${STAGING_DIR_HOST}/bin" +export base_sbindir = "${STAGING_DIR_HOST}/sbin" +export base_libdir = "${STAGING_DIR_HOST}/lib" # Architecture independent paths -export datadir = "${STAGING_DIR_HOST}${layout_datadir}" -export sysconfdir = "${STAGING_DIR_HOST}${layout_sysconfdir}" -export sharedstatedir = "${STAGING_DIR_HOST}${layout_sharedstatedir}" -export localstatedir = "${STAGING_DIR_HOST}${layout_localstatedir}" -export infodir = "${STAGING_DIR_HOST}${layout_infodir}" -export mandir = "${STAGING_DIR_HOST}${layout_mandir}" -export docdir = "${STAGING_DIR_HOST}${layout_docdir}" -export servicedir = "${STAGING_DIR_HOST}${layout_servicedir}" +export datadir = "${STAGING_DIR_HOST}/usr/share" +export sysconfdir = "${STAGING_DIR_HOST}/etc" +export sharedstatedir = "${STAGING_DIR_HOST}/com" +export localstatedir = "${STAGING_DIR_HOST}/var" +export infodir = "${STAGING_DIR_HOST}/usr/info" +export mandir = "${STAGING_DIR_HOST}/usr/man" +export docdir = "${STAGING_DIR_HOST}/usr/doc" +export servicedir = "${STAGING_DIR_HOST}/srv" # Architecture dependent paths -export bindir = "${STAGING_DIR_HOST}${layout_bindir}" -export sbindir = "${STAGING_DIR_HOST}${layout_sbindir}" -export libexecdir = "${STAGING_DIR_HOST}${layout_libexecdir}" -export libdir = "${STAGING_DIR_HOST}${layout_libdir}" -export includedir = "${STAGING_DIR_HOST}${layout_includedir}" -export oldincludedir = "${STAGING_DIR_HOST}${layout_includedir}" +export bindir = "${STAGING_DIR_HOST}/usr/bin" +export sbindir = "${STAGING_DIR_HOST}/usr/sbin" +export libexecdir = "${STAGING_DIR_HOST}/usr/libexec" +export libdir = "${STAGING_DIR_HOST}/usr/lib" +export includedir = "${STAGING_DIR_HOST}/usr/include" +export oldincludedir = "${STAGING_DIR_HOST}/usr/include" do_stage () { oe_runmake install diff --git a/classes/canadian-native.bbclass b/classes/canadian-native.bbclass index d572ab5990..3cd003cb4b 100644 --- a/classes/canadian-native.bbclass +++ b/classes/canadian-native.bbclass @@ -1,4 +1,6 @@ -inherit base +# +# Note this class is deprecated and replaced by nativesdk.bbclass +# # Canadian native packages are built indirectly via dependency, # no need for them to be a direct target of 'world' @@ -43,33 +45,14 @@ export AS = "${SDK_PREFIX}as" export RANLIB = "${SDK_PREFIX}ranlib" export STRIP = "${SDK_PREFIX}strip" -# Path prefixes -export base_prefix = "${STAGING_DIR_HOST}" -export prefix = "${STAGING_DIR_HOST}${layout_prefix}" -export exec_prefix = "${STAGING_DIR_HOST}${layout_exec_prefix}" -# Base paths -export base_bindir = "${STAGING_DIR_HOST}${layout_base_bindir}" -export base_sbindir = "${STAGING_DIR_HOST}${layout_base_sbindir}" -export base_libdir = "${STAGING_DIR_HOST}${layout_base_libdir}" +# Change to place files in SDKPATH +prefix = "${SDKPATH}" +exec_prefix = "${SDKPATH}" +base_prefix = "${SDKPATH}" -# Architecture independent paths -export datadir = "${STAGING_DIR_HOST}${layout_datadir}" -export sysconfdir = "${STAGING_DIR_HOST}${layout_sysconfdir}" -export sharedstatedir = "${STAGING_DIR_HOST}${layout_sharedstatedir}" -export localstatedir = "${STAGING_DIR_HOST}${layout_localstatedir}" -export infodir = "${STAGING_DIR_HOST}${layout_infodir}" -export mandir = "${STAGING_DIR_HOST}${layout_mandir}" -export docdir = "${STAGING_DIR_HOST}${layout_docdir}" -export servicedir = "${STAGING_DIR_HOST}${layout_servicedir}" - -# Architecture dependent paths -export bindir = "${STAGING_DIR_HOST}${layout_bindir}" -export sbindir = "${STAGING_DIR_HOST}${layout_sbindir}" -export libexecdir = "${STAGING_DIR_HOST}${layout_libexecdir}" -export libdir = "${STAGING_DIR_HOST}${layout_libdir}" -export includedir = "${STAGING_DIR_HOST}${layout_includedir}" -export oldincludedir = "${STAGING_DIR_HOST}${layout_includedir}" +export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig" +export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" do_stage () { if [ "${INHIBIT_NATIVE_STAGE_INSTALL}" != "1" ] diff --git a/classes/canadian-sdk.bbclass b/classes/canadian-sdk.bbclass index d73b62f485..94db57796e 100644 --- a/classes/canadian-sdk.bbclass +++ b/classes/canadian-sdk.bbclass @@ -1,3 +1,7 @@ +# +# Note this class is deprecated and replaced by crosssdk.bbclass +# + # Canadian SDK packages are built either explicitly by the user, # or indirectly via dependency. No need to be in 'world'. EXCLUDE_FROM_WORLD = "1" @@ -19,14 +23,13 @@ CFLAGS = "${SDK_CFLAGS}" CXXFLAGS = "${SDK_CFLAGS}" LDFLAGS = "${SDK_LDFLAGS}" -# TODO: add logic to add the following unless PN ~= gcc* -#DEPENDS_prepend = "virtual/${HOST_PREFIX}binutils virtual/${HOST_PREFIX}gcc " -# and otherwise just -DEPENDS_prepend = "virtual/${HOST_PREFIX}binutils " +DEPENDS_prepend = "virtual/${HOST_PREFIX}binutils virtual/${HOST_PREFIX}gcc " -SDK_PATH_sdk-mingw32 = "/OpenEmbedded/${SDK_NAME}" +# On mingw systems we want to have the real sysroot default to c:/... and +# assume that the default install will be on the C drive. This can be changed +# by setting SDK_REALPATH_MINGW. SDK_REALPATH = "${SDK_PATH}" -SDK_REALPATH_sdk-mingw32 = "C:/OpenEmbedded/${SDK_NAME}" +SDK_REALPATH_MINGW ?= "C:" # Path prefixes prefix = "${SDK_PATH}" diff --git a/classes/canadian.bbclass b/classes/canadian.bbclass index f359a8df7f..8edce1412c 100644 --- a/classes/canadian.bbclass +++ b/classes/canadian.bbclass @@ -1,3 +1,8 @@ +# +# Note this class is deprecated +# + + # For Canadian SDKs we need to know what these values start out as, and use # them as well as the updated ones. OLD_PACKAGE_ARCH := "${PACKAGE_ARCH}" diff --git a/classes/chicken.bbclass b/classes/chicken.bbclass new file mode 100644 index 0000000000..5ebe1ff462 --- /dev/null +++ b/classes/chicken.bbclass @@ -0,0 +1,11 @@ +def chicken_arch(bb, d): + import re + arch_pattern = re.compile('^i.*86$') + target_arch = d.getVar("TARGET_ARCH", 1) + if arch_pattern.match(target_arch): + return 'x86' + else: + return target_arch + +CHICKEN_ARCH = "${@chicken_arch(bb, d)}" + diff --git a/classes/clean.bbclass b/classes/clean.bbclass new file mode 100644 index 0000000000..65c1ab5d76 --- /dev/null +++ b/classes/clean.bbclass @@ -0,0 +1,53 @@ +def clean_builddir(d): + from shutil import rmtree + + builddir = d.getVar("B", True) + srcdir = d.getVar("S", True) + if builddir != srcdir: + rmtree(builddir, ignore_errors=True) + +def clean_stamps(d): + from glob import glob + from bb import note + from bb.data import expand + from os import unlink + + note("Removing stamps") + for stamp in glob(expand('${STAMP}.*', d)): + try: + unlink(stamp) + except OSError: + pass + +def clean_workdir(d): + from shutil import rmtree + from bb import note + + workdir = d.getVar("WORKDIR", 1) + note("Removing %s" % workdir) + rmtree(workdir, ignore_errors=True) + +def clean_git(d): + from subprocess import call + + call(["git", "clean", "-d", "-f", "-X"], cwd=d.getVar("S", True)) + +def clean_make(d): + import bb + + bb.note("Running make clean") + try: + bb.build.exec_func("__do_clean_make", d) + except bb.build.FuncFailed: + pass + +__do_clean_make () { + oe_runmake clean +} + +python do_clean () { + clean_stamps(d) + clean_workdir(d) + clean_builddir(d) + clean_make(d) +} diff --git a/classes/cmake.bbclass b/classes/cmake.bbclass index faa4768d90..f21c4d6545 100644 --- a/classes/cmake.bbclass +++ b/classes/cmake.bbclass @@ -1,12 +1,46 @@ DEPENDS += " cmake-native " # We want the staging and installing functions from autotools -inherit autotools +inherit autotools_stage + +# Use in-tree builds by default but allow this to be changed +# since some packages do not support them (e.g. llvm 2.5). +OECMAKE_SOURCEPATH ?= "." + +# If declaring this, make sure you also set EXTRA_OEMAKE to +# "-C ${OECMAKE_BUILDPATH}". So it will run the right makefiles. +OECMAKE_BUILDPATH ?= "" cmake_do_configure() { - cmake . -DCMAKE_INSTALL_PREFIX:PATH=${prefix} -Wno-dev \ - -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \ - ${EXTRA_OECMAKE} + if [ ${OECMAKE_BUILDPATH} ] + then + mkdir ${OECMAKE_BUILDPATH} + cd ${OECMAKE_BUILDPATH} + fi + + cmake ${OECMAKE_SOURCEPATH} \ + -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ + -DCMAKE_FIND_ROOT_PATH:PATH=${STAGING_DIR_HOST} \ + ${EXTRA_OECMAKE} \ + -Wno-dev +} + +cmake_do_compile() { + if [ ${OECMAKE_BUILDPATH} ] + then + cd ${OECMAKE_BUILDPATH} + fi + + base_do_compile +} + +cmake_do_install() { + if [ ${OECMAKE_BUILDPATH} ]; + then + cd ${OECMAKE_BUILDPATH} + fi + + autotools_do_install } -EXPORT_FUNCTIONS do_configure +EXPORT_FUNCTIONS do_configure do_compile do_install diff --git a/classes/corecdp-mirrors.bbclass b/classes/corecdp-mirrors.bbclass new file mode 100644 index 0000000000..0d1f0b4a7b --- /dev/null +++ b/classes/corecdp-mirrors.bbclass @@ -0,0 +1,4 @@ +MIRRORS_append () { +ftp://.*/.* http://www.multitech.net/corecdp/sources/ +https?$://.*/.* http://www.multitech.net/corecdp/sources/ +} diff --git a/classes/cpan-base.bbclass b/classes/cpan-base.bbclass index 19d431ce72..82fd5b459a 100644 --- a/classes/cpan-base.bbclass +++ b/classes/cpan-base.bbclass @@ -9,8 +9,8 @@ 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}/perl/config.sh', d) + import re + cfg = bb.data.expand('${STAGING_LIBDIR}/perl/config.sh', d) try: f = open(cfg, 'r') except IOError: @@ -33,7 +33,6 @@ def is_new_perl(d): # 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' @@ -42,7 +41,6 @@ def perl_get_libdirs(d): return libdirs def is_target(d): - import bb if not bb.data.inherits_class('native', d): return "yes" return "no" diff --git a/classes/cpan.bbclass b/classes/cpan.bbclass index 7b3faa2561..66054bc755 100644 --- a/classes/cpan.bbclass +++ b/classes/cpan.bbclass @@ -16,7 +16,7 @@ export PERL_ARCHLIB = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}" cpan_do_configure () { yes '' | perl Makefile.PL ${EXTRA_CPANFLAGS} if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then - . ${STAGING_DIR_TARGET}/perl/config.sh + . ${STAGING_LIBDIR}/perl/config.sh if [ "${IS_NEW_PERL}" = "yes" ]; then sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \ -e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \ diff --git a/classes/cpan_build.bbclass b/classes/cpan_build.bbclass index c3804ff4cc..b2ec8255de 100644 --- a/classes/cpan_build.bbclass +++ b/classes/cpan_build.bbclass @@ -12,7 +12,6 @@ INHIBIT_NATIVE_STAGE_INSTALL = "1" # libmodule-build-perl) # def cpan_build_dep_prepend(d): - import bb; if bb.data.getVar('CPAN_BUILD_DEPS', d, 1): return '' pn = bb.data.getVar('PN', d, 1) @@ -25,7 +24,7 @@ DEPENDS_prepend = "${@cpan_build_dep_prepend(d)}" cpan_build_do_configure () { if [ ${@is_target(d)} == "yes" ]; then # build for target - . ${STAGING_DIR_TARGET}/perl/config.sh + . ${STAGING_LIBDIR}/perl/config.sh if [ "${IS_NEW_PERL}" = "yes" ]; then perl Build.PL --installdirs vendor \ --destdir ${D} \ diff --git a/classes/cross-canadian.bbclass b/classes/cross-canadian.bbclass new file mode 100644 index 0000000000..bd738ecd4d --- /dev/null +++ b/classes/cross-canadian.bbclass @@ -0,0 +1,46 @@ +# SDK packages are built either explicitly by the user, +# or indirectly via dependency. No need to be in 'world'. +EXCLUDE_FROM_WORLD = "1" + +# Save MULTIMACH_ARCH +OLD_MULTIMACH_ARCH := "${MULTIMACH_ARCH}" +# Save PACKAGE_ARCH +OLD_PACKAGE_ARCH := ${PACKAGE_ARCH} +PACKAGE_ARCH = "${SDK_ARCH}-${TARGET_ARCH}-canadian" +PACKAGE_ARCHS = "${PACKAGE_ARCH}" +# Also save BASE_PACKAGE_ARCH since HOST_ARCH can influence it +OLD_BASE_PACKAGE_ARCH := "${BASE_PACKAGE_ARCH}" +BASE_PACKAGE_ARCH = "${OLD_BASE_PACKAGE_ARCH}" + +INHIBIT_DEFAULT_DEPS = "1" + +STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_SYS}-nativesdk" +STAGING_DIR_TARGET = "${STAGING_DIR}/${BASEPKG_TARGET_SYS}" + +PATH_append = ":${TMPDIR}/cross/${HOST_ARCH}/${bindir_cross}" +PKGDATA_DIR = "${TMPDIR}/pkgdata/${HOST_ARCH}-nativesdk${HOST_VENDOR}-${HOST_OS}" + +HOST_ARCH = "${SDK_ARCH}" +HOST_VENDOR = "${SDK_VENDOR}" +HOST_OS = "${SDK_OS}" +HOST_PREFIX = "${SDK_PREFIX}" +HOST_CC_ARCH = "${SDK_CC_ARCH}" + +CPPFLAGS = "${BUILDSDK_CPPFLAGS}" +CFLAGS = "${BUILDSDK_CFLAGS}" +CXXFLAGS = "${BUILDSDK_CFLAGS}" +LDFLAGS = "${BUILDSDK_LDFLAGS}" + +# Change to place files in SDKPATH +prefix = "${SDKPATH}" +exec_prefix = "${SDKPATH}" +base_prefix = "${SDKPATH}" + +FILES_${PN} = "${prefix}" +FILES_${PN}-dbg += "${prefix}/.debug \ + ${prefix}/bin/.debug \ + " + +export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${layout_libdir}/pkgconfig" +export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" + diff --git a/classes/cross.bbclass b/classes/cross.bbclass index 7debde6669..1de157c0f5 100644 --- a/classes/cross.bbclass +++ b/classes/cross.bbclass @@ -17,6 +17,7 @@ HOST_OS = "${BUILD_OS}" HOST_PREFIX = "${BUILD_PREFIX}" HOST_CC_ARCH = "${BUILD_CC_ARCH}" HOST_EXEEXT = "${BUILD_EXEEXT}" +BASEPKG_HOST_SYS = "${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}" CPPFLAGS = "${BUILD_CPPFLAGS}" CFLAGS = "${BUILD_CFLAGS}" @@ -27,34 +28,11 @@ LDFLAGS_build-darwin = "-L${STAGING_LIBDIR_NATIVE}" TOOLCHAIN_OPTIONS = "" # Overrides for paths - -# Path prefixes -base_prefix = "${exec_prefix}" prefix = "${CROSS_DIR}" +base_prefix = "${prefix}" exec_prefix = "${prefix}" - -# Base paths -base_bindir = "${base_prefix}/bin" base_sbindir = "${base_prefix}/bin" -base_libdir = "${base_prefix}/lib" - -# Architecture independent paths -datadir = "${prefix}/share" -sysconfdir = "${prefix}/etc" -sharedstatedir = "${prefix}/com" -localstatedir = "${prefix}/var" -infodir = "${datadir}/info" -mandir = "${datadir}/man" -docdir = "${datadir}/doc" -servicedir = "${prefix}/srv" - -# Architecture dependent paths -bindir = "${exec_prefix}/bin" sbindir = "${exec_prefix}/bin" -libexecdir = "${exec_prefix}/libexec" -libdir = "${exec_prefix}/lib" -includedir = "${exec_prefix}/include" -oldincludedir = "${exec_prefix}/include" do_stage () { oe_runmake install diff --git a/classes/crosssdk.bbclass b/classes/crosssdk.bbclass new file mode 100644 index 0000000000..0b1af8fc2f --- /dev/null +++ b/classes/crosssdk.bbclass @@ -0,0 +1,15 @@ +inherit cross + +PACKAGES = "" + +BASE_PACKAGE_ARCH = "${SDK_ARCH}" +PACKAGE_ARCH = "${BASE_PACKAGE_ARCH}" +STAGING_DIR_TARGET = "${STAGING_DIR}/${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}" + +TARGET_ARCH = "${SDK_ARCH}" +TARGET_VENDOR = "${SDK_VENDOR}" +TARGET_OS = "${SDK_OS}" +TARGET_PREFIX = "${SDK_PREFIX}" +TARGET_CC_ARCH = "${SDK_CC_ARCH}" + + diff --git a/classes/debian.bbclass b/classes/debian.bbclass index 0afe9fcc39..8f6e7d88cf 100644 --- a/classes/debian.bbclass +++ b/classes/debian.bbclass @@ -16,7 +16,7 @@ do_package_write_rpm[rdeptask] = "do_package" python debian_package_name_hook () { import glob, copy, stat, errno, re - workdir = bb.data.getVar('WORKDIR', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, 1) packages = bb.data.getVar('PACKAGES', d, 1) def socrunch(s): @@ -45,7 +45,7 @@ python debian_package_name_hook () { sonames = [] has_bins = 0 has_libs = 0 - pkg_dir = os.path.join(workdir, "install", orig_pkg) + pkg_dir = os.path.join(pkgdest, orig_pkg) for root, dirs, files in os.walk(pkg_dir): if bin_re.match(root) and files: has_bins = 1 diff --git a/classes/devshell.bbclass b/classes/devshell.bbclass index 2944dbbfc2..9327b55d0a 100644 --- a/classes/devshell.bbclass +++ b/classes/devshell.bbclass @@ -4,7 +4,8 @@ do_devshell[dirs] = "${S}" do_devshell[nostamp] = "1" export DISPLAY -export XAUTHORITY +export DBUS_SESSION_BUS_ADDRESS +export XAUTHORITY ?= "${HOME}/.Xauthority" devshell_do_devshell() { export TERMWINDOWTITLE="Bitbake Developer Shell" diff --git a/classes/dietlibc.bbclass b/classes/dietlibc.bbclass index 7c7b5fec81..2676385197 100644 --- a/classes/dietlibc.bbclass +++ b/classes/dietlibc.bbclass @@ -4,18 +4,18 @@ def dietlibc_after_parse(d): import bb # Remove the NLS cfg = oe_filter_out('--(dis|en)able-nls', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d) - # Remove shared and static and set it right - cfg += " --disable-nls --disbale-shared --enable-static" + # Remove shared enable static only + cfg += " --disable-nls --disable-shared --enable-static" bb.data.setVar('EXTRA_OECONF', cfg, d) cfg = bb.data.getVar('EXTRA_OEMAKE', d, 1) or "" cfg = oe_filter_out("\'CC=", bb.data.getVar('EXTRA_OEMAKE', d, 1) or "", d) - cfgtmp = "\'CC=diet ${CCACHE}" + cfgtmp = "\'CC=\"diet ${CCACHE}\"" cfgtmp += cfg bb.data.setVar('EXTRA_OEMAKE', cfgtmp, d) -python () { - dietlibc_after_parse(d) -} +#python () { +# dietlibc_after_parse(d) +#} set_dietlibc_env () { export CC="diet ${CC}" diff --git a/classes/distutils-base.bbclass b/classes/distutils-base.bbclass index a08414aadf..2e151ded38 100644 --- a/classes/distutils-base.bbclass +++ b/classes/distutils-base.bbclass @@ -1,29 +1,5 @@ -EXTRA_OEMAKE = "" DEPENDS += "${@["python-native python", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" RDEPENDS += "python-core" -export STAGING_INCDIR -export STAGING_LIBDIR +inherit distutils-common-base -def python_dir(d): - import os, bb - staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 ) - for majmin in "2.6 2.5 2.4 2.3".split(): - if os.path.exists( "%s/python%s" % ( staging_incdir, majmin ) ): return "python%s" % majmin - raise "No Python in STAGING_INCDIR. Forgot to build python-native ?" - -PYTHON_DIR = "${@python_dir(d)}" - -PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-doc ${PN}" - -FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" - -FILES_${PN}-dev += "\ - ${libdir}/pkgconfig \ - ${libdir}/${PYTHON_DIR}/site-packages/*.la \ -" -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-common-base.bbclass b/classes/distutils-common-base.bbclass new file mode 100644 index 0000000000..01bf9eaeba --- /dev/null +++ b/classes/distutils-common-base.bbclass @@ -0,0 +1,30 @@ +EXTRA_OEMAKE = "" + +export STAGING_INCDIR +export STAGING_LIBDIR + +def python_dir(d): + import os, bb + staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 ) + for majmin in "2.6 2.5 2.4 2.3".split(): + if os.path.exists( "%s/python%s" % ( staging_incdir, majmin ) ): return "python%s" % majmin + if not "python-native" in bb.data.getVar( "DEPENDS", d, 1 ).split(): + raise "No Python in STAGING_INCDIR. Forgot to build python-native ?" + return "INVALID" + +PYTHON_DIR = "${@python_dir(d)}" + +PACKAGES = "${PN}-dev ${PN}-dbg ${PN}-doc ${PN}" + +FILES_${PN} = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" + +FILES_${PN}-dev += "\ + ${datadir}/pkgconfig \ + ${libdir}/pkgconfig \ + ${libdir}/${PYTHON_DIR}/site-packages/*.la \ +" +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-native-base.bbclass b/classes/distutils-native-base.bbclass new file mode 100644 index 0000000000..2703fe0740 --- /dev/null +++ b/classes/distutils-native-base.bbclass @@ -0,0 +1,3 @@ +DEPENDS += "${@["python-native", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" + +inherit distutils-common-base diff --git a/classes/distutils.bbclass b/classes/distutils.bbclass index ea4184b235..4d1fc8c6fc 100644 --- a/classes/distutils.bbclass +++ b/classes/distutils.bbclass @@ -2,7 +2,7 @@ inherit distutils-base DISTUTILS_BUILD_ARGS ?= "" DISTUTILS_STAGE_HEADERS_ARGS ?= "--install-dir=${STAGING_INCDIR}/${PYTHON_DIR}" -DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${layout_prefix} \ +DISTUTILS_STAGE_ALL_ARGS ?= "--prefix=${STAGING_DIR_HOST}${prefix} \ --install-data=${STAGING_DATADIR}" DISTUTILS_INSTALL_ARGS ?= "--prefix=${D}/${prefix} \ --install-data=${D}/${datadir}" @@ -16,7 +16,7 @@ distutils_do_compile() { } distutils_stage_headers() { - install -d ${STAGING_DIR_HOST}${layout_libdir}/${PYTHON_DIR}/site-packages + install -d ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ ${STAGING_BINDIR_NATIVE}/python setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \ oefatal "python setup.py install_headers execution failed." @@ -25,8 +25,8 @@ distutils_stage_headers() { distutils_stage_all() { STAGING_INCDIR=${STAGING_INCDIR} \ STAGING_LIBDIR=${STAGING_LIBDIR} \ - install -d ${STAGING_DIR_HOST}${layout_libdir}/${PYTHON_DIR}/site-packages - PYTHONPATH=${STAGING_DIR_HOST}${layout_libdir}/${PYTHON_DIR}/site-packages \ + install -d ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages + PYTHONPATH=${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages \ BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ ${STAGING_BINDIR_NATIVE}/python setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \ oefatal "python setup.py install (stage) execution failed." diff --git a/classes/e.bbclass b/classes/e.bbclass index a56cdff2e1..fca9aa0010 100644 --- a/classes/e.bbclass +++ b/classes/e.bbclass @@ -21,7 +21,9 @@ do_configure_append() { export CURL_CONFIG = "${STAGING_BINDIR_CROSS}/curl-config" export FREETYPE_CONFIG = "${STAGING_BINDIR_CROSS}/freetype-config" -PACKAGES = "${PN}-dbg ${PN}-themes ${PN} ${PN}-dev ${PN}-lib" +# This construction is stupid, someone with more E knowledge should change it to =+ or something +# And it's in efl.bbclass as well.... +PACKAGES = "${PN}-dbg ${PN}-themes ${PN} ${PN}-dev ${PN}-doc ${PN}-lib ${PN}-static" FILES_${PN}-lib = "${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 index d333c4b434..900d9c7f0d 100644 --- a/classes/efl.bbclass +++ b/classes/efl.bbclass @@ -11,15 +11,23 @@ PE = "2" ARM_INSTRUCTION_SET = "arm" -AUTOTOOLS_STAGE_PKGCONFIG = "1" -# do NOT inherit pkgconfig here, see note in autotools_stage_all inherit autotools -do_stage() { - autotools_stage_all +# evas-native looks at this var, so keep it +AUTOTOOLS_STAGE_PKGCONFIG = "1" + +do_configure_prepend() { + touch config.rpath } -PACKAGES = "${PN}-dbg ${PN} ${PN}-themes ${PN}-dev ${PN}-tests" +do_install_prepend () { + for i in `find ${S}/ -name "*.pc" -type f` ; do \ + sed -i -e 's:-L${STAGING_LIBDIR}::g' -e 's:-I${STAGING_INCDIR}::g' $i + done +} + +# This construction is stupid, someone with more E knowledge should change it to =+ or something +PACKAGES = "${PN}-dbg ${PN} ${PN}-themes ${PN}-dev ${PN}-doc ${PN}-tests ${PN}-static" FILES_${PN} = "${libdir}/*.so.*" @@ -35,13 +43,14 @@ FILES_${PN}-themes = "${datadir}/${PN}/themes \ FILES_${PN}-dev += "${bindir}/${PN}-config \ ${libdir}/pkgconfig/* \ ${libdir}/lib*.la \ - ${libdir}/lib*.a \ ${libdir}/*.so \ - ${libdir}/${PN}/*.a \ ${libdir}/${PN}/*.la \ - ${libdir}/${PN}/*/*.a \ ${libdir}/${PN}/*/*.la" +FILES_${PN}-static += "${libdir}/${PN}/*.a \ + ${libdir}/${PN}/*/*.a \ +" + FILES_${PN}-dbg += "${libdir}/${PN}/.debug \ ${libdir}/${PN}/*/.debug" diff --git a/classes/fso-plugin.bbclass b/classes/fso-plugin.bbclass new file mode 100644 index 0000000000..d050540ef6 --- /dev/null +++ b/classes/fso-plugin.bbclass @@ -0,0 +1,4 @@ +FILES_${PN} += "${libdir}/cornucopia/modules/*/*.so" +FILES_${PN}-dev += "${libdir}/cornucopia/modules/*/*.la" +FILES_${PN}-dbg += "${libdir}/cornucopia/modules/*/.debug" + diff --git a/classes/gconf.bbclass b/classes/gconf.bbclass index 99f33e433a..f55ae2c2ae 100644 --- a/classes/gconf.bbclass +++ b/classes/gconf.bbclass @@ -32,10 +32,10 @@ fi python populate_packages_append () { import os.path, re packages = bb.data.getVar('PACKAGES', d, 1).split() - workdir = bb.data.getVar('WORKDIR', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, 1) for pkg in packages: - schema_dir = '%s/install/%s/etc/gconf/schemas' % (workdir, pkg) + schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg) schemas = [] schema_re = re.compile(".*\.schemas$") if os.path.exists(schema_dir): @@ -45,9 +45,10 @@ python populate_packages_append () { if schemas != []: bb.note("adding gconf postinst and prerm scripts to %s" % pkg) bb.data.setVar('SCHEMA_FILES', " ".join(schemas), d) - postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) - if not postinst: - postinst = '#!/bin/sh\n' + postinst = '#!/bin/sh\n' + pkgpostinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) + if pkgpostinst: + postinst += pkgpostinst postinst += bb.data.getVar('gconf_postinst', d, 1) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) prerm = bb.data.getVar('pkg_prerm_%s' % pkg, d, 1) or bb.data.getVar('pkg_prerm', d, 1) diff --git a/classes/gettext.bbclass b/classes/gettext.bbclass index bc0a1dfaba..b2ff2849fa 100644 --- a/classes/gettext.bbclass +++ b/classes/gettext.bbclass @@ -1,6 +1,5 @@ DEPENDS =+ "gettext-native" def gettext_after_parse(d): - import bb # Remove the NLS bits if USE_NLS is no. if bb.data.getVar('USE_NLS', d, 1) == 'no': cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d) @@ -15,4 +14,3 @@ python () { DEPENDS =+ "gettext-native" EXTRA_OECONF += "--enable-nls" - diff --git a/classes/gitver.bbclass b/classes/gitver.bbclass new file mode 100644 index 0000000000..5b4ba8d1e1 --- /dev/null +++ b/classes/gitver.bbclass @@ -0,0 +1,64 @@ +# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> +# Released under the MIT license (see COPYING.MIT for the terms) +# +# gitver.bbclass provides a GITVER variable which is a (fairly) sane version, +# for use in ${PV}, extracted from the ${S} git checkout, assuming it is one. +# This is most useful in concert with srctree.bbclass. + + +GITVER = "${@get_git_pv('${S}', d)}" + +def get_git_pv(path, d, tagadjust=None): + from subprocess import Popen, PIPE + import os + from bb import error + from bb.parse import mark_dependency + + gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git")) + env = { "GIT_DIR": gitdir } + + def popen(cmd, **kwargs): + kwargs["stderr"] = PIPE + kwargs["stdout"] = PIPE + kwargs["env"] = env + try: + pipe = Popen(cmd, **kwargs) + except OSError, e: + #error("Execution of %s failed: %s" % (cmd, e)) + return + + (stdout, stderr) = pipe.communicate(None) + if pipe.returncode != 0: + #error("Execution of %s failed: %s" % (cmd, stderr)) + return + return stdout.rstrip() + + # Force the recipe to be reparsed so the version gets bumped + # if the active branch is switched, or if the branch changes. + mark_dependency(d, os.path.join(gitdir, "HEAD")) + + ref = popen(["git", "symbolic-ref", "HEAD"]) + reffile = os.path.join(gitdir, ref) + if ref and os.path.exists(reffile): + mark_dependency(d, reffile) + else: + # The ref might be hidden in packed-refs. Force a reparse if anything + # in the working copy changes. + mark_dependency(d, os.path.join(gitdir, "index")) + + # Catch new tags. + tagdir = os.path.join(gitdir, "refs", "tags") + if os.path.exists(tagdir): + mark_dependency(d, tagdir) + + ver = popen(["git", "describe", "--tags"], cwd=path) + if not ver: + ver = popen(["git", "rev-parse", "--short", "HEAD"], cwd=path) + if ver: + return "0.0-%s" % ver + else: + return "0.0" + else: + if tagadjust: + ver = tagadjust(ver) + return ver diff --git a/classes/glibc-package.bbclass b/classes/glibc-package.bbclass new file mode 100644 index 0000000000..90b9bfd584 --- /dev/null +++ b/classes/glibc-package.bbclass @@ -0,0 +1,305 @@ +# +# This class knows how to package up glibc. Its shared since prebuild binary toolchains +# may need packaging and its pointless to duplicate this code. +# +# Caller should set GLIBC_INTERNAL_USE_BINARY_LOCALE to one of: +# "compile" - Use QEMU to generate the binary locale files +# "precompiled" - The binary locale files are pregenerated and already present +# "ondevice" - The device will build the locale files upon first boot through the postinst + +inherit qemu + +GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice" + +PACKAGES = "glibc-dbg glibc catchsegv sln nscd ldd localedef glibc-utils glibc-dev glibc-static glibc-doc glibc-locale libcidn libmemusage libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile" +PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-* locale-base-* glibc-binary-localedata-*" + +INSANE_SKIP_glibc-dbg = True + +libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${base_libdir}/libc*.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so" + +# The problem is that if PN = "glibc", FILES_${PN} will overwrite FILES_glibc +# Solution: Make them both the same thing, then it doesn't matter + +glibcfiles = "${libc_baselibs} ${libexecdir}/* ${datadir}/zoneinfo ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig', '', d)}" +glibcdbgfiles = "${bindir}/.debug ${sbindir}/.debug ${libdir}/.debug \ + ${base_bindir}/.debug ${base_sbindir}/.debug ${base_libdir}/.debug \ + ${libdir}/gconv/.debug ${libexecdir}/*/.debug" +glibcdevfiles = "${bindir}/rpcgen ${includedir} ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la \ + ${libdir}/*.a ${libdir}/*.o ${libdir}/pkgconfig ${libdir}/*nonshared.a \ + ${base_libdir}/*.a ${base_libdir}/*.o ${datadir}/aclocal" + +FILES_glibc = "${glibcfiles}" +FILES_${PN} = "${glibcfiles}" +FILES_ldd = "${bindir}/ldd" +FILES_libsegfault = "${base_libdir}/libSegFault*" +FILES_libcidn = "${base_libdir}/libcidn*.so" +FILES_libmemusage = "${base_libdir}/libmemusage.so" +FILES_glibc-extra-nss = "${base_libdir}/libnss*" +FILES_sln = "${base_sbindir}/sln" +FILES_glibc-dev = "${glibcdevfiles}" +FILES_${PN}-dev = "${glibcdevfiles}" +FILES_glibc-dbg = "${glibcdbgfiles}" +FILES_${PN}-dbg = "${glibcdbgfiles}" +FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/nscd* ${sysconfdir}/init.d/nscd*" +FILES_glibc-utils = "${bindir}/* ${sbindir}/*" +FILES_glibc-gconv = "${libdir}/gconv/*" +FILES_catchsegv = "${bindir}/catchsegv" +RDEPENDS_catchsegv = "libsegfault" +FILES_glibc-pcprofile = "${base_libdir}/libpcprofile.so" +FILES_glibc-thread-db = "${base_libdir}/libthread_db*" +FILES_localedef = "${bindir}/localedef" +RPROVIDES_glibc-dev += "libc-dev" + +DESCRIPTION_sln = "glibc: create symbolic links between files" +DESCRIPTION_nscd = "glibc: name service cache daemon for passwd, group, and hosts" +DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services" +DESCRIPTION_ldd = "glibc: print shared library dependencies" +DESCRIPTION_localedef = "glibc: compile locale definition files" +DESCRIPTION_glibc-utils = "glibc: misc utilities like iconf, local, gencat, tzselect, rpcinfo, ..." + +TMP_LOCALE="/tmp/locale${libdir}/locale" + +locale_base_postinst() { +#!/bin/sh + +if [ "x$D" != "x" ]; then + exit 1 +fi + +rm -rf ${TMP_LOCALE} +mkdir -p ${TMP_LOCALE} +if [ -f ${libdir}/locale/locale-archive ]; then + cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/ +fi +localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s --prefix=/tmp/locale %s +mkdir -p ${libdir}/locale/ +mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/ +rm -rf ${TMP_LOCALE} +} + +locale_base_postrm() { +#!/bin/sh + +rm -rf ${TMP_LOCALE} +mkdir -p ${TMP_LOCALE} +if [ -f ${libdir}/locale/locale-archive ]; then + cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/ +fi +localedef --delete-from-archive --inputfile=${datadir}/locales/%s --charmap=%s --prefix=/tmp/locale %s +mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/ +rm -rf ${TMP_LOCALE} +} + +do_prep_locale_tree() { + treedir=${WORKDIR}/locale-tree + rm -rf $treedir + mkdir -p $treedir/bin $treedir/lib $treedir/${datadir} $treedir/${libdir}/locale + cp -pPR ${PKGD}${datadir}/i18n $treedir/${datadir}/i18n + # unzip to avoid parsing errors + for i in $treedir/${datadir}/i18n/charmaps/*gz; do + gunzip $i + done + ls -d ${PKGD}${base_libdir}/* | xargs -iBLAH cp -pPR BLAH $treedir/lib + if [ -f ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so ]; then + cp -pPR ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so $treedir/lib + fi + if [ -f ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so.* ]; then + cp -pPR ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so.* $treedir/lib + fi + install -m 0755 ${PKGD}${bindir}/localedef $treedir/bin +} + +do_collect_bins_from_locale_tree() { + treedir=${WORKDIR}/locale-tree + + mkdir -p ${PKGD}${libdir} + cp -pPR $treedir/${libdir}/locale ${PKGD}${libdir} +} + +python package_do_split_gconvs () { + import os, re + if (bb.data.getVar('PACKAGE_NO_GCONV', d, 1) == '1'): + bb.note("package requested not splitting gconvs") + return + + if not bb.data.getVar('PACKAGES', d, 1): + return + + libdir = bb.data.getVar('libdir', d, 1) + if not libdir: + bb.error("libdir not defined") + return + datadir = bb.data.getVar('datadir', d, 1) + if not datadir: + bb.error("datadir not defined") + return + + gconv_libdir = base_path_join(libdir, "gconv") + charmap_dir = base_path_join(datadir, "i18n", "charmaps") + locales_dir = base_path_join(datadir, "i18n", "locales") + binary_locales_dir = base_path_join(libdir, "locale") + + do_split_packages(d, gconv_libdir, file_regex='^(.*)\.so$', output_pattern='glibc-gconv-%s', description='gconv module for character set %s', extra_depends='glibc-gconv') + + do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern='glibc-charmap-%s', description='character map for %s encoding', extra_depends='') + + def calc_locale_deps(fn, pkg, file_regex, output_pattern, group): + deps = [] + f = open(fn, "r") + c_re = re.compile('^copy "(.*)"') + i_re = re.compile('^include "(\w+)".*') + for l in f.readlines(): + m = c_re.match(l) or i_re.match(l) + if m: + dp = legitimize_package_name('glibc-localedata-%s' % m.group(1)) + if not dp in deps: + deps.append(dp) + f.close() + if deps != []: + bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d) + + do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='') + bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' glibc-gconv', d) + + use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1) + + dot_re = re.compile("(.*)\.(.*)") + + if use_bin != "precompiled": + supported = bb.data.getVar('GLIBC_GENERATE_LOCALES', d, 1) + if not supported or supported == "all": + f = open(base_path_join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r") + supported = f.readlines() + f.close() + else: + supported = supported.split() + supported = map(lambda s:s.replace(".", " ") + "\n", supported) + else: + supported = [] + full_bin_path = bb.data.getVar('PKGD', d, True) + binary_locales_dir + for dir in os.listdir(full_bin_path): + dbase = dir.split(".") + d2 = " " + if len(dbase) > 1: + d2 = "." + dbase[1].upper() + " " + supported.append(dbase[0] + d2) + + # Collate the locales by base and encoding + utf8_only = int(bb.data.getVar('LOCALE_UTF8_ONLY', d, 1) or 0) + encodings = {} + for l in supported: + l = l[:-1] + (locale, charset) = l.split(" ") + if utf8_only and charset != 'UTF-8': + continue + m = dot_re.match(locale) + if m: + locale = m.group(1) + if not encodings.has_key(locale): + encodings[locale] = [] + encodings[locale].append(charset) + + def output_locale_source(name, pkgname, locale, encoding): + bb.data.setVar('RDEPENDS_%s' % pkgname, 'localedef glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d) + bb.data.setVar('pkg_postinst_%s' % pkgname, bb.data.getVar('locale_base_postinst', d, 1) % (locale, encoding, locale), d) + bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d) + + def output_locale_binary_rdepends(name, pkgname, locale, encoding): + m = re.match("(.*)\.(.*)", name) + if m: + glibc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-","")) + else: + glibc_name = name + bb.data.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('glibc-binary-localedata-%s' % glibc_name), d) + + def output_locale_binary(name, pkgname, locale, encoding): + # This is a hack till linux-libc-headers gets patched for the missing arm syscalls and all arm device kernels as well + if bb.data.getVar("DISTRO_NAME", d, 1) == "Angstrom": + kernel_ver = "2.6.24" + elif bb.data.getVar("DISTRO_NAME", d, 1) == "KaeilOS": + kernel_ver = "2.6.24" + else: + kernel_ver = bb.data.getVar("OLDEST_KERNEL", d, 1) + + qemu = qemu_target_binary(d) + " -s 1048576" + if kernel_ver: + qemu += " -r %s" % (kernel_ver) + pkgname = 'locale-base-' + legitimize_package_name(name) + + treedir = base_path_join(bb.data.getVar("WORKDIR", d, 1), "locale-tree") + ldlibdir = "%s/lib" % treedir + path = bb.data.getVar("PATH", d, 1) + i18npath = base_path_join(treedir, datadir, "i18n") + + localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, name) + + qemu_options = bb.data.getVar("QEMU_OPTIONS_%s" % bb.data.getVar('PACKAGE_ARCH', d, 1), d, 1) + if not qemu_options: + qemu_options = bb.data.getVar('QEMU_OPTIONS', d, 1) + + cmd = "PATH=\"%s\" I18NPATH=\"%s\" %s -L %s -E LD_LIBRARY_PATH=%s %s %s/bin/localedef %s" % (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts) + bb.note("generating locale %s (%s)" % (locale, encoding)) + if os.system(cmd): + raise bb.build.FuncFailed("localedef returned an error (command was %s)." % cmd) + + def output_locale(name, locale, encoding): + pkgname = 'locale-base-' + legitimize_package_name(name) + bb.data.setVar('ALLOW_EMPTY_%s' % pkgname, '1', d) + bb.data.setVar('PACKAGES', '%s %s' % (pkgname, bb.data.getVar('PACKAGES', d, 1)), d) + rprovides = 'virtual-locale-%s' % legitimize_package_name(name) + m = re.match("(.*)_(.*)", name) + if m: + rprovides += ' virtual-locale-%s' % m.group(1) + bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d) + if use_bin == "compile": + output_locale_binary_rdepends(name, pkgname, locale, encoding) + output_locale_binary(name, pkgname, locale, encoding) + elif use_bin == "precompiled": + output_locale_binary_rdepends(name, pkgname, locale, encoding) + else: + output_locale_source(name, pkgname, locale, encoding) + + if use_bin == "compile": + bb.note("preparing tree for binary locale generation") + bb.build.exec_func("do_prep_locale_tree", d) + + # Reshuffle names so that UTF-8 is preferred over other encodings + non_utf8 = [] + for l in encodings.keys(): + if len(encodings[l]) == 1: + output_locale(l, l, encodings[l][0]) + if encodings[l][0] != "UTF-8": + non_utf8.append(l) + else: + if "UTF-8" in encodings[l]: + output_locale(l, l, "UTF-8") + encodings[l].remove("UTF-8") + else: + non_utf8.append(l) + for e in encodings[l]: + output_locale('%s.%s' % (l, e), l, e) + + if non_utf8 != [] and use_bin != "precompiled": + bb.note("the following locales are supported only in legacy encodings:") + bb.note(" " + " ".join(non_utf8)) + + if use_bin == "compile": + bb.note("collecting binary locales from locale tree") + bb.build.exec_func("do_collect_bins_from_locale_tree", d) + do_split_packages(d, binary_locales_dir, file_regex='(.*)', output_pattern='glibc-binary-localedata-%s', description='binary locale definition for %s', extra_depends='', allow_dirs=True) + elif use_bin == "precompiled": + do_split_packages(d, binary_locales_dir, file_regex='(.*)', output_pattern='glibc-binary-localedata-%s', description='binary locale definition for %s', extra_depends='', allow_dirs=True) + else: + bb.note("generation of binary locales disabled. this may break i18n!") + +} + +# We want to do this indirection so that we can safely 'return' +# from the called function even though we're prepending +python populate_packages_prepend () { + if bb.data.getVar('DEBIAN_NAMES', d, 1): + bb.data.setVar('PKG_glibc', 'libc6', d) + bb.data.setVar('PKG_glibc-dev', 'libc6-dev', d) + bb.build.exec_func('package_do_split_gconvs', d) +} diff --git a/classes/glx-use-tls.bbclass b/classes/glx-use-tls.bbclass new file mode 100644 index 0000000000..7530872fa4 --- /dev/null +++ b/classes/glx-use-tls.bbclass @@ -0,0 +1,7 @@ +def get_tls_setting(bb, d): + # until we have no prober TLS support in uclibc disable it + if bb.data.getVar('TARGET_OS', d, 1).find('uclibc') >= 0 : + return "" + return "--enable-glx-tls" + +EXTRA_OECONF += "${@get_tls_setting(bb, d)}" diff --git a/classes/gnome.bbclass b/classes/gnome.bbclass index 89fb3a19f8..cb03650b48 100644 --- a/classes/gnome.bbclass +++ b/classes/gnome.bbclass @@ -11,6 +11,7 @@ DEPENDS += "gnome-common" FILES_${PN} += "${datadir}/application-registry \ ${datadir}/mime-info \ ${datadir}/mime/packages \ + ${datadir}/mime/application \ ${datadir}/gnome-2.0" inherit autotools gtk-icon-cache pkgconfig gconf mime @@ -20,3 +21,10 @@ AUTOTOOLS_STAGE_PKGCONFIG = "1" gnome_stage_includes() { autotools_stage_includes } + +do_install_append() { + rm -rf ${D}${localstatedir}/lib/scrollkeeper/* + rm -rf ${D}${localstatedir}/scrollkeeper/* + rm -f ${D}${datadir}/applications/*.cache +} + diff --git a/classes/gtk-icon-cache.bbclass b/classes/gtk-icon-cache.bbclass index b256365175..524c2f0c46 100644 --- a/classes/gtk-icon-cache.bbclass +++ b/classes/gtk-icon-cache.bbclass @@ -11,20 +11,27 @@ fi # Update the pixbuf loaders in case they haven't been registered yet gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders -gtk-update-icon-cache -q /usr/share/icons/hicolor +for icondir in /usr/share/icons/* ; do + if [ -d $icondir ] ; then + gtk-update-icon-cache -qt $icondir + fi +done } gtk_icon_cache_postrm() { -gtk-update-icon-cache -q /usr/share/icons/hicolor +for icondir in /usr/share/icons/* ; do + if [ -d $icondir ] ; then + gtk-update-icon-cache -qt $icondir + fi +done } python populate_packages_append () { - import os.path packages = bb.data.getVar('PACKAGES', d, 1).split() - workdir = bb.data.getVar('WORKDIR', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, 1) for pkg in packages: - icon_dir = '%s/install/%s/%s/icons/hicolor' % (workdir, pkg, bb.data.getVar('datadir', d, 1)) + icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, bb.data.getVar('datadir', d, 1)) if not os.path.exists(icon_dir): continue diff --git a/classes/icecc.bbclass b/classes/icecc.bbclass index dce29fbbeb..0a22f70001 100644 --- a/classes/icecc.bbclass +++ b/classes/icecc.bbclass @@ -33,10 +33,8 @@ def icc_determine_gcc_version(gcc): 'i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363)' """ - import os return os.popen("%s --version" % gcc ).readline().split()[2] - def create_cross_env(bb,d): """ Create a tar.bz2 of the current toolchain @@ -47,7 +45,7 @@ def create_cross_env(bb,d): if len(prefix) == 0: return "" - import tarfile, socket, time, os + import tarfile, socket, time ice_dir = bb.data.expand('${CROSS_DIR}', d) prefix = bb.data.expand('${HOST_PREFIX}' , d) distro = bb.data.expand('${DISTRO}', d) @@ -97,7 +95,7 @@ def create_cross_env(bb,d): def create_native_env(bb,d): - import tarfile, socket, time, os + import tarfile, socket, time ice_dir = bb.data.expand('${CROSS_DIR}', d) prefix = bb.data.expand('${HOST_PREFIX}' , d) distro = bb.data.expand('${DISTRO}', d) @@ -137,13 +135,14 @@ def create_native_env(bb,d): def get_cross_kernel_cc(bb,d): kernel_cc = bb.data.expand('${KERNEL_CC}', d) - kernel_cc = kernel_cc.replace('ccache', '') + kernel_cc = kernel_cc.replace('ccache', '').strip() + kernel_cc = kernel_cc.split(' ')[0] kernel_cc = kernel_cc.strip() return kernel_cc def create_cross_kernel_env(bb,d): - import tarfile, socket, time, os + import tarfile, socket, time ice_dir = bb.data.expand('${CROSS_DIR}', d) prefix = bb.data.expand('${HOST_PREFIX}' , d) distro = bb.data.expand('${DISTRO}', d) @@ -182,10 +181,10 @@ def create_cross_kernel_env(bb,d): cr_env_script = bb.data.getVar('ICECC_ENV_EXEC', d) or bb.data.expand('${STAGING_DIR}', d)+"/ice/icecc-create-env" result=os.popen("%s %s %s %s %s %s" %(cr_env_script, "--silent", - os.path.join(ice_dir,'bin',kernel_cc), - os.path.join(ice_dir,target_sys,'bin','g++'), - os.path.join(ice_dir,target_sys,'bin','as'), - os.path.join(ice_dir,"ice",cross_name) ) ) + os.path.join(ice_dir, 'bin', kernel_cc), + os.path.join(ice_dir, 'bin', "%s-g++" % target_sys), + os.path.join(ice_dir, 'bin', "%s-as" % target_sys), + os.path.join(ice_dir, "ice", cross_name) ) ) return tar_file @@ -209,8 +208,6 @@ def create_path(compilers, type, bb, d): """ Create Symlinks for the icecc in the staging directory """ - import os - staging = os.path.join(bb.data.expand('${STAGING_DIR}', d), "ice", type) #check if the icecc path is set by the user @@ -255,7 +252,7 @@ def icc_path(bb,d): #"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", "gcc", "qemu", "bind", "u-boot", "dhcp-forwarder", "enchant", "connman" ] + system_package_blacklist = [ "uclibc", "glibc", "gcc", "bind", "u-boot", "dhcp-forwarder", "enchant", "connman" ] user_package_blacklist = (bb.data.getVar('ICECC_USER_PACKAGE_BL', d) or "").split() package_blacklist = system_package_blacklist + user_package_blacklist diff --git a/classes/image.bbclass b/classes/image.bbclass index 2ed0ee1de7..9dce609733 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -2,19 +2,6 @@ inherit rootfs_${IMAGE_PKGTYPE} LICENSE = "MIT" PACKAGES = "" -RDEPENDS += "${IMAGE_INSTALL}" - -# "export IMAGE_BASENAME" not supported at this time -IMAGE_BASENAME[export] = "1" -export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}" - -# We need to recursively follow RDEPENDS and RRECOMMENDS for images -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" - -USE_DEVFS ?= "0" # # udev, devfsd, busybox-mdev (from busybox) or none @@ -28,15 +15,32 @@ IMAGE_INITSCRIPTS ?= "initscripts" # # tinylogin, getty # -IMAGE_LOGIN_MANAGER ?= "tinylogin" +IMAGE_LOGIN_MANAGER ?= "tinylogin" + +# set sane default for the SPLASH variable +SPLASH ?= "" -IMAGE_VARS = "${IMAGE_INITSCRIPTS} \ +IMAGE_KEEPROOTFS ?= "" +IMAGE_KEEPROOTFS[doc] = "Set to non-empty to keep ${IMAGE_ROOTFS} around after image creation." + +IMAGE_BOOT ?= "${IMAGE_INITSCRIPTS} \ ${IMAGE_DEV_MANAGER} \ ${IMAGE_INIT_MANAGER} \ ${IMAGE_LOGIN_MANAGER} " -RDEPENDS += "${IMAGE_VARS}" -PACKAGE_INSTALL += "${IMAGE_VARS}" +RDEPENDS += "${IMAGE_INSTALL} ${IMAGE_BOOT}" + +# "export IMAGE_BASENAME" not supported at this time +IMAGE_BASENAME[export] = "1" +export PACKAGE_INSTALL ?= "${IMAGE_INSTALL} ${IMAGE_BOOT}" + +# We need to recursively follow RDEPENDS and RRECOMMENDS for images +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" + +USE_DEVFS ?= "0" PID = "${@os.getpid()}" @@ -71,13 +75,11 @@ def get_devtable_list(d): devtable = bb.data.getVar('IMAGE_DEVICE_TABLE', d, 1) if devtable != None: return devtable - str = "" devtables = bb.data.getVar('IMAGE_DEVICE_TABLES', d, 1) if devtables == None: devtables = 'files/device_table-minimal.txt' - for devtable in devtables.split(): - str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable) - return str + return " ".join([ bb.which(bb.data.getVar('BBPATH', d, 1), devtable) + for devtable in devtables.split() ]) def get_imagecmds(d): import bb @@ -106,7 +108,6 @@ LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVa do_rootfs[nostamp] = "1" do_rootfs[dirs] = "${TOPDIR}" -do_rootfs[lockfiles] = "${IMAGE_ROOTFS}.lock" do_build[nostamp] = "1" # Must call real_do_rootfs() from inside here, rather than as a separate @@ -135,6 +136,7 @@ fakeroot do_rootfs () { ${IMAGE_POSTPROCESS_COMMAND} ${MACHINE_POSTPROCESS_COMMAND} + ${@['rm -rf ${IMAGE_ROOTFS}', ''][bool(d.getVar("IMAGE_KEEPROOTFS", 1))]} } do_deploy_to[nostamp] = "1" @@ -233,8 +235,46 @@ rootfs_update_timestamp () { date "+%m%d%H%M%Y" >${IMAGE_ROOTFS}/etc/timestamp } +# Install locales into image for every entry in IMAGE_LINGUAS +install_linguas() { +if [ -e ${IMAGE_ROOTFS}/usr/bin/opkg-cl ] ; then + OPKG="opkg-cl ${IPKG_ARGS}" + + ${OPKG} update || true + ${OPKG} list_installed | awk '{print $1}' |sort | uniq > /tmp/installed-packages + + for i in $(cat /tmp/installed-packages | grep -v locale) ; do + for translation in ${IMAGE_LINGUAS}; do + translation_split=$(echo ${translation} | awk -F '-' '{print $1}') + echo ${i}-locale-${translation} + echo ${i}-locale-${translation_split} + done + done | sort | uniq > /tmp/wanted-locale-packages + + ${OPKG} list | awk '{print $1}' |grep locale |sort | uniq > /tmp/available-locale-packages + + cat /tmp/wanted-locale-packages /tmp/available-locale-packages | sort | uniq -d > /tmp/pending-locale-packages + + cat /tmp/pending-locale-packages | xargs ${OPKG} -nodeps install + rm -f ${IMAGE_ROOTFS}${libdir}/opkg/lists/* + + for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do + if [ -f $i ] && ! sh $i; then + opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst` + fi + done + + for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.postinst; do + if [ -f $i ] && ! sh $i configure; then + opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst` + fi + done + +fi +} + # export the zap_root_password, create_etc_timestamp and remote_init_link -EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp +EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp install_linguas addtask rootfs before do_build after do_install addtask deploy_to after do_rootfs diff --git a/classes/insane.bbclass b/classes/insane.bbclass index 5b31a0123d..804caf06ee 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -31,6 +31,9 @@ PACKAGEFUNCS += " do_package_qa " # TARGET_OS TARGET_ARCH MACHINE, OSABI, ABIVERSION, Little Endian, 32bit? def package_qa_get_machine_dict(): return { + "darwin9" : { + "arm" : (40, 0, 0, True, True), + }, "linux" : { "arm" : (40, 97, 0, True, True), "armeb": (40, 97, 0, False, True), @@ -58,6 +61,7 @@ def package_qa_get_machine_dict(): "i486": ( 3, 0, 0, True, True), "i586": ( 3, 0, 0, True, True), "i686": ( 3, 0, 0, True, True), + "mips": ( 8, 0, 0, False, True), "mipsel": ( 8, 0, 0, True, True), "avr32": (6317, 0, 0, False, True), "sh4": (42, 0, 0, True, True), @@ -70,13 +74,16 @@ def package_qa_get_machine_dict(): "arm" : (40, 0, 0, True, True), "armeb" : (40, 0, 0, False, True), }, - "linux-uclibcgnueabi" : { + "linux-uclibceabi" : { "arm" : (40, 0, 0, True, True), "armeb" : (40, 0, 0, False, True), }, "linux-gnuspe" : { "powerpc": (20, 0, 0, False, True), }, + "linux-uclibcspe" : { + "powerpc": (20, 0, 0, False, True), + }, } @@ -171,10 +178,10 @@ def package_qa_get_elf(path, bits32): # 6 - .pc contains reference to /usr/include or workdir # 7 - the desktop file is not valid # 8 - .la contains reference to the workdir +# 9 - LDFLAGS ignored def package_qa_clean_path(path,d): """ Remove the common prefix from the path. In this case it is the TMPDIR""" - import bb return path.replace(bb.data.getVar('TMPDIR',d,True),"") def package_qa_make_fatal_error(error_class, name, path,d): @@ -183,13 +190,12 @@ def package_qa_make_fatal_error(error_class, name, path,d): TODO: Load a whitelist of known errors """ - return not error_class in [0, 5, 7, 9] + return not error_class in [0, 5, 7] def package_qa_write_error(error_class, name, path, d): """ Log the error """ - import bb, os if not bb.data.getVar('QA_LOG', d): bb.note("a QA error occured but will not be logged because QA_LOG is not set") return @@ -214,8 +220,7 @@ def package_qa_write_error(error_class, name, path, d): f.close() def package_qa_handle_error(error_class, error_msg, name, path, d): - import bb - bb.error("QA Issue: %s" % error_msg) + bb.error("QA Issue with %s: %s" % (name, error_msg)) package_qa_write_error(error_class, name, path, d) return not package_qa_make_fatal_error(error_class, name, path, d) @@ -246,21 +251,33 @@ def package_qa_check_rpath(file,name,d, elf): return sane -def package_qa_check_devdbg(path, name,d, elf): +def package_qa_check_dev(path, name,d, elf): """ - Check for debug remains inside the binary or - non dev packages containing + Check for ".so" library symlinks in non-dev packages """ - import bb, os sane = True + # SDK packages are special. + for s in ['sdk', 'canadian-sdk']: + if bb.data.inherits_class(s, d): + return True + if not "-dev" in name: if path[-3:] == ".so" and os.path.islink(path): error_msg = "non -dev package contains symlink .so: %s path '%s'" % \ (name, package_qa_clean_path(path,d)) sane = package_qa_handle_error(0, error_msg, name, path, d) + return sane + +def package_qa_check_dbg(path, name,d, elf): + """ + Check for ".debug" files or directories outside of the dbg package + """ + + sane = True + if not "-dbg" in name: if '.debug' in path: error_msg = "non debug package contains .debug directory: %s path %s" % \ @@ -283,7 +300,6 @@ def package_qa_check_arch(path,name,d, elf): if not elf: return True - import bb, os sane = True target_os = bb.data.getVar('TARGET_OS', d, True) target_arch = bb.data.getVar('TARGET_ARCH', d, True) @@ -318,7 +334,6 @@ def package_qa_check_desktop(path, name, d, elf): """ Run all desktop files through desktop-file-validate. """ - import bb, os sane = True if path.endswith(".desktop"): output = os.popen("desktop-file-validate %s" % path) @@ -332,7 +347,6 @@ def package_qa_hash_style(path, name, d, elf): """ Check if the binary has the right hash style... """ - import bb, os if not elf: return True @@ -343,6 +357,8 @@ def package_qa_hash_style(path, name, d, elf): gnu_hash = "--hash-style=gnu" in bb.data.getVar('LDFLAGS', d, True) if not gnu_hash: gnu_hash = "--hash-style=both" in bb.data.getVar('LDFLAGS', d, True) + if not gnu_hash: + return True objdump = bb.data.getVar('OBJDUMP', d, True) env_path = bb.data.getVar('PATH', d, True) @@ -377,7 +393,6 @@ def package_qa_check_staged(path,d): to find the one responsible for the errors easily even if we look at every .pc and .la file """ - import os, bb sane = True tmpdir = bb.data.getVar('TMPDIR', d, True) @@ -417,7 +432,6 @@ def package_qa_check_staged(path,d): # Walk over all files in a directory and call func def package_qa_walk(path, funcs, package,d): - import bb, os sane = True #if this will throw an exception, then fix the dict above @@ -440,14 +454,13 @@ def package_qa_walk(path, funcs, package,d): return sane -def package_qa_check_rdepends(pkg, workdir, d): - import bb +def package_qa_check_rdepends(pkg, pkgdest, d): sane = True if not "-dbg" in pkg and not "task-" in pkg and not "-image" in pkg: # Copied from package_ipk.bbclass # boiler plate to update the data localdata = bb.data.createCopy(d) - root = "%s/install/%s" % (workdir, pkg) + root = "%s/%s" % (pkgdest, pkg) bb.data.setVar('ROOT', '', localdata) bb.data.setVar('ROOT_%s' % pkg, root, localdata) @@ -478,42 +491,42 @@ def package_qa_check_rdepends(pkg, workdir, d): # The PACKAGE FUNC to scan each package python do_package_qa () { - import bb - bb.note("DO PACKAGE QA") - workdir = bb.data.getVar('WORKDIR', d, True) + bb.debug(2, "DO PACKAGE QA") + pkgdest = bb.data.getVar('PKGDEST', d, True) packages = bb.data.getVar('PACKAGES',d, True) # no packages should be scanned if not packages: return - checks = [package_qa_check_rpath, package_qa_check_devdbg, + checks = [package_qa_check_rpath, package_qa_check_dev, package_qa_check_perm, package_qa_check_arch, - package_qa_check_desktop, package_qa_hash_style] + package_qa_check_desktop, package_qa_hash_style, + package_qa_check_dbg] walk_sane = True rdepends_sane = True for package in packages.split(): if bb.data.getVar('INSANE_SKIP_' + package, d, True): - bb.note("Package: %s (skipped)" % package) + bb.note("package %s skipped" % package) continue - bb.note("Checking Package: %s" % package) - path = "%s/install/%s" % (workdir, package) + bb.debug(1, "Checking Package: %s" % package) + path = "%s/%s" % (pkgdest, package) if not package_qa_walk(path, checks, package, d): walk_sane = False - if not package_qa_check_rdepends(package, workdir, d): + if not package_qa_check_rdepends(package, pkgdest, d): rdepends_sane = False if not walk_sane or not rdepends_sane: bb.fatal("QA run found fatal errors. Please consider fixing them.") - bb.note("DONE with PACKAGE QA") + bb.debug(2, "DONE with PACKAGE QA") } # The Staging Func, to check all staging addtask qa_staging after do_populate_staging before do_build python do_qa_staging() { - bb.note("QA checking staging") + bb.debug(2, "QA checking staging") if not package_qa_check_staged(bb.data.getVar('STAGING_LIBDIR',d,True), d): bb.fatal("QA staging was broken by the package built above") @@ -522,8 +535,7 @@ python do_qa_staging() { # Check broken config.log files addtask qa_configure after do_configure before do_compile python do_qa_configure() { - bb.note("Checking sanity of the config.log file") - import os + bb.debug(1, "Checking sanity of the config.log file") for root, dirs, files in os.walk(bb.data.getVar('WORKDIR', d, True)): statement = "grep 'CROSS COMPILE Badness:' %s > /dev/null" % \ os.path.join(root,"config.log") diff --git a/classes/java-native.bbclass b/classes/java-native.bbclass new file mode 100644 index 0000000000..7b67c6041c --- /dev/null +++ b/classes/java-native.bbclass @@ -0,0 +1,11 @@ +# This is to be used by recipes which rely on java-library.bbclass +# infrastructure and are a *-native recipe which needs to install +# jar files into staging. +# +# This class has nothing to do with Java's JNI. + +inherit native + +do_stage () { + java_stage +} diff --git a/classes/java.bbclass b/classes/java.bbclass index 7b67bcd510..d4cf5aa954 100644 --- a/classes/java.bbclass +++ b/classes/java.bbclass @@ -13,7 +13,7 @@ libdir_jni ?= ${libdir}/jni # JVM bundle location on target libdir_jvm ?= ${libdir}/jvm -STAGING_DATADIR_JAVA ?= ${STAGING_DATADIR}/java +STAGING_DATADIR_JAVA ?= ${STAGING_DIR_JAVA} STAGING_LIBDIR_JNI ?= ${STAGING_LIBDIR}/jni STAGING_LIBDIR_JVM ?= ${STAGING_LIBDIR}/jvm @@ -68,7 +68,7 @@ oe_jarinstall() { # Creates symlinks out of the remaining arguments. while [ "$#" -gt 0 ]; do - if [ -e $dir/$1 ]; then + if [ -e $dir/$1 -o -h $dir/$1 ]; then oewarn "file was in the way. removing:" $dir/$1 rm $dir/$1 fi @@ -92,8 +92,12 @@ oe_makeclasspath() { # # Provide the -s at the beginning otherwise strange things happen. # If -s is given the function checks whether the requested jar file exists - # and exits with an error message if it cannot be found. + # and exits with an error message if it cannot be found. # + # Note: In order to encourage usage of the DEPENDS variable, the function + # can accept recipe names. If a recipe has no corresponding Jar file it + # is ignored. Be careful with recipes where the recipe name is different + # from the the Jar file name! dir=${datadir_java} classpath= delimiter= @@ -102,30 +106,29 @@ oe_makeclasspath() { shift while [ "$#" -gt 0 ]; do - case "$1" in - -s) - # take jar files from native staging if this is a -native recipe - if [ ${PACKAGE_ARCH} = ${BUILD_ARCH} ]; then - dir=${STAGING_DATADIR_JAVA_NATIVE} - else - dir=${STAGING_DATADIR_JAVA} - fi - ;; - -*) - oefatal "oe_makeclasspath: unknown option: $1" - ;; - *) - file=$dir/$1.jar - - if [ -z "$dir" -a ! -f $file ]; then - oefatal "oe_makeclasspath: Jar file for '$1' not found at $file" - fi - - classpath=$classpath$delimiter$file - delimiter=":" - ;; - esac - shift + case "$1" in + -s) + # take jar files from native staging if this is a -native recipe + if [ ${PACKAGE_ARCH} = ${BUILD_ARCH} ]; then + dir=${STAGING_DATADIR_JAVA_NATIVE} + else + dir=${STAGING_DATADIR_JAVA} + fi + ;; + -*) + oefatal "oe_makeclasspath: unknown option: $1" + ;; + *) + file=$dir/$1.jar + + if [ -e $file ]; then + classpath=$classpath$delimiter$file + delimiter=":" + fi + + ;; + esac + shift done eval $retval="$classpath" diff --git a/classes/kernel-arch.bbclass b/classes/kernel-arch.bbclass index 65d220063e..8894fa554c 100644 --- a/classes/kernel-arch.bbclass +++ b/classes/kernel-arch.bbclass @@ -15,7 +15,7 @@ valid_archs = "alpha cris ia64 \ avr32 blackfin" def map_kernel_arch(a, d): - import bb, re + import re valid_archs = bb.data.getVar('valid_archs', d, 1).split() diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 86f00da5cf..83530b5a5e 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -8,9 +8,6 @@ KERNEL_IMAGETYPE ?= "zImage" # Add dependency on mkimage for kernels that build a uImage python __anonymous () { - - import bb - kerneltype = bb.data.getVar('KERNEL_IMAGETYPE', d, 1) or '' if kerneltype == 'uImage': depends = bb.data.getVar("DEPENDS", d, 1) @@ -20,6 +17,11 @@ python __anonymous () { image = bb.data.getVar('INITRAMFS_IMAGE', d, True) if image != '' and image is not None: bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d) + + machine_kernel_pr = bb.data.getVar('MACHINE_KERNEL_PR', d, True) + + if machine_kernel_pr: + bb.data.setVar('PR', machine_kernel_pr, d) } INITRAMFS_IMAGE ?= "" @@ -73,6 +75,10 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" UBOOT_ENTRYPOINT ?= "20008000" UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" +# For the kernel, we don't want the '-e MAKEFLAGS=' in EXTRA_OEMAKE. +# We don't want to override kernel Makefile variables from the environment +EXTRA_OEMAKE = "" + kernel_do_compile() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE oe_runmake include/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}" @@ -89,18 +95,32 @@ kernel_do_compile() { kernel_do_compile[depends] = "${INITRAMFS_TASK}" kernel_do_stage() { - ASMDIR=`readlink include/asm` + if [ -e include/asm ] ; then + # This link is generated only in kernel before 2.6.33-rc1, don't stage it for newer kernels + ASMDIR=`readlink include/asm` - mkdir -p ${STAGING_KERNEL_DIR}/include/$ASMDIR - cp -fR include/$ASMDIR/* ${STAGING_KERNEL_DIR}/include/$ASMDIR/ + mkdir -p ${STAGING_KERNEL_DIR}/include/$ASMDIR + cp -fR include/$ASMDIR/* ${STAGING_KERNEL_DIR}/include/$ASMDIR/ + fi # Kernel 2.6.27 moved headers from includes/asm-${ARCH} to arch/${ARCH}/include/asm if [ -e arch/${ARCH}/include/asm/ ] ; then - cp -fR arch/${ARCH}/include/asm/* ${STAGING_KERNEL_DIR}/include/$ASMDIR/ + if [ -e include/asm ] ; then + cp -fR arch/${ARCH}/include/asm/* ${STAGING_KERNEL_DIR}/include/$ASMDIR/ + fi install -d ${STAGING_KERNEL_DIR}/arch/${ARCH}/include cp -fR arch/${ARCH}/* ${STAGING_KERNEL_DIR}/arch/${ARCH}/ + + # Check for arch/x86 on i386 + elif [ -d arch/x86/include/asm/ ]; then + cp -fR arch/x86/include/asm/* ${STAGING_KERNEL_DIR}/include/asm-x86/ + install -d ${STAGING_KERNEL_DIR}/arch/x86/include + cp -fR arch/x86/* ${STAGING_KERNEL_DIR}/arch/x86/ + fi + + if [ -e include/asm ] ; then + rm -f ${STAGING_KERNEL_DIR}/include/asm + ln -sf $ASMDIR ${STAGING_KERNEL_DIR}/include/asm fi - rm -f $ASMDIR ${STAGING_KERNEL_DIR}/include/asm - ln -sf $ASMDIR ${STAGING_KERNEL_DIR}/include/asm mkdir -p ${STAGING_KERNEL_DIR}/include/asm-generic cp -fR include/asm-generic/* ${STAGING_KERNEL_DIR}/include/asm-generic/ @@ -114,7 +134,7 @@ kernel_do_stage() { mkdir -p ${STAGING_KERNEL_DIR}/include/pcmcia cp -fR include/pcmcia/* ${STAGING_KERNEL_DIR}/include/pcmcia/ - for entry in drivers/crypto include/media include/acpi include/sound include/video include/scsi; do + for entry in drivers/crypto drivers/media include/media include/acpi include/sound include/video include/scsi include/trace; do if [ -d $entry ]; then mkdir -p ${STAGING_KERNEL_DIR}/$entry cp -fR $entry/* ${STAGING_KERNEL_DIR}/$entry/ @@ -170,6 +190,7 @@ kernel_do_install() { install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} + [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION} install -d ${D}/etc/modutils if [ "${KERNEL_MAJOR_VERSION}" = "2.6" ]; then install -d ${D}/etc/modprobe.d @@ -187,8 +208,12 @@ kernel_do_install() { kernel_do_configure() { yes '' | oe_runmake oldconfig if [ ! -z "${INITRAMFS_IMAGE}" ]; then - cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz" initramfs.cpio.gz - fi + for img in cpio.gz cpio.lzo cpio.lzma; do + if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then + cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img + fi + done + fi } do_menuconfig() { @@ -201,7 +226,7 @@ do_menuconfig() { fi } do_menuconfig[nostamp] = "1" -addtask menuconfig after do_patch +addtask menuconfig after do_configure pkg_postinst_kernel () { cd /${KERNEL_IMAGEDEST}; update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true @@ -220,7 +245,7 @@ EXPORT_FUNCTIONS do_compile do_install do_stage do_configure PACKAGES = "kernel kernel-base kernel-image kernel-dev kernel-vmlinux" FILES = "" FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" -FILES_kernel-dev = "/boot/System.map* /boot/config*" +FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config*" FILES_kernel-vmlinux = "/boot/vmlinux*" RDEPENDS_kernel = "kernel-base" RRECOMMENDS_kernel-module-hostap-cs += '${@base_version_less_or_equal("KERNEL_VERSION", "2.6.17", "", "apm-wifi-suspendfix", d)}' @@ -292,15 +317,18 @@ module_conf_sco = "alias bt-proto-2 sco" module_conf_rfcomm = "alias bt-proto-3 rfcomm" python populate_packages_prepend () { + import os def extract_modinfo(file): - import tempfile, os, re + import tempfile, re tempfile.tempdir = bb.data.getVar("WORKDIR", d, 1) - tmpfile = tempfile.mkstemp()[1] + tf = tempfile.mkstemp() + tmpfile = tf[1] cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (bb.data.getVar("PATH", d, 1), bb.data.getVar("HOST_PREFIX", d, 1) or "", file, tmpfile) os.system(cmd) f = open(tmpfile) l = f.read().split("\000") f.close() + os.close(tf[0]) os.unlink(tmpfile) exp = re.compile("([^=]+)=(.*)") vals = {} @@ -312,9 +340,9 @@ python populate_packages_prepend () { return vals def parse_depmod(): - import os, re + import re - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('PKGD', d, 1) if not dvar: bb.error("D not defined") return @@ -363,10 +391,10 @@ python populate_packages_prepend () { return deps def get_dependencies(file, pattern, format): - file = file.replace(bb.data.getVar('D', d, 1) or '', '', 1) + file = file.replace(bb.data.getVar('PKGD', d, 1) or '', '', 1) if module_deps.has_key(file): - import os.path, re + import re dependencies = [] for i in module_deps[file]: m = re.match(pattern, os.path.basename(i)) @@ -382,7 +410,7 @@ python populate_packages_prepend () { import re vals = extract_modinfo(file) - dvar = bb.data.getVar('D', d, 1) + dvar = bb.data.getVar('PKGD', d, 1) # If autoloading is requested, output /etc/modutils/<name> and append # appropriate modprobe commands to the postinst @@ -435,12 +463,16 @@ python populate_packages_prepend () { postinst = bb.data.getVar('pkg_postinst_modules', d, 1) postrm = bb.data.getVar('pkg_postrm_modules', d, 1) + + maybe_update_modules = "update-modules " + if bb.data.getVar("ONLINE_PACKAGE_MANAGEMENT", d) == "none": + maybe_update_modules = "" do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') - 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)) + 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='%skernel-%s' % (maybe_update_modules, bb.data.getVar("KERNEL_VERSION", d, 1))) - import re, os + import re metapkg = "kernel-modules" bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) bb.data.setVar('FILES_' + metapkg, "", d) @@ -474,31 +506,40 @@ do_sizecheck() { addtask sizecheck before do_install after do_compile +do_uboot_mkimage() { + if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then + ENTRYPOINT=${UBOOT_ENTRYPOINT} + if test -n "${UBOOT_ENTRYSYMBOL}"; then + ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ + awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'` + fi + if test -e arch/${ARCH}/boot/compressed/vmlinux ; then + ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin + uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage + rm -f linux.bin + else + ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin + rm -f linux.bin.gz + gzip -9 linux.bin + uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage + rm -f linux.bin.gz + fi + fi +} + +addtask uboot_mkimage before do_install after do_compile + KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}" KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" +MODULES_IMAGE_BASE_NAME ?= modules-${PV}-${PR}-${MACHINE} do_deploy() { install -d ${DEPLOY_DIR_IMAGE} install -m 0644 ${KERNEL_OUTPUT} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin - if [ -d "${D}/lib" ]; then - tar -cvzf ${DEPLOY_DIR_IMAGE}/modules-${PV}-${PR}-${MACHINE}.tgz -C ${D} lib - fi - - if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then - if test -e arch/${ARCH}/boot/compressed/vmlinux ; then - ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin - uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin - rm -f linux.bin - else - ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin - rm -f linux.bin.gz - gzip -9 linux.bin - uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin - rm -f linux.bin.gz - fi - package_stagefile_shell ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.bin + if [ -d "${PKGD}/lib" ]; then + fakeroot tar -cvzf ${DEPLOY_DIR_IMAGE}/${MODULES_IMAGE_BASE_NAME}.tgz -C ${PKGD} lib fi cd ${DEPLOY_DIR_IMAGE} @@ -508,5 +549,6 @@ do_deploy() { } do_deploy[dirs] = "${S}" +do_deploy[depends] += "fakeroot-native:do_populate_staging" -addtask deploy before do_package after do_install +addtask deploy before do_build after do_package diff --git a/classes/lib_package.bbclass b/classes/lib_package.bbclass index 9a48408527..82c93707ea 100644 --- a/classes/lib_package.bbclass +++ b/classes/lib_package.bbclass @@ -1,9 +1,10 @@ PACKAGES += "${PN}-bin" -FILES_${PN} = "${libexecdir} ${libdir}/lib*.so.* \ +FILES_${PN} = "${libexecdir} ${libdir}/lib*${SOLIBS} \ ${sysconfdir} ${sharedstatedir} ${localstatedir} \ - /lib/*.so* ${datadir}/${PN} ${libdir}/${PN}" -FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la \ + ${base_libdir}/*${SOLIBS} \ + ${datadir}/${PN} ${libdir}/${PN}" +FILES_${PN}-dev = "${includedir} ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la \ ${libdir}/*.a ${libdir}/pkgconfig /lib/*.a /lib/*.o \ ${datadir}/aclocal ${bindir}/*-config" FILES_${PN}-bin = "${bindir}/* ${sbindir}/* /bin/* /sbin/*" diff --git a/classes/linux-kernel-base.bbclass b/classes/linux-kernel-base.bbclass index 4e2e2da373..510951a620 100644 --- a/classes/linux-kernel-base.bbclass +++ b/classes/linux-kernel-base.bbclass @@ -1,9 +1,12 @@ # parse kernel ABI version out of <linux/version.h> def get_kernelversion(p): - import re, os + import re fn = p + '/include/linux/utsrelease.h' if not os.path.isfile(fn): + # after 2.6.33-rc1 + fn = p + '/include/generated/utsrelease.h' + if not os.path.isfile(fn): fn = p + '/include/linux/version.h' import re @@ -30,7 +33,6 @@ def get_kernelmajorversion(p): return None def linux_module_packages(s, d): - import bb, os.path suffix = "" return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split())) diff --git a/classes/lockdown.bbclass b/classes/lockdown.bbclass new file mode 100644 index 0000000000..45b9761b9c --- /dev/null +++ b/classes/lockdown.bbclass @@ -0,0 +1,41 @@ +addtask show_versions before do_build +do_show_versions[nostamp] = "1" +python do_show_versions() { + import sys + + localdata = bb.data.createCopy(d) + bb.data.update_data(localdata) + + src_uri = bb.data.getVar('SRC_URI', localdata, 1) + if not src_uri: + return 1 + + try: + bb.fetch.init(src_uri.split(),d) + except bb.fetch.NoMethodError: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("No method: %s" % value) + + + src_uri = bb.data.getVar("SRC_URI", d, False) + pn = bb.data.getVar("PN", d, True) + src_revs = open("%s/src_revs.inc" % bb.data.getVar("TMPDIR", d, 1), "a") + src_dates = open("%s/src_dates.inc" % bb.data.getVar("TMPDIR", d, 1), "a") + pref_versions = open("%s/preferred_versions.inc" % bb.data.getVar("TMPDIR", d, 1), "a") + if "SRCREV" in bb.data.getVar("PV", d, False): + print >> src_revs, 'SRCREV_pn-%(pn)s ?= "%(rev)s"' % { 'pn' : pn, 'rev' : bb.data.getVar("SRCREV", d, True) } + elif "cvs://" in src_uri or "svn://" in src_uri or "git://" in src_uri: + print >> src_dates, 'SRCDATE_pn-%(pn)s ?= "%(date)s"' % { 'pn' : pn, 'date' : bb.data.getVar("SRCDATE", d, True) } + + print >> pref_versions, 'PREFERRED_VERSION_%(pn)s = "%(version)s"' % { "pn" : pn, 'version' : bb.data.getVar("PV", d, True) } + src_revs.close() + src_dates.close() + pref_versions.close() +} + +addtask lockdown +do_lockdown[nostamp] = "1" +do_lockdown[recrdeptask] = "do_show_versions" +python do_lockdown() { +} + diff --git a/classes/manifest.bbclass b/classes/manifest.bbclass index 687f4b756e..8d714d3bbc 100644 --- a/classes/manifest.bbclass +++ b/classes/manifest.bbclass @@ -1,6 +1,6 @@ python read_manifest () { - import sys, bb.manifest + import sys mfn = bb.data.getVar("MANIFEST", d, 1) if os.access(mfn, os.R_OK): # we have a manifest, so emit do_stage and do_populate_pkgs, diff --git a/classes/mime.bbclass b/classes/mime.bbclass index 724fb23713..2416c1466f 100644 --- a/classes/mime.bbclass +++ b/classes/mime.bbclass @@ -27,10 +27,10 @@ fi python populate_packages_append () { import os.path, re packages = bb.data.getVar('PACKAGES', d, 1).split() - workdir = bb.data.getVar('WORKDIR', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, 1) for pkg in packages: - mime_dir = '%s/install/%s/usr/share/mime/packages' % (workdir, pkg) + mime_dir = '%s/%s/usr/share/mime/packages' % (pkgdest, pkg) mimes = [] mime_re = re.compile(".*\.xml$") if os.path.exists(mime_dir): diff --git a/classes/module-base.bbclass b/classes/module-base.bbclass index 185803ebba..bc53e1bad5 100644 --- a/classes/module-base.bbclass +++ b/classes/module-base.bbclass @@ -5,9 +5,13 @@ inherit kernel-arch export OS = "${TARGET_OS}" export CROSS_COMPILE = "${TARGET_PREFIX}" +# A machine.conf or local.conf can increase MACHINE_KERNEL_PR to force +# rebuilds for kernel and external modules +PR = "${MACHINE_KERNEL_PR}" + export KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}" export KERNEL_SOURCE = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-source')}" -KERNEL_OBJECT_SUFFIX = "${@[".o", ".ko"][base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion') < "2.6.0"]}" +KERNEL_OBJECT_SUFFIX = "${@[".o", ".ko"][base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion') > "2.6.0"]}" KERNEL_CCSUFFIX = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-ccsuffix')}" KERNEL_LDSUFFIX = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-ldsuffix')}" KERNEL_ARSUFFIX = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-arsuffix')}" diff --git a/classes/module_strip.bbclass b/classes/module_strip.bbclass index 3316e20c80..2650f71d50 100644 --- a/classes/module_strip.bbclass +++ b/classes/module_strip.bbclass @@ -1,26 +1,20 @@ -#DEPENDS_append = " module-strip" +PACKAGESTRIPFUNCS += "do_strip_modules" do_strip_modules () { - for p in ${PACKAGES}; do - if test -e ${WORKDIR}/install/$p/lib/modules; then - if [ "${KERNEL_MAJOR_VERSION}" == "2.6" ]; then - modules="`find ${WORKDIR}/install/$p/lib/modules -name \*.ko`" - else - modules="`find ${WORKDIR}/install/$p/lib/modules -name \*.o`" - fi - if [ -n "$modules" ]; then - for module in $modules ; do - if ! [ -d "$module" ] ; then - ${STRIP} -v -g $module - fi - done -# NM="${CROSS_DIR}/bin/${HOST_PREFIX}nm" OBJCOPY="${CROSS_DIR}/bin/${HOST_PREFIX}objcopy" strip_module $modules - fi + if test -e ${PKGD}/lib/modules; then + if [ "${KERNEL_MAJOR_VERSION}" == "2.6" ]; then + modules="`find ${PKGD}/lib/modules -name \*.ko`" + else + modules="`find ${PKGD}/lib/modules -name \*.o`" fi - done + if [ -n "$modules" ]; then + for module in $modules ; do + if ! [ -d "$module" ] ; then + ${STRIP} -v -g $module + fi + done + fi + fi } -python do_package_append () { - if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): - bb.build.exec_func('do_strip_modules', d) -} + diff --git a/classes/nas100d-image.bbclass b/classes/nas100d-image.bbclass index 1150116bdb..0877b4f84d 100644 --- a/classes/nas100d-image.bbclass +++ b/classes/nas100d-image.bbclass @@ -1,6 +1,6 @@ nas100d_pack_image () { install -d ${DEPLOY_DIR_IMAGE}/firmupgrade - install -m 0755 ${DEPLOY_DIR_IMAGE}/zImage-nas100d${SITEINFO_ENDIANESS} \ + install -m 0755 ${DEPLOY_DIR_IMAGE}/zImage-nslu2${SITEINFO_ENDIANESS}.bin \ ${DEPLOY_DIR_IMAGE}/firmupgrade/ip-ramdisk install -m 0644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \ ${DEPLOY_DIR_IMAGE}/firmupgrade/rootfs.gz @@ -16,5 +16,4 @@ nas100d_pack_image () { rm -rf ${DEPLOY_DIR_IMAGE}/firmupgrade } -# nas100d is not a separate machine - use the nslu2 machine override. -IMAGE_POSTPROCESS_COMMAND_nslu2 += "nas100d_pack_image; " +IMAGE_POSTPROCESS_COMMAND += "nas100d_pack_image; " diff --git a/classes/native.bbclass b/classes/native.bbclass index 4f3856ccf5..6698b61cfc 100644 --- a/classes/native.bbclass +++ b/classes/native.bbclass @@ -36,6 +36,8 @@ LDFLAGS_build-darwin = "-L${STAGING_LIBDIR_NATIVE} " STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}" STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}" +STAGING_DIR_JAVA = "${STAGING_DATADIR_JAVA_NATIVE}" + # Don't use site files for native builds export CONFIG_SITE = "" @@ -52,51 +54,71 @@ export RANLIB = "${HOST_PREFIX}ranlib" export STRIP = "${HOST_PREFIX}strip" # Path prefixes -export base_prefix = "${STAGING_DIR_NATIVE}" -export prefix = "${STAGING_DIR_NATIVE}${layout_prefix}" -export exec_prefix = "${STAGING_DIR_NATIVE}${layout_exec_prefix}" - -# Base paths -export base_bindir = "${STAGING_DIR_NATIVE}${layout_base_bindir}" -export base_sbindir = "${STAGING_DIR_NATIVE}${layout_base_sbindir}" -export base_libdir = "${STAGING_DIR_NATIVE}${layout_base_libdir}" - -# Architecture independent paths -export datadir = "${STAGING_DIR_NATIVE}${layout_datadir}" -export sysconfdir = "${STAGING_DIR_NATIVE}${layout_sysconfdir}" -export sharedstatedir = "${STAGING_DIR_NATIVE}${layout_sharedstatedir}" -export localstatedir = "${STAGING_DIR_NATIVE}${layout_localstatedir}" -export infodir = "${STAGING_DIR_NATIVE}${layout_infodir}" -export mandir = "${STAGING_DIR_NATIVE}${layout_mandir}" -export docdir = "${STAGING_DIR_NATIVE}${layout_docdir}" -export servicedir = "${STAGING_DIR_NATIVE}${layout_servicedir}" - -# Architecture dependent paths -export bindir = "${STAGING_DIR_NATIVE}${layout_bindir}" -export sbindir = "${STAGING_DIR_NATIVE}${layout_sbindir}" -export libexecdir = "${STAGING_DIR_NATIVE}${layout_libexecdir}" -export libdir = "${STAGING_DIR_NATIVE}${layout_libdir}" -export includedir = "${STAGING_DIR_NATIVE}${layout_includedir}" -export oldincludedir = "${STAGING_DIR_NATIVE}${layout_includedir}" - -do_stage () { - if [ "${INHIBIT_NATIVE_STAGE_INSTALL}" != "1" ] +base_prefix = "${STAGING_DIR_NATIVE}" +prefix = "${STAGING_DIR_NATIVE}${prefix_native}" +exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}" + +# Since we actually install these into situ there is no staging prefix +STAGING_DIR_HOST = "" +STAGING_DIR_TARGET = "" +SHLIBSDIR = "${STAGING_DIR_NATIVE}/shlibs" +PKG_CONFIG_DIR = "${libdir}/pkgconfig" + +do_stage_native () { + # If autotools is active, use the autotools staging function, else + # use our "make install" equivalent + if [ "${AUTOTOOLS_NATIVE_STAGE_INSTALL}" == "1" ] then - if [ "${JAVA_NATIVE_STAGE_INSTALL}" = "1" ] - then - java_stage - elif [ "${AUTOTOOLS_NATIVE_STAGE_INSTALL}" = "1" ] - then - autotools_stage_all - else - oe_runmake install - fi + autotools_stage_all + else + oe_runmake install fi } -do_install () { - true +do_stage () { + do_stage_native } PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" PKG_CONFIG_SYSROOT_DIR = "" + +ORIG_DEPENDS := "${DEPENDS}" + +DEPENDS_virtclass-native ?= "${ORIG_DEPENDS}" + +python __anonymous () { + # If we've a legacy native do_stage, we need to neuter do_install + stagefunc = bb.data.getVar('do_stage', d, True) + + # For now, force legacy mode for native packages using autotools_stage_all + if (stagefunc.strip() == "autotools_stage_all"): + bb.debug(1, "Forcing legacy staging mode for %s" % bb.data.getVar('FILE', d, 1)) + bb.data.setVar('FORCE_LEGACY_STAGING', "1", d) + elif (stagefunc.strip() != "do_stage_native" and stagefunc.strip() != "autotools_stage_all") and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": + bb.data.setVar("do_install", " :", d) + + if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""): + pn = bb.data.getVar("PN", d, True) + depends = bb.data.getVar("DEPENDS_virtclass-native", d, True) + deps = bb.utils.explode_deps(depends) + newdeps = [] + for dep in deps: + if dep.endswith("-cross"): + newdeps.append(dep.replace("-cross", "-native")) + elif not dep.endswith("-native"): + + newdeps.append(dep + "-native") + else: + newdeps.append(dep) + bb.data.setVar("DEPENDS_virtclass-native", " ".join(newdeps), d) + provides = bb.data.getVar("PROVIDES", d, True) + for prov in provides.split(): + if prov.find(pn) != -1: + continue + if not prov.endswith("-native"): + + provides = provides.replace(prov, prov + "-native") + bb.data.setVar("PROVIDES", provides, d) + bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-native", d) +} + diff --git a/classes/nativesdk.bbclass b/classes/nativesdk.bbclass new file mode 100644 index 0000000000..080adc5d77 --- /dev/null +++ b/classes/nativesdk.bbclass @@ -0,0 +1,78 @@ +# SDK packages are built either explicitly by the user, +# or indirectly via dependency. No need to be in 'world'. +EXCLUDE_FROM_WORLD = "1" + +# +# Update BASE_PACKAGE_ARCH and PACKAGE_ARCHS +# +OLD_PACKAGE_ARCH := ${BASE_PACKAGE_ARCH} +BASE_PACKAGE_ARCH = "${SDK_ARCH}-nativesdk" +python () { + archs = bb.data.getVar('PACKAGE_ARCHS', d, True).split() + sdkarchs = [] + for arch in archs: + sdkarchs.append(arch + '-nativesdk') + bb.data.setVar('PACKAGE_ARCHS', " ".join(sdkarchs), d) +} + +#STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_SYS}-nativesdk" +#STAGING_DIR_TARGET = "${STAGING_DIR}/${BASEPKG_TARGET_SYS}-nativesdk" + +CROSS_DIR = "${TMPDIR}/cross/${HOST_ARCH}" + +HOST_ARCH = "${SDK_ARCH}" +HOST_VENDOR = "${SDK_VENDOR}" +HOST_OS = "${SDK_OS}" +HOST_PREFIX = "${SDK_PREFIX}" +HOST_CC_ARCH = "${SDK_CC_ARCH}" +#HOST_SYS = "${HOST_ARCH}${TARGET_VENDOR}-${HOST_OS}" + +TARGET_ARCH = "${SDK_ARCH}" +TARGET_VENDOR = "${SDK_VENDOR}" +TARGET_OS = "${SDK_OS}" +TARGET_PREFIX = "${SDK_PREFIX}" +TARGET_CC_ARCH = "${SDK_CC_ARCH}" + +CPPFLAGS = "${BUILDSDK_CPPFLAGS}" +CFLAGS = "${BUILDSDK_CFLAGS}" +CXXFLAGS = "${BUILDSDK_CFLAGS}" +LDFLAGS = "${BUILDSDK_LDFLAGS}" + +# Change to place files in SDKPATH +prefix = "${SDKPATH}" +exec_prefix = "${SDKPATH}" +base_prefix = "${SDKPATH}" + +FILES_${PN} += "${prefix}" +FILES_${PN}-dbg += "${prefix}/.debug \ + ${prefix}/bin/.debug \ + " + +export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig" +export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" + +python __anonymous () { + pn = bb.data.getVar("PN", d, True) + depends = bb.data.getVar("DEPENDS", d, True) + deps = bb.utils.explode_deps(depends) + newdeps = [] + for dep in deps: + if dep.endswith("-native") or dep.endswith("-cross"): + newdeps.append(dep) + elif dep.endswith("-gcc-intermediate") or dep.endswith("-gcc-initial") or dep.endswith("-gcc"): + newdeps.append(dep + "-crosssdk") + elif not dep.endswith("-nativesdk"): + newdeps.append(dep + "-nativesdk") + else: + newdeps.append(dep) + bb.data.setVar("DEPENDS", " ".join(newdeps), d) + provides = bb.data.getVar("PROVIDES", d, True) + for prov in provides.split(): + if prov.find(pn) != -1: + continue + if not prov.endswith("-nativesdk"): + provides = provides.replace(prov, prov + "-nativesdk") + bb.data.setVar("PROVIDES", provides, d) +} + + diff --git a/classes/nylon-image.bbclass b/classes/nylon-image.bbclass index 6d867eab48..e973bf7cf5 100644 --- a/classes/nylon-image.bbclass +++ b/classes/nylon-image.bbclass @@ -9,11 +9,10 @@ nylon_create_imgz() { # copy the kernel (for mips on flash) into tmp FLASH_BIN=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_NAME}.flash.bin - test -f ${FLASH_BIN} && \ cp ${FLASH_BIN} ${DEPLOY_DIR_IMAGE}/tmp/zImage.flash # copy rootfs.jffs (or so) into tmp - cp ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.${type} ${DEPLOY_DIR_IMAGE}/tmp/rootfs.${type} + cp ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${DEPLOY_DIR_IMAGE}/tmp/rootfs.jffs2 # make an imgz out of tmp ( cd ${DEPLOY_DIR_IMAGE}/tmp; tar cvzf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.imgz * ) diff --git a/classes/nylon-mirrors.bbclass b/classes/nylon-mirrors.bbclass index 02fddc01ba..11cc45ca0c 100644 --- a/classes/nylon-mirrors.bbclass +++ b/classes/nylon-mirrors.bbclass @@ -1,6 +1,6 @@ MIRRORS_append () { -ftp://.*/.* http://meshcube.org/nylon/stable/sources/ -https?://.*/.* http://meshcube.org/nylon/stable/sources/ -ftp://.*/.* http://meshcube.org/nylon/unstable/sources/ -https?://.*/.* http://meshcube.org/nylon/unstable/sources/ +ftp://.*/.*/ http://download.berlin.freifunk.net/meshcube.org/nylon/stable/sources/ +http://.*/.*/ http://download.berlin.freifunk.net/meshcube.org/nylon/stable/sources/ +ftp://.*/.*/ http://download.berlin.freifunk.net/meshcube.org/nylon/unstable/sources/ +http://.*/.*/ http://download.berlin.freifunk.net/meshcube.org/nylon/unstable/sources/ }
\ No newline at end of file diff --git a/classes/oestats-client.bbclass b/classes/oestats-client.bbclass index 6d348d3ded..e4e6206ac4 100644 --- a/classes/oestats-client.bbclass +++ b/classes/oestats-client.bbclass @@ -5,8 +5,9 @@ # To make use of this class, add to your local.conf: # # INHERIT += "oestats-client" -# OESTATS_SERVER = "some.server.org" +# OESTATS_SERVER = "http://some.server.org" # OESTATS_BUILDER = "some_nickname" +# def oestats_setid(d, val): import bb @@ -18,8 +19,9 @@ def oestats_getid(d): f = file(bb.data.getVar('TMPDIR', d, True) + '/oestats.id', 'r') return f.read() -def oestats_send(server, action, vars = {}, files = {}): - import httplib +def oestats_send(d, server, action, vars = {}, files = {}): + import bb + import urllib2 # build body output = [] @@ -48,12 +50,17 @@ def oestats_send(server, action, vars = {}, files = {}): "Content-type": "multipart/form-data; boundary=%s" % bound, "Content-length": str(len(body))} - # send request - conn = httplib.HTTPConnection(server) - conn.request("POST", action, body, headers) - response = conn.getresponse() + proxy = bb.data.getVar('HTTP_PROXY', d, True ) + if (proxy): + phl = urllib2.ProxyHandler({'http' : proxy}) + opener = urllib2.build_opener(phl) + urllib2.install_opener(opener) + + actionURL = "%s%s" %(server, action) + req = urllib2.Request(actionURL, body, headers); + response = urllib2.urlopen(req) data = response.read() - conn.close() + return data def oestats_start(server, builder, d): @@ -64,7 +71,7 @@ def oestats_start(server, builder, d): # send report id = "" try: - data = oestats_send(server, "/builds/", { + data = oestats_send(d, server, "/builds/", { 'builder': builder, 'build_arch': bb.data.getVar('BUILD_ARCH', d, True), 'metadata_branch': bb.data.getVar('METADATA_BRANCH', d, True), @@ -97,11 +104,11 @@ def oestats_stop(server, d, failures): status = "Succeeded" try: - response = oestats_send(server, "/builds/%s/" % id, { + response = oestats_send(d, server, "/builds/%s/" % id, { 'status': status, }) if status == 'Failed': - bb.note("oestats: build failed, see http://%s%s" % (server,response)) + bb.note("oestats: build failed, see %s%s" % (server, response)) except: bb.note("oestats: error stopping build") @@ -157,9 +164,9 @@ def oestats_task(server, d, task, status): # send report try: - response = oestats_send(server, "/tasks/", vars, files) + response = oestats_send(d, server, "/tasks/", vars, files) if status == 'Failed': - bb.note("oestats: task failed, see http://%s%s" % (server, response)) + bb.note("oestats: task failed, see %s%s" % (server, response)) except: bb.note("oestats: error sending task, disabling stats") oestats_setid(d, "") @@ -174,6 +181,8 @@ python oestats_eventhandler () { return NotHandled server = bb.data.getVar('OESTATS_SERVER', e.data, True) + if not server.startswith('http://') and not server.startswith('https://'): + server = "http://%s" %(server) builder = bb.data.getVar('OESTATS_BUILDER', e.data, True) if not server or not builder: return NotHandled diff --git a/classes/openmoko-base.bbclass b/classes/openmoko-base.bbclass index 184477b1c0..8cbf7df884 100644 --- a/classes/openmoko-base.bbclass +++ b/classes/openmoko-base.bbclass @@ -4,7 +4,6 @@ OPENMOKO_RELEASE ?= "OM-2007.2" OPENMOKO_MIRROR ?= "svn://svn.openmoko.org/trunk" def openmoko_base_get_subdir(d): - import bb openmoko, section = bb.data.getVar('SECTION', d, 1).split("/") if section == 'base' or section == 'libs': return "" elif section in 'apps tools pim'.split(): return "applications" diff --git a/classes/openmoko2.bbclass b/classes/openmoko2.bbclass index ef734e4311..233c721ff7 100644 --- a/classes/openmoko2.bbclass +++ b/classes/openmoko2.bbclass @@ -5,12 +5,10 @@ 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" diff --git a/classes/package.bbclass b/classes/package.bbclass index 55595928c6..062f782129 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -2,7 +2,14 @@ # General packaging help functions # -PKGDEST = "${WORKDIR}/install" +PKGD = "${WORKDIR}/package" +PKGDEST = "${WORKDIR}/packages-split" + +PKGV ?= "${PV}" +PKGR ?= "${PR}${DISTRO_PR}" + +EXTENDPKGEVER = "${@['','${PKGE\x7d:'][bb.data.getVar('PKGE',d,1) > 0]}" +EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}" def legitimize_package_name(s): """ @@ -26,14 +33,10 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst Used in .bb files to split up dynamically generated subpackages of a given package, usually plugins or modules. """ - import os, os.path, bb - dvar = bb.data.getVar('D', d, 1) - if not dvar: - bb.error("D not defined") - return + dvar = bb.data.getVar('PKGD', d, True) - packages = bb.data.getVar('PACKAGES', d, 1).split() + packages = bb.data.getVar('PACKAGES', d, True).split() if postinst: postinst = '#!/bin/sh\n' + postinst + '\n' @@ -94,7 +97,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst the_files.append(aux_files_pattern_verbatim % m.group(1)) bb.data.setVar('FILES_' + pkg, " ".join(the_files), d) if extra_depends != '': - the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, 1) + the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, True) if the_depends: the_depends = '%s %s' % (the_depends, extra_depends) else: @@ -106,7 +109,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst if postrm: bb.data.setVar('pkg_postrm_' + pkg, postrm, d) else: - oldfiles = bb.data.getVar('FILES_' + pkg, d, 1) + oldfiles = bb.data.getVar('FILES_' + pkg, d, True) if not oldfiles: bb.fatal("Package '%s' exists but has no files" % pkg) bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d) @@ -132,7 +135,6 @@ def package_stash_hook(func, name, d): f.close() 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(): @@ -150,9 +152,9 @@ def runstrip(file, d): # 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 + import commands, stat - pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, 1) + pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, file)) @@ -166,11 +168,11 @@ def runstrip(file, d): # If the file is in a .debug directory it was already stripped, # don't do it again... if os.path.dirname(file).endswith(".debug"): - bb.note("Already ran strip") + bb.debug(2, "Already ran strip on %s" % file) return 0 - strip = bb.data.getVar("STRIP", d, 1) - objcopy = bb.data.getVar("OBJCOPY", d, 1) + strip = bb.data.getVar("STRIP", d, True) + objcopy = bb.data.getVar("OBJCOPY", d, True) newmode = None if not os.access(file, os.W_OK): @@ -183,6 +185,9 @@ def runstrip(file, d): extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded" elif "shared" in result or "executable" in result: extraflags = "--remove-section=.comment --remove-section=.note" + elif file.endswith(".a"): + extraflags = "--remove-section=.comment --strip-debug" + bb.mkdirhier(os.path.join(os.path.dirname(file), ".debug")) debugfile=os.path.join(os.path.dirname(file), ".debug", os.path.basename(file)) @@ -202,13 +207,76 @@ def runstrip(file, d): return 1 +PACKAGESTRIPFUNCS += "do_runstrip" +python do_runstrip() { + import stat + + dvar = bb.data.getVar('PKGD', d, True) + def isexec(path): + try: + s = os.stat(path) + except (os.error, AttributeError): + return 0 + return (s[stat.ST_MODE] & stat.S_IEXEC) + + 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): + runstrip(file, d) +} + + +def write_package_md5sums (root, outfile, ignorepaths): + # For each regular file under root, writes an md5sum to outfile. + # With thanks to patch.bbclass. + import bb, os + + try: + # Python 2.5+ + import hashlib + ctor = hashlib.md5 + except ImportError: + import md5 + ctor = md5.new + + outf = file(outfile, 'w') + + # Each output line looks like: "<hex...> <filename without leading slash>" + striplen = len(root) + if not root.endswith('/'): + striplen += 1 + + for walkroot, dirs, files in os.walk(root): + # Skip e.g. the DEBIAN directory + if walkroot[striplen:] in ignorepaths: + dirs[:] = [] + continue + + for name in files: + fullpath = os.path.join(walkroot, name) + if os.path.islink(fullpath) or (not os.path.isfile(fullpath)): + continue + + m = ctor() + f = file(fullpath, 'rb') + while True: + d = f.read(8192) + if not d: + break + m.update(d) + f.close() + + print >> outf, "%s %s" % (m.hexdigest(), fullpath[striplen:]) + + outf.close() + + # # Package data handling routines # def get_package_mapping (pkg, d): - import bb, os - data = read_subpkgdata(pkg, d) key = "PKG_%s" % pkg @@ -218,12 +286,10 @@ def get_package_mapping (pkg, d): return pkg def runtime_mapping_rename (varname, d): - import bb, os - - #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1))) + #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, True))) new_depends = [] - for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""): + for depend in explode_deps(bb.data.getVar(varname, d, True) or ""): # Have to be careful with any version component of the depend split_depend = depend.split(' (') new_depend = get_package_mapping(split_depend[0].strip(), d) @@ -234,35 +300,26 @@ def runtime_mapping_rename (varname, d): bb.data.setVar(varname, " ".join(new_depends) or None, d) - #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1))) + #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, True))) # # Package functions suitable for inclusion in PACKAGEFUNCS # python package_do_split_locales() { - import os - - if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'): + if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): bb.debug(1, "package requested not splitting locales") return - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + packages = (bb.data.getVar('PACKAGES', d, True) or "").split() - datadir = bb.data.getVar('datadir', d, 1) + datadir = bb.data.getVar('datadir', d, True) if not datadir: bb.note("datadir not defined") return - dvar = bb.data.getVar('D', d, 1) - if not dvar: - bb.error("D not defined") - return - - pn = bb.data.getVar('PN', d, 1) - if not pn: - bb.error("PN not defined") - return + dvar = bb.data.getVar('PKGD', d, True) + pn = bb.data.getVar('PN', d, True) if pn + '-locale' in packages: packages.remove(pn + '-locale') @@ -295,42 +352,29 @@ python package_do_split_locales() { bb.data.setVar('PACKAGES', ' '.join(packages), d) } -python populate_packages () { - import glob, stat, errno, re +python perform_packagecopy () { + dest = bb.data.getVar('D', d, True) + dvar = bb.data.getVar('PKGD', d, True) - workdir = bb.data.getVar('WORKDIR', d, 1) - if not workdir: - bb.error("WORKDIR not defined, unable to package") - return - - import os # path manipulations - outdir = bb.data.getVar('DEPLOY_DIR', d, 1) - if not outdir: - bb.error("DEPLOY_DIR not defined, unable to package") - return - bb.mkdirhier(outdir) - - dvar = bb.data.getVar('D', d, 1) - if not dvar: - bb.error("D not defined, unable to package") - return bb.mkdirhier(dvar) - packages = bb.data.getVar('PACKAGES', d, 1) + # Start by package population by taking a copy of the installed + # files to operate on + os.system('rm -rf %s/*' % (dvar)) + os.system('cp -pPR %s/* %s/' % (dest, dvar)) +} - pn = bb.data.getVar('PN', d, 1) - if not pn: - bb.error("PN not defined") - return +python populate_packages () { + import glob, errno, re,os - os.chdir(dvar) + workdir = bb.data.getVar('WORKDIR', d, True) + outdir = bb.data.getVar('DEPLOY_DIR', d, True) + dvar = bb.data.getVar('PKGD', d, True) + packages = bb.data.getVar('PACKAGES', d, True) + pn = bb.data.getVar('PN', d, True) - def isexec(path): - try: - s = os.stat(path) - except (os.error, AttributeError): - return 0 - return (s[stat.ST_MODE] & stat.S_IEXEC) + bb.mkdirhier(outdir) + os.chdir(dvar) # Sanity check PACKAGES for duplicates - should be moved to # sanity.bbclass once we have the infrastucture @@ -344,19 +388,17 @@ python populate_packages () { else: package_list.append(pkg) - if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1'): - 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): - runstrip(file, d) - pkgdest = bb.data.getVar('PKGDEST', d, 1) + if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, True) != '1'): + for f in (bb.data.getVar('PACKAGESTRIPFUNCS', d, True) or '').split(): + bb.build.exec_func(f, d) + + pkgdest = bb.data.getVar('PKGDEST', d, True) os.system('rm -rf %s' % pkgdest) seen = [] main_is_empty = 1 - main_pkg = bb.data.getVar('PN', d, 1) + main_pkg = bb.data.getVar('PN', d, True) for pkg in package_list: localdata = bb.data.createCopy(d) @@ -364,13 +406,13 @@ python populate_packages () { bb.mkdirhier(root) bb.data.setVar('PKG', pkg, localdata) - overrides = bb.data.getVar('OVERRIDES', localdata, 1) + overrides = bb.data.getVar('OVERRIDES', localdata, True) if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) bb.data.update_data(localdata) - filesvar = bb.data.getVar('FILES', localdata, 1) or "" + filesvar = bb.data.getVar('FILES', localdata, True) or "" files = filesvar.split() for file in files: if os.path.isabs(file): @@ -384,8 +426,12 @@ python populate_packages () { globbed = glob.glob(file) if globbed: if [ file ] != globbed: - files += globbed - continue + if not file in globbed: + files += globbed + continue + else: + globbed.remove(file) + files += globbed if (not os.path.islink(file)) and (not os.path.exists(file)): continue if file in seen: @@ -399,8 +445,8 @@ python populate_packages () { dpath = os.path.dirname(fpath) bb.mkdirhier(dpath) ret = bb.copyfile(file, fpath) - if ret is False or ret == 0: - raise bb.build.FuncFailed("File population failed") + if ret is False: + raise bb.build.FuncFailed("File population failed when copying %s to %s" % (file, fpath)) if pkg == main_pkg and main_is_empty: main_is_empty = 0 del localdata @@ -421,7 +467,7 @@ python populate_packages () { bb.build.exec_func("package_name_hook", d) for pkg in package_list: - pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) + pkgname = bb.data.getVar('PKG_%s' % pkg, d, True) if pkgname is None: bb.data.setVar('PKG_%s' % pkg, pkg, d) @@ -449,7 +495,7 @@ python populate_packages () { for pkg in package_list: rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") - remstr = "${PN} (= ${EXTENDPV})" + remstr = "${PN} (= ${EXTENDPKGV})" if main_is_empty and remstr in rdepends: rdepends.remove(remstr) for l in dangling_links[pkg]: @@ -480,11 +526,17 @@ python emit_pkgdata() { c = codecs.getencoder("string_escape") return c(str)[0] - val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) + val = bb.data.getVar('%s_%s' % (var, pkg), d, True) if val: f.write('%s_%s: %s\n' % (var, pkg, encode(val))) + return + val = bb.data.getVar('%s' % (var), d, True) + if val: + f.write('%s: %s\n' % (var, encode(val))) + return packages = bb.data.getVar('PACKAGES', d, True) + pkgdest = bb.data.getVar('PKGDEST', d, 1) pkgdatadir = bb.data.getVar('PKGDATA_DIR', d, True) pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) @@ -497,13 +549,16 @@ python emit_pkgdata() { f.close() package_stagefile(data_file, d) - workdir = bb.data.getVar('WORKDIR', d, 1) + workdir = bb.data.getVar('WORKDIR', d, True) for pkg in packages.split(): subdata_file = pkgdatadir + "/runtime/%s" % pkg sf = open(subdata_file, 'w') write_if_exists(sf, pkg, 'PN') + write_if_exists(sf, pkg, 'PV') write_if_exists(sf, pkg, 'PR') + write_if_exists(sf, pkg, 'PKGV') + write_if_exists(sf, pkg, 'PKGR') write_if_exists(sf, pkg, 'DESCRIPTION') write_if_exists(sf, pkg, 'RDEPENDS') write_if_exists(sf, pkg, 'RPROVIDES') @@ -524,12 +579,12 @@ python emit_pkgdata() { #if pkgdatadir2: # bb.copyfile(subdata_file, pkgdatadir2 + "/runtime/%s" % pkg) - allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1) + allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True) if not allow_empty: - allow_empty = bb.data.getVar('ALLOW_EMPTY', d, 1) - root = "%s/install/%s" % (workdir, pkg) + allow_empty = bb.data.getVar('ALLOW_EMPTY', d, True) + root = "%s/%s" % (pkgdest, pkg) os.chdir(root) - g = glob('*') + g = glob('*') + glob('.[!.]*') if g or allow_empty == "1": packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg file(packagedfile, 'w').close() @@ -550,31 +605,28 @@ fi SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs" python package_do_shlibs() { - import os, re, os.path + import re exclude_shlibs = bb.data.getVar('EXCLUDE_FROM_SHLIBS', d, 0) if exclude_shlibs: - bb.note("not generating shlibs") + bb.debug(1, "not generating shlibs") return lib_re = re.compile("^lib.*\.so") libdir_re = re.compile(".*/lib$") - packages = bb.data.getVar('PACKAGES', d, 1) + packages = bb.data.getVar('PACKAGES', d, True) - workdir = bb.data.getVar('WORKDIR', d, 1) - if not workdir: - bb.error("WORKDIR not defined") - return + workdir = bb.data.getVar('WORKDIR', d, True) - ver = bb.data.getVar('PV', d, 1) + ver = bb.data.getVar('PKGV', d, True) if not ver: - bb.error("PV not defined") + bb.error("PKGV not defined") return - pkgdest = bb.data.getVar('PKGDEST', d, 1) + pkgdest = bb.data.getVar('PKGDEST', d, True) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) bb.mkdirhier(shlibs_dir) pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) @@ -592,11 +644,17 @@ python package_do_shlibs() { use_ldconfig = False needed = {} - private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1) + private_libs = bb.data.getVar('PRIVATE_LIBS', d, True) for pkg in packages.split(): needs_ldconfig = False bb.debug(2, "calculating shlib provides for %s" % pkg) + pkgver = bb.data.getVar('PKGV_' + pkg, d, True) + if not pkgver: + pkgver = bb.data.getVar('PV_' + pkg, d, True) + if not pkgver: + pkgver = ver + needed[pkg] = [] sonames = list() top = os.path.join(pkgdest, pkg) @@ -606,8 +664,8 @@ python package_do_shlibs() { soname = None path = os.path.join(root, file) if (os.access(path, os.X_OK) or lib_re.match(file)) and not os.path.islink(path): - cmd = bb.data.getVar('OBJDUMP', d, 1) + " -p " + path + " 2>/dev/null" - cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, 1), cmd) + cmd = bb.data.getVar('OBJDUMP', d, True) + " -p " + path + " 2>/dev/null" + cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, True), cmd) fd = os.popen(cmd) lines = fd.readlines() fd.close() @@ -641,15 +699,15 @@ python package_do_shlibs() { fd.close() package_stagefile(shlibs_file, d) fd = open(shver_file, 'w') - fd.write(ver + '\n') + fd.write(pkgver + '\n') fd.close() package_stagefile(shver_file, d) if needs_ldconfig and use_ldconfig: bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) - postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) + postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, True) or bb.data.getVar('pkg_postinst', d, True) if not postinst: postinst = '#!/bin/sh\n' - postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1) + postinst += bb.data.getVar('ldconfig_postinst_fragment', d, True) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) if pstageactive == "1": @@ -676,7 +734,7 @@ python package_do_shlibs() { for l in lines: shlib_provider[l.rstrip()] = (dep_pkg, lib_ver) - assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, 1) + assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, True) if assumed_libs: for e in assumed_libs.split(): l, dep_pkg = e.split(":") @@ -722,18 +780,13 @@ python package_do_shlibs() { } python package_do_pkgconfig () { - import re, os - - packages = bb.data.getVar('PACKAGES', d, 1) - - workdir = bb.data.getVar('WORKDIR', d, 1) - if not workdir: - bb.error("WORKDIR not defined") - return + import re - pkgdest = bb.data.getVar('PKGDEST', d, 1) + packages = bb.data.getVar('PACKAGES', d, True) + workdir = bb.data.getVar('WORKDIR', d, True) + pkgdest = bb.data.getVar('PKGDEST', d, True) - shlibs_dir = bb.data.getVar('SHLIBSDIR', d, 1) + shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) bb.mkdirhier(shlibs_dir) pc_re = re.compile('(.*)\.pc$') @@ -828,7 +881,7 @@ python package_do_pkgconfig () { } python read_shlibdeps () { - packages = bb.data.getVar('PACKAGES', d, 1).split() + packages = bb.data.getVar('PACKAGES', d, True).split() for pkg in packages: rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": @@ -856,14 +909,14 @@ python package_depchains() { package. """ - packages = bb.data.getVar('PACKAGES', d, 1) - postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() - prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() + packages = bb.data.getVar('PACKAGES', d, True) + postfixes = (bb.data.getVar('DEPCHAIN_POST', d, True) or '').split() + prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, True) or '').split() def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d): #bb.note('depends for %s is %s' % (base, depends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") for depend in depends: if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'): @@ -884,7 +937,7 @@ python package_depchains() { def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): #bb.note('rdepends for %s is %s' % (base, rdepends)) - rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, 1) or bb.data.getVar('RRECOMMENDS', d, 1) or "") + rreclist = explode_deps(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") for depend in rdepends: if depend.endswith('-dev'): @@ -904,15 +957,15 @@ python package_depchains() { list.append(dep) depends = [] - for dep in explode_deps(bb.data.getVar('DEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('DEPENDS', d, True) or ""): add_dep(depends, dep) rdepends = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS', d, True) or ""): add_dep(rdepends, dep) for pkg in packages.split(): - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, True) or ""): add_dep(rdepends, dep) #bb.note('rdepends is %s' % rdepends) @@ -945,13 +998,15 @@ python package_depchains() { pkg_addrrecs(pkg, base, suffix, func, rdepends, d) else: rdeps = [] - for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or ""): + for dep in explode_deps(bb.data.getVar('RDEPENDS_' + base, d, True) or bb.data.getVar('RDEPENDS', d, True) or ""): add_dep(rdeps, dep) pkg_addrrecs(pkg, base, suffix, func, rdeps, d) } - -PACKAGEFUNCS ?= "package_do_split_locales \ +PACKAGE_PREPROCESS_FUNCS ?= "" +PACKAGEFUNCS ?= "perform_packagecopy \ + ${PACKAGE_PREPROCESS_FUNCS} \ + package_do_split_locales \ populate_packages \ package_do_shlibs \ package_do_pkgconfig \ @@ -973,7 +1028,7 @@ def package_run_hooks(f, d): bb.parse.parse_py.BBHandler.feeder(line, l, fn, os.path.basename(fn), d) line += 1 fp.close() - anonqueue = bb.data.getVar("__anonqueue", d, 1) or [] + anonqueue = bb.data.getVar("__anonqueue", d, True) or [] body = [x['content'] for x in anonqueue] flag = { 'python' : 1, 'func' : 1 } bb.data.setVar("__anonfunc", "\n".join(body), d) @@ -992,12 +1047,22 @@ def package_run_hooks(f, d): bb.data.delVar("__anonfunc", d) python package_do_package () { - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + packages = (bb.data.getVar('PACKAGES', d, True) 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(): + workdir = bb.data.getVar('WORKDIR', d, True) + outdir = bb.data.getVar('DEPLOY_DIR', d, True) + dest = bb.data.getVar('D', d, True) + dvar = bb.data.getVar('PKGD', d, True) + pn = bb.data.getVar('PN', d, True) + + if not workdir or not outdir or not dest or not dvar or not pn or not packages: + bb.error("WORKDIR, DEPLOY_DIR, D, PN and PKGD all must be defined, unable to package") + return + + for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split(): bb.build.exec_func(f, d) package_run_hooks(f, d) } diff --git a/classes/package_dbg.bbclass b/classes/package_dbg.bbclass new file mode 100644 index 0000000000..39dceaf9b3 --- /dev/null +++ b/classes/package_dbg.bbclass @@ -0,0 +1,125 @@ +# package_dbg.bbclass: populate -dbg versions for each package in PACKAGES +# +# Copyright (c) 2009 MontaVista Software, Inc. All rights reserved. +# +# Released under the MIT license (see LICENSE.MIT for the terms) + + +inherit package + + +PACKAGE_DBG_DIRS = "${bindir} ${sbindir} \ + ${libexecdir} ${libdir} \ + ${base_bindir} ${base_sbindir} \ + ${base_libdir}" +PACKAGE_DBG_DESC = "Debugging files for %s" +PACKAGE_DBG_EXCLUDE = "${PN}-locale* ${PN}-doc ${PN}-dev *-dbg" + + +def __find(dir): + """ Given a directory, recurses into that directory, + returning all files. """ + + from os import walk + from os.path import join + + for root, dirs, files in walk(dir): + for file in files: + yield join(root, file) + +def __package_get_files(pkg, d): + """ Obtains a list of files to be included in a package. + + Starting from the FILES_<pkg> variable, it expands any globs in the list, + which removes missing files, and traverses any directories in the list. + + It does *not* remove files which are also in other packages, it's left + to the user's discretion whether to allow overlap. """ + + from glob import glob + from os.path import join, isdir, islink + + installdir = d.getVar("D", True) + installdirlen = len(installdir) + + files = (d.getVar("FILES_%s" % pkg, True) or "").split() + for globbed in (glob(join(installdir, file[1:])) for file in files): + for path in globbed: + if isdir(path) and not islink(path): + for file in __find(path): + yield file[installdirlen:] + else: + yield path[installdirlen:] + +def add_dbg_packages(d): + from fnmatch import fnmatch + + packages = d.getVar("PACKAGES", True).split() + excludes = d.getVar("PACKAGE_DBG_EXCLUDE", True).split() + + for pkg in tuple(packages): + if any(fnmatch(pkg, excluded) for excluded in excludes): + continue + + dbgpkg = "%s-dbg" % pkg + if not dbgpkg in packages: + packages.insert(0, dbgpkg) + + d.setVar("PACKAGES", " ".join(packages)) + + +# Add the -dbg packages to PACKAGES +python () { + from bb.data import inherits_class as inherits + + # Task handles its own -dbg versions of its packages at the moment + if not inherits("task", d): + dynpkgs = d.getVar("PACKAGES_DYNAMIC", True).split() + dynpkgs += ["%s-dbg" % dyn for dyn in dynpkgs] + d.setVar("PACKAGES_DYNAMIC", " ".join(dynpkgs)) + + add_dbg_packages(d) +} + +python populate_packages_prepend () { + from bb.data import inherits_class as inherits + + if not inherits("task", d): + bb.build.exec_func("package_do_dbg", d) +} + +# Populate the -dbg subpackage metadata +python package_do_dbg() { + """ Populate the -dbg subpackage metadata. """ + + from os.path import join, basename, dirname + + def setVar(key, val): + if d.getVar(key, val) is None: + d.setVar(key, val) + + add_dbg_packages(d) + packages = d.getVar("PACKAGES", True).split() + desc = d.getVar("PACKAGE_DBG_DESC", True) + debug_dirs = d.getVar("PACKAGE_DBG_DIRS", True).split() + + done = [] + for pkgname in tuple(packages): + files = tuple(__package_get_files(pkgname, d)) + dbg = [join(dirname(file), ".debug", basename(file)) + for file in files + if not file in done and + any(file.startswith(dir) for dir in debug_dirs)] + done.extend(files) + + if dbg: + setVar("FILES_%s-dbg" % pkgname, " ".join(dbg)) + setVar("DESCRIPTION_%s-dbg" % pkgname, desc % pkgname) + setVar("RDEPENDS_%s-dbg" % pkgname, pkgname) + else: + try: + packages.remove("%s-dbg" % pkgname) + except ValueError: + pass + d.setVar("PACKAGES", " ".join(packages)) +} diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index 5127d32f33..2a9bf76a79 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -17,13 +17,11 @@ 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) } addtask package_deb_install python do_package_deb_install () { - import os, sys pkg = bb.data.getVar('PKG', d, 1) pkgfn = bb.data.getVar('PKGFN', d, 1) rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) @@ -39,6 +37,7 @@ python do_package_deb_install () { os.makedirs(rootfs) os.chdir(rootfs) except OSError: + import sys raise bb.build.FuncFailed(str(sys.exc_value)) # update packages file @@ -69,14 +68,13 @@ python do_package_deb_install () { } python do_package_deb () { - import sys, re, copy + import re, copy workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: bb.error("WORKDIR not defined, unable to package") return - import os # path manipulations outdir = bb.data.getVar('DEPLOY_DIR_DEB', d, 1) if not outdir: bb.error("DEPLOY_DIR_DEB not defined, unable to package") @@ -130,7 +128,7 @@ python do_package_deb () { os.chdir(root) from glob import glob - g = glob('*') + g = glob('*') + glob('.[!.]*') try: del g[g.index('DEBIAN')] del g[g.index('./DEBIAN')] @@ -188,6 +186,7 @@ python do_package_deb () { for (c, fs) in fields: ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)))) except KeyError: + import sys (type, value, traceback) = sys.exc_info() bb.utils.unlockfile(lf) ctrlfile.close() @@ -243,6 +242,13 @@ python do_package_deb () { conffiles.write('%s\n' % f) conffiles.close() + try: + write_package_md5sums(root, os.path.join(controldir, 'md5sums'), + ['DEBIAN']) + except: + bb.utils.unlockfile(lf) + raise + os.chdir(basedir) ret = os.system("PATH=\"%s\" fakeroot dpkg-deb -b %s %s" % (bb.data.getVar("PATH", localdata, 1), root, pkgoutdir)) if ret != 0: @@ -254,7 +260,6 @@ python do_package_deb () { } python () { - import bb if bb.data.getVar('PACKAGES', d, True) != '': deps = (bb.data.getVarFlag('do_package_write_deb', 'depends', d) or "").split() deps.append('dpkg-native:do_populate_staging') diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index 89d5071c09..420c892f10 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -17,7 +17,6 @@ python package_ipk_install () { # Warning - this function is not multimachine safe (see stagingdir reference)! # - import os, sys, bb pkg = bb.data.getVar('PKG', d, 1) pkgfn = bb.data.getVar('PKGFN', d, 1) rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) @@ -31,6 +30,7 @@ python package_ipk_install () { bb.mkdirhier(rootfs) os.chdir(rootfs) except OSError: + import sys (type, value, traceback) = sys.exc_info() print value raise bb.build.FuncFailed @@ -67,10 +67,16 @@ python package_ipk_install () { raise bb.build.FuncFailed } +do_package_update_index_ipk[lockfiles] = "${DEPLOY_DIR_IPK}.lock" +do_package_update_index_ipk[nostamp] = "1" +do_package_update_index_ipk[recrdeptask] += "do_package_write_ipk" +do_package_update_index_ipk[recrdeptask] += "do_package_write_ipk" +do_package_update_index_ipk[depends] += "ipkg-utils-native:do_populate_staging" + # # Update the Packages index files in ${DEPLOY_DIR_IPK} # -package_update_index_ipk () { +do_package_update_index_ipk () { set -x ipkgarchs="${PACKAGE_ARCHS}" @@ -79,6 +85,7 @@ package_update_index_ipk () { return fi + mkdir -p ${DEPLOY_DIR_IPK} 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} @@ -128,14 +135,14 @@ package_generate_ipkg_conf () { } python do_package_ipk () { - import sys, re, copy, bb + import re, copy workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: bb.error("WORKDIR not defined, unable to package") return - import os # path manipulations + outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, 1) if not outdir: bb.error("DEPLOY_DIR_IPK not defined, unable to package") @@ -167,10 +174,9 @@ python do_package_ipk () { pkgname = pkg bb.data.setVar('PKG', pkgname, localdata) - overrides = bb.data.getVar('OVERRIDES', localdata) + overrides = bb.data.getVar('OVERRIDES', localdata, True) if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') - overrides = bb.data.expand(overrides, localdata) bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) bb.data.update_data(localdata) @@ -180,15 +186,14 @@ python do_package_ipk () { bb.mkdirhier(pkgoutdir) os.chdir(root) from glob import glob - g = glob('*') + g = glob('*') + glob('.[!.]*') try: del g[g.index('CONTROL')] del g[g.index('./CONTROL')] except ValueError: pass if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": - from bb import note - note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', localdata, True))) + bb.note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', localdata, True))) bb.utils.unlockfile(lf) continue @@ -203,9 +208,9 @@ python do_package_ipk () { fields = [] pe = bb.data.getVar('PE', d, 1) if pe and int(pe) > 0: - fields.append(["Version: %s:%s-%s%s\n", ['PE', 'PV', 'PR', 'DISTRO_PR']]) + fields.append(["Version: %s:%s-%s\n", ['PE', 'PKGV', 'PKGR']]) else: - fields.append(["Version: %s-%s%s\n", ['PV', 'PR', 'DISTRO_PR']]) + fields.append(["Version: %s-%s\n", ['PKGV', 'PKGR']]) fields.append(["Description: %s\n", ['DESCRIPTION']]) fields.append(["Section: %s\n", ['SECTION']]) fields.append(["Priority: %s\n", ['PRIORITY']]) @@ -230,6 +235,7 @@ python do_package_ipk () { raise KeyError(f) ctrlfile.write(c % tuple(pullData(fs, localdata))) except KeyError: + import sys (type, value, traceback) = sys.exc_info() ctrlfile.close() bb.utils.unlockfile(lf) @@ -260,10 +266,9 @@ python do_package_ipk () { ctrlfile.write("Replaces: %s\n" % ", ".join(rreplaces)) if rconflicts: ctrlfile.write("Conflicts: %s\n" % ", ".join(rconflicts)) - src_uri = bb.data.getVar("SRC_URI", localdata, 1) - if src_uri: - src_uri = re.sub("\s+", " ", src_uri) - ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) + src_uri = bb.data.getVar("SRC_URI", localdata, 1) or d.getVar("FILE", True) + src_uri = re.sub("\s+", " ", src_uri) + ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) ctrlfile.close() for script in ["preinst", "postinst", "prerm", "postrm"]: @@ -297,21 +302,11 @@ python do_package_ipk () { bb.utils.unlockfile(lf) raise bb.build.FuncFailed("ipkg-build execution failed") - for script in ["preinst", "postinst", "prerm", "postrm", "control" ]: - scriptfile = os.path.join(controldir, script) - try: - os.remove(scriptfile) - except OSError: - pass - try: - os.rmdir(controldir) - except OSError: - pass + bb.utils.prunedir(controldir) bb.utils.unlockfile(lf) } python () { - import bb if bb.data.getVar('PACKAGES', d, True) != '': deps = (bb.data.getVarFlag('do_package_write_ipk', 'depends', d) or "").split() deps.append('ipkg-utils-native:do_populate_staging') @@ -320,7 +315,6 @@ python () { } python do_package_write_ipk () { - import bb packages = bb.data.getVar('PACKAGES', d, True) if not packages: bb.debug(1, "No PACKAGES defined, nothing to package") @@ -331,3 +325,4 @@ python do_package_write_ipk () { } do_package_write_ipk[dirs] = "${D}" addtask package_write_ipk before do_package_write after do_package +addtask package_update_index_ipk before do_rootfs diff --git a/classes/package_rpm.bbclass b/classes/package_rpm.bbclass index f0055a1e63..ab09bb24d3 100644 --- a/classes/package_rpm.bbclass +++ b/classes/package_rpm.bbclass @@ -1,19 +1,28 @@ inherit package -inherit rpm_core RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}" IMAGE_PKGTYPE ?= "rpm" +RPMBUILDPATH="${WORKDIR}/rpm" + +RPMOPTS="--rcfile=${WORKDIR}/rpmrc" +RPMOPTS="--rcfile=${WORKDIR}/rpmrc --target ${TARGET_SYS}" +RPM="rpm ${RPMOPTS}" + python write_specfile() { - from bb import data, build - import sys + version = bb.data.getVar('PV', d, 1) + version = version.replace('-', '+') + bb.data.setVar('RPMPV', version, d) + out_vartranslate = { "PKG": "Name", - "PV": "Version", + "RPMPV": "Version", "DESCRIPTION": "%description", "ROOT": "BuildRoot", "LICENSE": "License", "SECTION": "Group", + "pkg_postinst": "%post", + "pkg_preinst": "%pre", } root = bb.data.getVar('ROOT', d) @@ -38,9 +47,9 @@ python write_specfile() { del files[files.index(r)] except ValueError: pass - if not files: - from bb import note - note("Not creating empty archive for %s" % (bb.data.expand('${PKG}-${PV}-${PR}${DISTRO_PR}', d, True)) + + if not files and bb.data.getVar('ALLOW_EMPTY', d) != "1": + bb.note("Not creating empty archive for %s" % (bb.data.expand('${PKG}-${PV}-${PR}${DISTRO_PR}', d, True))) return # output .spec using this metadata store @@ -56,18 +65,61 @@ python write_specfile() { for var in out_vartranslate.keys(): if out_vartranslate[var][0] == "%": continue - fd.write("%s\t: %s\n" % (out_vartranslate[var], bb.data.getVar(var, d))) - fd.write("Release\t: %s\n" % bb.data.expand('${PR}${DISTRO_PR}', d, True) + val = bb.data.getVar(var, d, 1) + if val: + fd.write("%s\t: %s\n" % (out_vartranslate[var], val)) + + fd.write("AutoReqProv: no\n") + + def fix_dep_versions(varname): + depends = bb.utils.explode_dep_versions(bb.data.getVar(varname, d, True) or "") + newdeps = [] + for dep in depends: + ver = depends[dep] + if dep and ver: + if '-' in ver: + subd = read_subpkgdata_dict(dep, d) + pv = subd['PV'] + reppv = pv.replace('-', '+') + ver = ver.replace(pv, reppv) + newdeps.append("%s (%s)" % (dep, ver)) + elif dep: + newdeps.append(dep) + bb.data.setVar(varname, " ".join(newdeps), d) + + fix_dep_versions('RDEPENDS') + fix_dep_versions('RRECOMMENDS') + + bb.build.exec_func("mapping_rename_hook", d) + + def write_dep_field(varname, outstring): + depends = bb.utils.explode_dep_versions(bb.data.getVar(varname, d, True) or "") + for dep in depends: + ver = depends[dep] + if dep and ver: + fd.write("%s: %s %s\n" % (outstring, dep, ver)) + elif dep: + fd.write("%s: %s\n" % (outstring, dep)) + + write_dep_field('RDEPENDS', 'Requires') + write_dep_field('RRECOMMENDS', 'Recommends') + write_dep_field('RPROVIDES', 'Provides') + + fd.write("Release\t: %s\n" % bb.data.expand('${PR}${DISTRO_PR}', d, True)) fd.write("Summary\t: .\n") for var in out_vartranslate.keys(): if out_vartranslate[var][0] != "%": continue - fd.write(out_vartranslate[var] + "\n") - fd.write(bb.data.getVar(var, d) + "\n\n") + val = bb.data.getVar(var, d) + if val: + fd.write(out_vartranslate[var] + "\n") + fd.write(val + "\n\n") fd.write("%files\n") for file in files: + if file[0] != '/': + fd.write('/') fd.write("%s\n" % file) fd.close() @@ -79,61 +131,83 @@ python write_specfile() { bb.build.exec_func('BUILDSPEC', d) # move the rpm into the pkgoutdir - rpm = bb.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${PV}-${PR}${DISTRO_PR}.${TARGET_ARCH}.rpm', d) - outrpm = bb.data.expand('${DEPLOY_DIR_RPM}/${PKG}-${PV}-${PR}${DISTRO_PR}.${TARGET_ARCH}.rpm', d) + rpm = bb.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${RPMPV}-${PR}${DISTRO_PR}.${TARGET_ARCH}.rpm', d) + outrpm = bb.data.expand('${DEPLOY_DIR_RPM}/${PACKAGE_ARCH}/${PKG}-${RPMPV}-${PR}.${TARGET_ARCH}.rpm', d) bb.movefile(rpm, outrpm) } +rpm_prep() { + if [ ! -e ${WORKDIR}/rpmrc ]; then + mkdir -p ${RPMBUILDPATH}/{SPECS,RPMS/{i386,i586,i686,noarch,ppc,mips,mipsel,arm},SRPMS,SOURCES,BUILD} + echo 'macrofiles:${STAGING_DIR_NATIVE}/usr/lib/rpm/macros:${WORKDIR}/macros' > ${WORKDIR}/rpmrc + echo '%_topdir ${RPMBUILDPATH}' > ${WORKDIR}/macros + echo '%_repackage_dir ${WORKDIR}' >> ${WORKDIR}/macros + fi +} + python do_package_rpm () { - workdir = bb.data.getVar('WORKDIR', d) + workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: - raise bb.build.FuncFailed("WORKDIR not defined") - workdir = bb.data.expand(workdir, d) + bb.error("WORKDIR not defined, unable to package") + return - import os # path manipulations - outdir = bb.data.getVar('DEPLOY_DIR_RPM', d) + outdir = bb.data.getVar('DEPLOY_DIR_RPM', d, 1) if not outdir: - raise bb.build.FuncFailed("DEPLOY_DIR_RPM not defined") - outdir = bb.data.expand(outdir, d) + bb.error("DEPLOY_DIR_RPM not defined, unable to package") + return bb.mkdirhier(outdir) - packages = bb.data.getVar('PACKAGES', d) + packages = bb.data.getVar('PACKAGES', d, 1) if not packages: - packages = "${PN}" - bb.data.setVar('FILES', '', d) - ddir = bb.data.expand(bb.data.getVar('D', d), d) - bb.mkdirhier(ddir) - bb.data.setVar(bb.data.expand('FILES_${PN}', d), ''.join([ "./%s" % x for x in os.listdir(ddir)]), d) - packages = bb.data.expand(packages, d) + bb.debug(1, "PACKAGES not defined, nothing to package") + return + + if packages == []: + bb.debug(1, "No packages; nothing to do") + return + + # If "rpm" comes into overrides the presence of this function causes problems. + # Since we don't need it, remove it for now - hacky. + bb.data.delVar("do_package_write_rpm", d) for pkg in packages.split(): localdata = bb.data.createCopy(d) - root = "%s/install/%s" % (workdir, pkg) + pkgdest = bb.data.getVar('PKGDEST', d, 1) + root = "%s/%s" % (pkgdest, pkg) + + lf = bb.utils.lockfile(root + ".lock") bb.data.setVar('ROOT', '', localdata) bb.data.setVar('ROOT_%s' % pkg, root, localdata) - bb.data.setVar('PKG', pkg, localdata) + pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) + if not pkgname: + pkgname = pkg + bb.data.setVar('PKG', pkgname, localdata) overrides = bb.data.getVar('OVERRIDES', localdata) if not overrides: raise bb.build.FuncFailed('OVERRIDES not defined') overrides = bb.data.expand(overrides, localdata) - bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata) + bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) bb.data.update_data(localdata) - root = bb.data.getVar('ROOT', localdata) - basedir = os.path.dirname(root) - pkgoutdir = outdir + basedir = os.path.join(os.path.dirname(root)) + pkgoutdir = os.path.join(outdir, bb.data.getVar('PACKAGE_ARCH', localdata, 1)) bb.mkdirhier(pkgoutdir) bb.data.setVar('OUTSPECFILE', os.path.join(workdir, "%s.spec" % pkg), localdata) + # Save the value of RPMBUILD expanded into the new dictonary so any + # changes in the compoents that make up workdir don't break packaging + bb.data.setVar('RPMBUILD', bb.data.getVar("RPMBUILD", d, True), localdata) + bb.data.setVar('RPMBUILDPATH', bb.data.getVar("RPMBUILDPATH", d, True), localdata) bb.build.exec_func('write_specfile', localdata) - del localdata + bb.utils.unlockfile(lf) } python () { - import bb - if bb.data.getVar('PACKAGES', d, True) != '': + if bb.data.getVar('PACKAGES', d, True) != '' and \ + not bb.data.inherits_class('native', d) and \ + not bb.data.inherits_class('cross', d): deps = (bb.data.getVarFlag('do_package_write_rpm', 'depends', d) or "").split() deps.append('rpm-native:do_populate_staging') deps.append('fakeroot-native:do_populate_staging') @@ -143,7 +217,10 @@ python () { python do_package_write_rpm () { bb.build.exec_func("read_subpackage_metadata", d) + bb.build.exec_func("rpm_prep", 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 +addtask package_write_rpm before do_package_write after do_package + diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass index 76f48ca429..b905e170f4 100644 --- a/classes/package_tar.bbclass +++ b/classes/package_tar.bbclass @@ -1,16 +1,11 @@ inherit package -IMAGE_PKGTYPE ?= "tar" - python package_tar_fn () { - import os - from bb import data fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d, True), bb.data.expand('${PKG}-${PV}-${PR}${DISTRO_PR}.tar.gz', d, True)) bb.data.setVar('PKGFN', fn, d) } python package_tar_install () { - import os, sys pkg = bb.data.getVar('PKG', d, 1) pkgfn = bb.data.getVar('PKGFN', d, 1) rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) @@ -22,6 +17,7 @@ python package_tar_install () { bb.mkdirhier(rootfs) os.chdir(rootfs) except OSError: + import sys (type, value, traceback) = sys.exc_info() print value raise bb.build.FuncFailed @@ -41,7 +37,6 @@ python do_package_tar () { bb.error("WORKDIR not defined, unable to package") return - import os # path manipulations outdir = bb.data.getVar('DEPLOY_DIR_TAR', d, 1) if not outdir: bb.error("DEPLOY_DIR_TAR not defined, unable to package") @@ -61,7 +56,8 @@ python do_package_tar () { for pkg in packages.split(): localdata = bb.data.createCopy(d) - root = "%s/install/%s" % (workdir, pkg) + pkgdest = bb.data.getVar('PKGDEST', d, 1) + root = "%s/%s" % (pkgdest, pkg) bb.data.setVar('ROOT', '', localdata) bb.data.setVar('ROOT_%s' % pkg, root, localdata) @@ -84,7 +80,7 @@ python do_package_tar () { tarfn = bb.data.getVar('PKGFN', localdata, 1) os.chdir(root) from glob import glob - if not glob('*'): + if not glob('*') + glob('.[!.]*'): bb.note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', d, True))) continue ret = os.system("tar -czf %s %s" % (tarfn, '.')) @@ -93,7 +89,6 @@ python do_package_tar () { } python () { - import bb if bb.data.getVar('PACKAGES', d, True) != '': deps = (bb.data.getVarFlag('do_package_write_tar', 'depends', d) or "").split() deps.append('tar-native:do_populate_staging') diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass index d6272b8145..1c5c4cd531 100644 --- a/classes/packaged-staging.bbclass +++ b/classes/packaged-staging.bbclass @@ -17,7 +17,7 @@ PSTAGE_EXTRAPATH ?= "/${OELAYOUT_ABI}/${DISTRO_PR}/" PSTAGE_PKGPATH = "${DISTRO}${PSTAGE_EXTRAPATH}" PSTAGE_PKGPN = "${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}', d).replace('_', '-')}" PSTAGE_PKGNAME = "${PSTAGE_PKGPN}_${PSTAGE_PKGVERSION}_${PSTAGE_PKGARCH}.ipk" -PSTAGE_PKG = "${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}" +PSTAGE_PKG ?= "${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}" PSTAGE_NATIVEDEPENDS = "\ shasum-native \ @@ -27,7 +27,6 @@ PSTAGE_NATIVEDEPENDS = "\ BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}" python () { - import bb pstage_allowed = True # These classes encode staging paths into the binary data so can only be @@ -49,6 +48,9 @@ python () { if bb.data.inherits_class('image', d): pstage_allowed = False + if bb.data.getVar('PSTAGING_DISABLED', d, True) == "1": + pstage_allowed = False + # Add task dependencies if we're active, otherwise mark packaged staging # as inactive. if pstage_allowed: @@ -81,8 +83,6 @@ PSTAGE_LIST_CMD = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -o ${TMP PSTAGE_TMPDIR_STAGE = "${WORKDIR}/staging-pkg" def pstage_manualclean(srcname, destvarname, d): - import os, bb - src = os.path.join(bb.data.getVar('PSTAGE_TMPDIR_STAGE', d, True), srcname) dest = bb.data.getVar(destvarname, d, True) @@ -93,7 +93,6 @@ def pstage_manualclean(srcname, destvarname, d): os.system("rm %s" % filepath) def pstage_set_pkgmanager(d): - import bb path = bb.data.getVar("PATH", d, 1) pkgmanager = bb.which(path, 'opkg-cl') if pkgmanager == "": @@ -103,23 +102,21 @@ def pstage_set_pkgmanager(d): def pstage_cleanpackage(pkgname, d): - import os, bb - path = bb.data.getVar("PATH", d, 1) pstage_set_pkgmanager(d) list_cmd = bb.data.getVar("PSTAGE_LIST_CMD", d, True) - bb.note("Checking if staging package installed") - lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) + bb.debug(2, "Checking if staging package installed") + lf = bb.utils.lockfile(bb.data.expand("${SYSROOT_LOCK}", d)) ret = os.system("PATH=\"%s\" %s | grep %s" % (path, list_cmd, pkgname)) if ret == 0: - bb.note("Yes. Uninstalling package from staging...") + bb.debug(1, "Uninstalling package from staging...") removecmd = bb.data.getVar("PSTAGE_REMOVE_CMD", d, 1) ret = os.system("PATH=\"%s\" %s %s" % (path, removecmd, pkgname)) if ret != 0: bb.note("Failure removing staging package") else: - bb.note("No. Manually removing any installed files") + bb.debug(1, "Manually removing any installed files from staging...") pstage_manualclean("staging", "STAGING_DIR", d) pstage_manualclean("cross", "CROSS_DIR", d) pstage_manualclean("deploy", "DEPLOY_DIR", d) @@ -135,7 +132,7 @@ do_clean_prepend() { pstage_cleanpackage(removepkg, d) stagepkg = bb.data.expand("${PSTAGE_PKG}", d) - bb.note("Removing staging package %s" % stagepkg) + bb.note("Removing staging package %s" % base_path_out(stagepkg, d)) os.system('rm -rf ' + stagepkg) } @@ -152,12 +149,11 @@ staging_helper () { done echo "dest root /" >> $conffile fi - if [ ! -e ${TMPDIR}${layout_libdir}/opkg/info/ ]; then - mkdir -p ${TMPDIR}${layout_libdir}/opkg/info/ + if [ ! -e ${TMPDIR}${libdir_native}/opkg/info/ ]; then + mkdir -p ${TMPDIR}${libdir_native}/opkg/info/ fi - if [ ! -e ${TMPDIR}${layout_libdir}/ipkg/ ]; then - cd ${TMPDIR}${layout_libdir}/ - ln -sf opkg/ ipkg + if [ ! -e ${TMPDIR}${libdir_native}/ipkg/ ]; then + ln -sf opkg/ ${TMPDIR}${libdir_native}/ipkg || true fi } @@ -166,14 +162,13 @@ PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_loca SCENEFUNCS += "packagestage_scenefunc" python packagestage_scenefunc () { - import os - if bb.data.getVar("PSTAGING_ACTIVE", d, 1) == "0": return bb.build.exec_func("staging_helper", d) removepkg = bb.data.expand("${PSTAGE_PKGPN}", d) + pstage_cleanpackage(removepkg, d) stagepkg = bb.data.expand("${PSTAGE_PKG}", d) @@ -187,7 +182,7 @@ python packagestage_scenefunc () { # # Install the staging package somewhere temporarily so we can extract the stamp files # - bb.mkdirhier(bb.data.expand("${WORKDIR}/tstage/${layout_libdir}/opkg/info/ ", d)) + bb.mkdirhier(bb.data.expand("${WORKDIR}/tstage/${libdir_native}/opkg/info/ ", d)) cmd = bb.data.expand("${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -force-depends -o ${WORKDIR}/tstage install", d) ret = os.system("PATH=\"%s\" %s %s" % (path, cmd, stagepkg)) if ret != 0: @@ -228,7 +223,7 @@ python packagestage_scenefunc () { if stageok: bb.note("Staging package found, using it for %s." % file) installcmd = bb.data.getVar("PSTAGE_INSTALL_CMD", d, 1) - lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) + lf = bb.utils.lockfile(bb.data.expand("${SYSROOT_LOCK}", d)) ret = os.system("PATH=\"%s\" %s %s" % (path, installcmd, stagepkg)) bb.utils.unlockfile(lf) if ret != 0: @@ -244,10 +239,7 @@ packagestage_scenefunc[dirs] = "${STAGING_DIR}" addhandler packagedstage_stampfixing_eventhandler python packagedstage_stampfixing_eventhandler() { - from bb.event import getName - import os - - if getName(e) == "StampUpdate": + if bb.event.getName(e) == "StampUpdate": taskscovered = bb.data.getVar("PSTAGE_TASKS_COVERED", e.data, 1).split() for (fn, task) in e.targets: # strip off 'do_' @@ -284,7 +276,7 @@ populate_staging_postamble () { if [ "$exitcode" != "5" -a "$exitcode" != "0" ]; then exit $exitcode fi - stage-manager -p ${CROSS_DIR} -c ${DEPLOY_DIR_PSTAGE}/stamp-cache-cross -u -d ${PSTAGE_TMPDIR_STAGE}/cross + stage-manager -p ${CROSS_DIR} -c ${DEPLOY_DIR_PSTAGE}/stamp-cache-cross -u -d ${PSTAGE_TMPDIR_STAGE}/cross/${BASE_PACKAGE_ARCH} if [ "$exitcode" != "5" -a "$exitcode" != "0" ]; then exit $exitcode fi @@ -292,13 +284,21 @@ populate_staging_postamble () { fi } -do_populate_staging[lockfiles] = "${STAGING_DIR}/staging.lock" +packagedstaging_fastpath () { + if [ "$PSTAGING_ACTIVE" = "1" ]; then + mkdir -p ${PSTAGE_TMPDIR_STAGE}/staging/ + mkdir -p ${PSTAGE_TMPDIR_STAGE}/cross/ + cp -fpPR ${SYSROOT_DESTDIR}/${STAGING_DIR}/* ${PSTAGE_TMPDIR_STAGE}/staging/ || /bin/true + cp -fpPR ${SYSROOT_DESTDIR}/${CROSS_DIR}/* ${PSTAGE_TMPDIR_STAGE}/cross/ || /bin/true + fi +} + do_populate_staging[dirs] =+ "${DEPLOY_DIR_PSTAGE}" -python do_populate_staging_prepend() { +python populate_staging_prehook() { bb.build.exec_func("populate_staging_preamble", d) } -python do_populate_staging_append() { +python populate_staging_posthook() { bb.build.exec_func("populate_staging_postamble", d) } @@ -329,20 +329,20 @@ staging_packager () { staging_package_installer () { #${PSTAGE_INSTALL_CMD} ${PSTAGE_PKG} - STATUSFILE=${TMPDIR}${layout_libdir}/opkg/status + STATUSFILE=${TMPDIR}${libdir_native}/opkg/status echo "Package: ${PSTAGE_PKGPN}" >> $STATUSFILE echo "Version: ${PSTAGE_PKGVERSION}" >> $STATUSFILE echo "Status: install user installed" >> $STATUSFILE echo "Architecture: ${PSTAGE_PKGARCH}" >> $STATUSFILE echo "" >> $STATUSFILE - CTRLFILE=${TMPDIR}${layout_libdir}/opkg/info/${PSTAGE_PKGPN}.control + CTRLFILE=${TMPDIR}${libdir_native}/opkg/info/${PSTAGE_PKGPN}.control echo "Package: ${PSTAGE_PKGPN}" > $CTRLFILE echo "Version: ${PSTAGE_PKGVERSION}" >> $CTRLFILE echo "Architecture: ${PSTAGE_PKGARCH}" >> $CTRLFILE cd ${PSTAGE_TMPDIR_STAGE} - find -type f | grep -v ./CONTROL | sed -e 's/^\.//' > ${TMPDIR}${layout_libdir}/opkg/info/${PSTAGE_PKGPN}.list + find -type f | grep -v ./CONTROL | sed -e 's/^\.//' > ${TMPDIR}${libdir_native}/opkg/info/${PSTAGE_PKGPN}.list } python do_package_stage () { @@ -361,6 +361,8 @@ python do_package_stage () { ipkpath = bb.data.getVar('DEPLOY_DIR_IPK', d, True).replace(tmpdir, stagepath) if bb.data.inherits_class('package_deb', d): debpath = bb.data.getVar('DEPLOY_DIR_DEB', d, True).replace(tmpdir, stagepath) + if bb.data.inherits_class('package_rpm', d): + rpmpath = bb.data.getVar('DEPLOY_DIR_RPM', d, True).replace(tmpdir, stagepath) for pkg in packages: pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) @@ -393,6 +395,18 @@ python do_package_stage () { bb.mkdirhier(destpath) bb.copyfile(srcfile, destpath + srcname) + if bb.data.inherits_class('package_rpm', d): + version = bb.data.getVar('PV', d, 1) + version = version.replace('-', '+') + bb.data.setVar('RPMPV', version, d) + srcname = bb.data.expand(pkgname + "-${RPMPV}-" + pr + ".${TARGET_ARCH}.rpm", d) + srcfile = bb.data.expand("${DEPLOY_DIR_RPM}/" + arch + "/" + srcname, d) + if os.path.exists(srcfile): + destpath = rpmpath + "/" + arch + "/" + bb.mkdirhier(destpath) + bb.copyfile(srcfile, destpath + srcname) + + # # Handle stamps/ files # @@ -406,7 +420,7 @@ python do_package_stage () { pstage_set_pkgmanager(d) bb.build.exec_func("staging_helper", d) bb.build.exec_func("staging_packager", d) - lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) + lf = bb.utils.lockfile(bb.data.expand("${SYSROOT_LOCK}", d)) bb.build.exec_func("staging_package_installer", d) bb.utils.unlockfile(lf) } diff --git a/classes/packagedata.bbclass b/classes/packagedata.bbclass new file mode 100644 index 0000000000..86f18a9e96 --- /dev/null +++ b/classes/packagedata.bbclass @@ -0,0 +1,73 @@ +def packaged(pkg, d): + return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK) + +def read_pkgdatafile(fn): + pkgdata = {} + + def decode(str): + import codecs + c = codecs.getdecoder("string_escape") + return c(str)[0] + + if os.access(fn, os.R_OK): + import re + f = file(fn, 'r') + lines = f.readlines() + f.close() + r = re.compile("([^:]+):\s*(.*)") + for l in lines: + m = r.match(l) + if m: + pkgdata[m.group(1)] = decode(m.group(2)) + + return pkgdata + +def get_subpkgedata_fn(pkg, d): + archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ") + archs.reverse() + pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d) + targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d) + for arch in archs: + fn = pkgdata + arch + targetdir + pkg + if os.path.exists(fn): + return fn + return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d) + +def has_subpkgdata(pkg, d): + return os.access(get_subpkgedata_fn(pkg, d), os.R_OK) + +def read_subpkgdata(pkg, d): + return read_pkgdatafile(get_subpkgedata_fn(pkg, d)) + +def has_pkgdata(pn, d): + fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) + return os.access(fn, os.R_OK) + +def read_pkgdata(pn, d): + fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d) + return read_pkgdatafile(fn) + +python read_subpackage_metadata () { + data = read_pkgdata(bb.data.getVar('PN', d, 1), d) + + for key in data.keys(): + bb.data.setVar(key, data[key], d) + + for pkg in bb.data.getVar('PACKAGES', d, 1).split(): + sdata = read_subpkgdata(pkg, d) + for key in sdata.keys(): + bb.data.setVar(key, sdata[key], d) +} + + +# +# Collapse FOO_pkg variables into FOO +# +def read_subpkgdata_dict(pkg, d): + ret = {} + subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d)) + for var in subd: + newvar = var.replace("_" + pkg, "") + ret[newvar] = subd[var] + return ret + diff --git a/classes/packagehistory.bbclass b/classes/packagehistory.bbclass new file mode 100644 index 0000000000..492bbac218 --- /dev/null +++ b/classes/packagehistory.bbclass @@ -0,0 +1,97 @@ +# Must inherit package first before changing PACKAGEFUNCS +inherit package +PACKAGEFUNCS += "emit_pkghistory" + +PKGHIST_DIR = "${TMPDIR}/pkghistory/${BASEPKG_TARGET_SYS}/" + + +# +# Called during do_package to write out metadata about this package +# for comparision when writing future packages +# +python emit_pkghistory() { + packages = bb.data.getVar('PACKAGES', d, True) + pkghistdir = bb.data.getVar('PKGHIST_DIR', d, True) + + + # Should check PACKAGES here to see if anything removed + + def getpkgvar(pkg, var): + val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) + if val: + return val + val = bb.data.getVar('%s' % (var), d, 1) + + return val + + def getlastversion(pkg): + try: + pe = os.path.basename(os.readlink(os.path.join(pkghistdir, pkg, "latest"))) + pv = os.path.basename(os.readlink(os.path.join(pkghistdir, pkg, pe, "latest"))) + pr = os.path.basename(os.readlink(os.path.join(pkghistdir, pkg, pe, pv, "latest"))) + return (pe, pv, pr) + except OSError: + return (None, None, None) + + for pkg in packages.split(): + pe = getpkgvar(pkg, 'PE') or "0" + pv = getpkgvar(pkg, 'PV') + pr = getpkgvar(pkg, 'PR') + destdir = os.path.join(pkghistdir, pkg, pe, pv, pr) + + # + # Find out what the last version was + # Make sure the version did not decrease + # + lastversion = getlastversion(pkg) + (last_pe, last_pv, last_pr) = lastversion + + if last_pe is not None: + r = bb.utils.vercmp((pe, pv, pr), lastversion) + if r < 0: + bb.fatal("Package version for package %s went backwards which would break package feeds from (%s:%s-%s to %s:%s-%s)" % (pkg, last_pe, last_pv, last_pr, pe, pv, pr)) + + write_pkghistory(pkg, pe, pv, pr, d) + + if last_pe is not None: + check_pkghistory(pkg, pe, pv, pr, lastversion) + + write_latestlink(pkg, pe, pv, pr, d) +} + + +def check_pkghistory(pkg, pe, pv, pr, lastversion): + (last_pe, last_pv, last_pr) = lastversion + + bb.debug(2, "Checking package history") + # RDEPENDS removed? + # PKG changed? + # Each file list of each package for file removals? + + +def write_pkghistory(pkg, pe, pv, pr, d): + bb.debug(2, "Writing package history") + + pkghistdir = bb.data.getVar('PKGHIST_DIR', d, True) + + verpath = os.path.join(pkghistdir, pkg, pe, pv, pr) + if not os.path.exists(verpath): + os.makedirs(verpath) + +def write_latestlink(pkg, pe, pv, pr, d): + pkghistdir = bb.data.getVar('PKGHIST_DIR', d, True) + + def rm_link(path): + try: + os.unlink(path) + except OSError: + return + + rm_link(os.path.join(pkghistdir, pkg, "latest")) + rm_link(os.path.join(pkghistdir, pkg, pe, "latest")) + rm_link(os.path.join(pkghistdir, pkg, pe, pv, "latest")) + + os.symlink(os.path.join(pkghistdir, pkg, pe), os.path.join(pkghistdir, pkg, "latest")) + os.symlink(os.path.join(pkghistdir, pkg, pe, pv), os.path.join(pkghistdir, pkg, pe, "latest")) + os.symlink(os.path.join(pkghistdir, pkg, pe, pv, pr), os.path.join(pkghistdir, pkg, pe, pv, "latest")) + diff --git a/classes/patch.bbclass b/classes/patch.bbclass index 075e826523..33184df0d0 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -4,8 +4,6 @@ QUILTRCFILE ?= "${STAGING_BINDIR_NATIVE}/quiltrc" def patch_init(d): - import os, sys - class NotFoundError(Exception): def __init__(self, path): self.path = path @@ -13,14 +11,20 @@ def patch_init(d): return "Error: %s not found." % self.path def md5sum(fname): - import md5, sys + # when we move to Python 2.5 as minimal supported + # we can kill that try/except as hashlib is 2.5+ + try: + import hashlib + m = hashlib.md5() + except ImportError: + import md5 + m = md5.new() try: f = file(fname, 'rb') except IOError: raise NotFoundError(fname) - m = md5.new() while True: d = f.read(8096) if not d: @@ -68,8 +72,6 @@ def patch_init(d): def __str__(self): return "Patch Error: %s" % self.msg - import bb, bb.data, bb.fetch - class PatchSet(object): defaults = { "strippath": 1 @@ -181,6 +183,24 @@ def patch_init(d): def Clean(self): """""" + class GitApplyTree(PatchTree): + def __init__(self, dir, d): + PatchTree.__init__(self, dir, d) + + def _applypatch(self, patch, force = False, reverse = False, run = True): + shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']] + + if reverse: + shellcmd.append('-R') + + shellcmd.append(patch['file']) + + if not run: + return "sh" + "-c" + " ".join(shellcmd) + + return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) + + class QuiltTree(PatchSet): def _runcmd(self, args, run = True): quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1) @@ -227,6 +247,7 @@ def patch_init(d): try: output = runcmd(["quilt", "applied"], self.dir) except CmdError: + import sys if sys.exc_value.output.strip() == "No patches applied": return else: @@ -340,6 +361,7 @@ def patch_init(d): try: self.patchset.Push() except Exception: + import sys os.chdir(olddir) raise sys.exc_value @@ -416,6 +438,7 @@ def patch_init(d): g["PatchSet"] = PatchSet g["PatchTree"] = PatchTree g["QuiltTree"] = QuiltTree + g["GitApplyTree"] = GitApplyTree g["Resolver"] = Resolver g["UserResolver"] = UserResolver g["NOOPResolver"] = NOOPResolver @@ -429,9 +452,6 @@ PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_staging" do_patch[depends] = "${PATCHDEPENDENCY}" python patch_do_patch() { - import re - import bb.fetch - patch_init(d) src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() @@ -441,6 +461,7 @@ python patch_do_patch() { patchsetmap = { "patch": PatchTree, "quilt": QuiltTree, + "git": GitApplyTree, } cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt'] @@ -519,7 +540,7 @@ python patch_do_patch() { bb.note("Patch '%s' applies to earlier revisions" % pname) continue - bb.note("Applying patch '%s' (%s)" % (pname, unpacked)) + bb.note("Applying patch '%s' (%s)" % (pname, base_path_out(unpacked, d))) try: patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True) except: diff --git a/classes/pkgconfig.bbclass b/classes/pkgconfig.bbclass index 2a8199d135..f3d93716d7 100644 --- a/classes/pkgconfig.bbclass +++ b/classes/pkgconfig.bbclass @@ -1,18 +1,18 @@ -inherit base - DEPENDS_prepend = "pkgconfig-native " do_install_prepend () { for i in `find ${S}/ -name "*.pc" -type f` ; do \ - sed -i -e 's:-L${STAGING_LIBDIR}::g' $i + sed -i -e 's:-L${STAGING_LIBDIR}::g' -e 's:-I${STAGING_INCDIR}::g' $i done } -do_stage_append () { - install -d ${PKG_CONFIG_DIR} +SYSROOT_PREPROCESS_FUNCS += "pkgconfig_sysroot_preprocess" + +pkgconfig_sysroot_preprocess () { + install -d ${SYSROOT_DESTDIR}${PKG_CONFIG_DIR} for pc in `find ${S} -name '*.pc' -type f | grep -v -- '-uninstalled.pc$'`; do pcname=`basename $pc` - cat $pc > ${PKG_CONFIG_DIR}/$pcname + cat $pc > ${SYSROOT_DESTDIR}${PKG_CONFIG_DIR}/$pcname done } diff --git a/classes/qemu.bbclass b/classes/qemu.bbclass new file mode 100644 index 0000000000..66dfb2b0d2 --- /dev/null +++ b/classes/qemu.bbclass @@ -0,0 +1,15 @@ +# +# This class contains functions for recipes that need QEMU or test for its +# existance. +# + +def qemu_target_binary(data): + import bb + + target_arch = bb.data.getVar("TARGET_ARCH", data, 1) + if target_arch in ("i486", "i586", "i686"): + target_arch = "i386" + elif target_arch == "powerpc": + target_arch = "ppc" + + return "qemu-" + target_arch diff --git a/classes/qmake2.bbclass b/classes/qmake2.bbclass index 8a443d062a..37721898d6 100644 --- a/classes/qmake2.bbclass +++ b/classes/qmake2.bbclass @@ -3,14 +3,15 @@ # inherit qmake_base -DEPENDS_prepend = "qmake2-native uicmoc4-native " +DEPENDS_prepend = "qt4-tools-native " -export QMAKESPEC = "${CROSS_DATADIR}/qt4/mkspecs/${TARGET_OS}-oe-g++" +export QMAKESPEC = "${STAGING_DATADIR}/qt4/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 QMAKE_RCC = "${STAGING_BINDIR_NATIVE}/rcc4" +export OE_QMAKE_QDBUSCPP2XML = "${STAGING_BINDIR_NATIVE}/qdbuscpp2xml4" +export OE_QMAKE_QDBUSXML2CPP = "${STAGING_BINDIR_NATIVE}/qdbusxml2cpp4" export OE_QMAKE_QMAKE = "${STAGING_BINDIR_NATIVE}/qmake2" export OE_QMAKE_LINK = "${CXX}" export OE_QMAKE_CXXFLAGS = "${CXXFLAGS}" @@ -18,3 +19,5 @@ export OE_QMAKE_INCDIR_QT = "${STAGING_INCDIR}/qt4" export OE_QMAKE_LIBDIR_QT = "${STAGING_LIBDIR}" export OE_QMAKE_LIBS_QT = "qt" export OE_QMAKE_LIBS_X11 = "-lXext -lX11 -lm" +export OE_QMAKE_LRELEASE = "${STAGING_BINDIR_NATIVE}/lrelease4" +export OE_QMAKE_LUPDATE = "${STAGING_BINDIR_NATIVE}/lupdate4" diff --git a/classes/qmake_base.bbclass b/classes/qmake_base.bbclass index 5eccfa47e4..4fbe21f2e1 100644 --- a/classes/qmake_base.bbclass +++ b/classes/qmake_base.bbclass @@ -13,6 +13,9 @@ export OE_QMAKE_AR="${AR}" export OE_QMAKE_STRIP="echo" export OE_QMAKE_RPATH="-Wl,-rpath-link," +# do not export STRIP to the environment +STRIP[unexport] = "1" + # default to qte2 via bb.conf, inherit qt3x11 to configure for qt3x11 oe_qmake_mkspecs () { @@ -33,7 +36,7 @@ oe_qmake_mkspecs () { qmake_base_do_configure() { case ${QMAKESPEC} in - *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++|*linux-uclibcgnueabi-oe-g++) + *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++|*linux-uclibceabi-oe-g++) ;; *-oe-g++) die Unsupported target ${TARGET_OS} for oe-g++ qmake spec diff --git a/classes/qt4e.bbclass b/classes/qt4e.bbclass new file mode 100644 index 0000000000..f72e06b6eb --- /dev/null +++ b/classes/qt4e.bbclass @@ -0,0 +1,17 @@ +DEPENDS_prepend = "${@["qt4-embedded ", ""][(bb.data.getVar('PN', d, 1) == 'qt4-embedded')]}" +inherit qmake2 + +QT_DIR_NAME = "qtopia" +QT_LIBINFIX = "E" +# override variables set by qmake-base to compile Qt/Embedded apps +# +export QMAKESPEC = "${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/${TARGET_OS}-oe-g++" +export OE_QMAKE_INCDIR_QT = "${STAGING_INCDIR}/${QT_DIR_NAME}" +export OE_QMAKE_LIBDIR_QT = "${STAGING_LIBDIR}" +export OE_QMAKE_LIBS_QT = "qt" +export OE_QMAKE_LIBS_X11 = "" +export OE_QMAKE_EXTRA_MODULES = "network" +EXTRA_QMAKEVARS_PRE += " QT_LIBINFIX=${QT_LIBINFIX} " + +# Qt4 uses atomic instructions not supported in thumb mode +ARM_INSTRUCTION_SET = "arm" diff --git a/classes/qt4x11.bbclass b/classes/qt4x11.bbclass index 76a45c33cb..2d56b7e95b 100644 --- a/classes/qt4x11.bbclass +++ b/classes/qt4x11.bbclass @@ -1,3 +1,6 @@ -DEPENDS_prepend = "${@["qt4x11 ", ""][(bb.data.getVar('PN', d, 1) == 'qt4-x11-free')]}" +DEPENDS_prepend = "${@["qt4-x11-free ", ""][(bb.data.getVar('PN', d, 1)[:12] == 'qt4-x11-free')]}" inherit qmake2 + +# Qt4 uses atomic instructions not supported in thumb mode +ARM_INSTRUCTION_SET = "arm" diff --git a/classes/qtopia4core.bbclass b/classes/qtopia4core.bbclass deleted file mode 100644 index b5f10fa486..0000000000 --- a/classes/qtopia4core.bbclass +++ /dev/null @@ -1,13 +0,0 @@ -DEPENDS_prepend = "${@["qtopia-core ", ""][(bb.data.getVar('PN', d, 1) == 'qtopia-core')]}" -inherit qmake2 - -QT_DIR_NAME = "qtopia" -# -# override variables set by qmake-base to compile QtopiaCore apps -# -export OE_QMAKE_INCDIR_QT = "${STAGING_INCDIR}/qtopia" -export OE_QMAKE_LIBDIR_QT = "${STAGING_LIBDIR}" -export OE_QMAKE_LIBS_QT = "qt" -export OE_QMAKE_LIBS_X11 = "" -export OE_QMAKE_EXTRA_MODULES = "network" -EXTRA_QMAKEVARS_PRE += " QT_LIBINFIX=E " diff --git a/classes/recipe_sanity.bbclass b/classes/recipe_sanity.bbclass new file mode 100644 index 0000000000..d929da6319 --- /dev/null +++ b/classes/recipe_sanity.bbclass @@ -0,0 +1,179 @@ +def __note(msg, d): + bb.note("%s: recipe_sanity: %s" % (d.getVar("P", 1), msg)) + +__recipe_sanity_badtargetvars = "RDEPENDS RPROVIDES" +def bad_target_vars(cfgdata, d): + if bb.data.inherits_class("native", d) or \ + bb.data.inherits_class("cross", d): + return + + for var in d.getVar("__recipe_sanity_badtargetvars", 1).split(): + val = d.getVar(var, 0) + if val and val != cfgdata.get(var): + __note("%s should not be set, but is set to '%s'" % (var, val), d) + +__recipe_sanity_reqvars = "DESCRIPTION" +__recipe_sanity_reqdiffvars = "LICENSE" +def req_vars(cfgdata, d): + for var in d.getVar("__recipe_sanity_reqvars", 1).split(): + if not d.getVar(var, 0): + __note("%s should be set" % var, d) + + for var in d.getVar("__recipe_sanity_reqdiffvars", 1).split(): + val = d.getVar(var, 0) + cfgval = cfgdata.get(var) + + # Hardcoding is bad, but I'm lazy. We don't care about license being + # unset if the recipe has no sources! + if var == "LICENSE" and d.getVar("SRC_URI", 1) == cfgdata.get("SRC_URI"): + continue + + if not val: + __note("%s should be set" % var, d) + elif val == cfgval: + __note("%s should be defined to something other than default (%s)" % (var, cfgval), d) + +def var_renames_overwrite(cfgdata, d): + renames = d.getVar("__recipe_sanity_renames", 0) + if renames: + for (key, newkey, oldvalue, newvalue) in renames: + if oldvalue != newvalue and oldvalue != cfgdata.get(newkey): + __note("rename of variable '%s' to '%s' overwrote existing value '%s' with '%s'." % (key, newkey, oldvalue, newvalue), d) + +def incorrect_nonempty_PACKAGES(cfgdata, d): + if bb.data.inherits_class("native", d) or \ + bb.data.inherits_class("cross", d): + if d.getVar("PACKAGES", 1): + return True + +def can_use_autotools_base(cfgdata, d): + cfg = d.getVar("do_configure", 1) + if not bb.data.inherits_class("autotools", d): + return False + + for i in ["autoreconf"] + ["%s_do_configure" % cls for cls in ["gnome", "e", "autotools", "autotools_stage", "efl", "gpephone", "openmoko", "openmoko2", "xfce", "xlibs"]]: + if cfg.find(i) != -1: + return False + + import os + for clsfile in d.getVar("__inherit_cache", 0): + (base, _) = os.path.splitext(os.path.basename(clsfile)) + if cfg.find("%s_do_configure" % base) != -1: + __note("autotools_base usage needs verification, spotted %s_do_configure" % base, d) + + return True + +def can_remove_FILESPATH(cfgdata, d): + expected = cfgdata.get("FILESPATH") + #expected = "${@':'.join([os.path.normpath(os.path.join(fp, p, o)) for fp in d.getVar('FILESPATHBASE', 1).split(':') for p in d.getVar('FILESPATHPKG', 1).split(':') for o in (d.getVar('OVERRIDES', 1) + ':').split(':') if os.path.exists(os.path.join(fp, p, o))])}:${FILESDIR}" + expectedpaths = bb.data.expand(expected, d) + unexpanded = d.getVar("FILESPATH", 0) + filespath = d.getVar("FILESPATH", 1).split(":") + filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)] + for fp in filespath: + if not fp in expectedpaths: + # __note("Path %s in FILESPATH not in the expected paths %s" % + # (fp, expectedpaths), d) + return False + return expected != unexpanded + +def can_remove_FILESDIR(cfgdata, d): + expected = cfgdata.get("FILESDIR") + #expected = "${@bb.which(d.getVar('FILESPATH', 1), '.')}" + unexpanded = d.getVar("FILESDIR", 0) + if unexpanded is None: + return False + + expanded = os.path.normpath(d.getVar("FILESDIR", 1)) + filespath = d.getVar("FILESPATH", 1).split(":") + filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)] + + return unexpanded != expected and \ + os.path.exists(expanded) and \ + (expanded in filespath or + expanded == bb.data.expand(expected, d)) + +def can_remove_others(p, cfgdata, d): + for k in ["S", "PV", "PN", "DESCRIPTION", "LICENSE", "DEPENDS", + "SECTION", "PACKAGES", "EXTRA_OECONF", "EXTRA_OEMAKE"]: + #for k in cfgdata: + unexpanded = d.getVar(k, 0) + cfgunexpanded = cfgdata.get(k) + if not cfgunexpanded: + continue + + try: + expanded = d.getVar(k, 1) + cfgexpanded = bb.data.expand(cfgunexpanded, d) + except bb.fetch.ParameterError: + continue + + if unexpanded != cfgunexpanded and \ + cfgexpanded == expanded: + __note("candidate for removal of %s" % k, d) + bb.debug(1, "%s: recipe_sanity: cfg's '%s' and d's '%s' both expand to %s" % + (p, cfgunexpanded, unexpanded, expanded)) + +python do_recipe_sanity () { + p = d.getVar("P", 1) + p = "%s %s %s" % (d.getVar("PN", 1), d.getVar("PV", 1), d.getVar("PR", 1)) + + sanitychecks = [ + (can_remove_FILESDIR, "candidate for removal of FILESDIR"), + (can_remove_FILESPATH, "candidate for removal of FILESPATH"), + #(can_use_autotools_base, "candidate for use of autotools_base"), + (incorrect_nonempty_PACKAGES, "native or cross recipe with non-empty PACKAGES"), + ] + cfgdata = d.getVar("__recipe_sanity_cfgdata", 0) + + for (func, msg) in sanitychecks: + if func(cfgdata, d): + __note(msg, d) + + can_remove_others(p, cfgdata, d) + var_renames_overwrite(cfgdata, d) + req_vars(cfgdata, d) + bad_target_vars(cfgdata, d) +} +do_recipe_sanity[nostamp] = "1" +#do_recipe_sanity[recrdeptask] = "do_recipe_sanity" +addtask recipe_sanity + +do_recipe_sanity_all[nostamp] = "1" +do_recipe_sanity_all[recrdeptask] = "do_recipe_sanity" +do_recipe_sanity_all () { + : +} +addtask recipe_sanity_all after do_recipe_sanity + +python recipe_sanity_eh () { + from bb.event import getName + + if getName(e) != "ConfigParsed": + return NotHandled + + d = e.data + + cfgdata = {} + for k in d.keys(): + #for k in ["S", "PR", "PV", "PN", "DESCRIPTION", "LICENSE", "DEPENDS", + # "SECTION"]: + cfgdata[k] = d.getVar(k, 0) + + d.setVar("__recipe_sanity_cfgdata", cfgdata) + #d.setVar("__recipe_sanity_cfgdata", d) + + # Sick, very sick.. + from bb.data_smart import DataSmart + old = DataSmart.renameVar + def myrename(self, key, newkey): + oldvalue = self.getVar(newkey, 0) + old(self, key, newkey) + newvalue = self.getVar(newkey, 0) + if oldvalue: + renames = self.getVar("__recipe_sanity_renames", 0) or set() + renames.add((key, newkey, oldvalue, newvalue)) + self.setVar("__recipe_sanity_renames", renames) + DataSmart.renameVar = myrename +} +addhandler recipe_sanity_eh diff --git a/classes/rm_work.bbclass b/classes/rm_work.bbclass index 094f9167bb..a53d12baf3 100644 --- a/classes/rm_work.bbclass +++ b/classes/rm_work.bbclass @@ -35,10 +35,7 @@ addtask rm_work_all after do_rm_work addhandler rmwork_stampfixing_eventhandler python rmwork_stampfixing_eventhandler() { - from bb.event import getName - import os - - if getName(e) == "StampUpdate": + if bb.event.getName(e) == "StampUpdate": for (fn, task) in e.targets: if task == 'rm_work_all': continue diff --git a/classes/rootfs_deb.bbclass b/classes/rootfs_deb.bbclass index 2768c2afb2..dc2b2cb02c 100644 --- a/classes/rootfs_deb.bbclass +++ b/classes/rootfs_deb.bbclass @@ -24,10 +24,12 @@ fakeroot rootfs_deb_do_rootfs () { continue; fi cd ${DEPLOY_DIR_DEB}/$arch - # if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then - rm -f Packages.gz Packages Packages.bz2 - # fi - dpkg-scanpackages . | bzip2 > Packages.bz2 + rm -f Packages.gz Packages Packages.bz2 + + # apt-native ignores Packages.bz2 unless /bin/bzip2 exists + # on the build host, so stick with gzip + dpkg-scanpackages . | gzip > Packages.gz + echo "Label: $arch" > Release echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev @@ -42,6 +44,8 @@ fakeroot rootfs_deb_do_rootfs () { cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \ | sed -e 's#Architecture ".*";#Architecture "${DPKG_ARCH}";#' \ + | sed -e 's#status ".*";#status "${IMAGE_ROOTFS}/var/dpkg/status";#' \ + | sed -e 's#DPkg::Options {".*"};#DPkg::Options {"--root=${IMAGE_ROOTFS}";"--admindir=${IMAGE_ROOTFS}/var/dpkg";"--force-all";"--no-debsig"};#' \ > "${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" diff --git a/classes/rootfs_ipk.bbclass b/classes/rootfs_ipk.bbclass index e752449305..16dd511fcb 100644 --- a/classes/rootfs_ipk.bbclass +++ b/classes/rootfs_ipk.bbclass @@ -5,8 +5,7 @@ # See image.bbclass for a usage of this. # -do_rootfs[depends] += "opkg-native:do_populate_staging ipkg-utils-native:do_populate_staging" -do_rootfs[recrdeptask] += "do_package_write_ipk" +do_rootfs[depends] += "opkg-native:do_populate_staging" IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS} ${@base_conditional("PACKAGE_INSTALL_NO_DEPS", "1", "-nodeps", "", d)}" @@ -21,12 +20,14 @@ ONLINE_PACKAGE_MANAGEMENT ?= "full" # Which packages to not install on the basis of a recommendation BAD_RECOMMENDATIONS ?= "" -DISTRO_EXTRA_RDEPENDS += "${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "opkg opkg-collateral", d)}" +IPKG_VARIANT ?= "opkg" + +RDEPENDS_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "${IPKG_VARIANT} opkg-collateral", d)}" +PACKAGE_INSTALL_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "${IPKG_VARIANT} opkg-collateral", d)}" fakeroot rootfs_ipk_do_rootfs () { set -x - package_update_index_ipk package_generate_ipkg_conf mkdir -p ${T} @@ -61,9 +62,8 @@ fakeroot rootfs_ipk_do_rootfs () { export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} export OPKG_OFFLINE_ROOT=${IPKG_OFFLINE_ROOT} - mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/opkg/ - if [ "${ONLINE_PACKAGE_MANAGEMENT}" != "none" ]; then + mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/opkg/ grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}${sysconfdir}/opkg/arch.conf fi @@ -94,6 +94,7 @@ fakeroot rootfs_ipk_do_rootfs () { ln -s opkg ${IMAGE_ROOTFS}${libdir}/ipkg else rm -rf ${IMAGE_ROOTFS}${libdir}/opkg + rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg fi ${ROOTFS_POSTPROCESS_COMMAND} @@ -106,7 +107,8 @@ rootfs_ipk_log_check() { lf_path="$2" lf_txt="`cat $lf_path`" - for keyword_die in "Cannot find package" "exit 1" ERR Fail + for keyword_die in "Cannot find package" "Cannot satisfy the following dependencies" \ + "exit 1" ERR Fail do if (echo "$lf_txt" | grep -v log_check | grep -w "$keyword_die") >/dev/null 2>&1 then diff --git a/classes/rootfs_rpm.bbclass b/classes/rootfs_rpm.bbclass new file mode 100644 index 0000000000..e3e306450e --- /dev/null +++ b/classes/rootfs_rpm.bbclass @@ -0,0 +1,210 @@ +# +# Creates a root filesystem out of rpm packages +# + +ROOTFS_PKGMANAGE = "rpm yum" + +ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts" + +do_rootfs[depends] += "rpm-native:do_populate_staging yum-native:do_populate_staging createrepo-native:do_populate_staging fakechroot-native:do_populate_staging" +do_rootfs[recrdeptask] += "do_package_write_rpm" + +YUMCONF = "${IMAGE_ROOTFS}/etc/yum.conf" +YUMARGS = "-c ${YUMCONF} --installroot ${IMAGE_ROOTFS}" +export YUM_ARCH_FORCE = "${TARGET_ARCH}" + +AWKPOSTINSTSCRIPT = "${STAGING_BINDIR_NATIVE}/extract-postinst.awk" + +RPM_PREPROCESS_COMMANDS = "" +RPM_POSTPROCESS_COMMANDS = "rpm_insert_feeds_uris" + +rpm_insert_feeds_uris () { + + echo "Building from feeds activated!" + + mkdir -p ${IMAGE_ROOTFS}/etc/yum/repos.d/ + for line in ${RPM_FEED_URIS} + do + # strip leading and trailing spaces/tabs, then split into name and uri + line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`" + feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`" + feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`" + + echo "Added $feed_name feed with URL $feed_uri" + + FEED_FILE=${IMAGE_ROOTFS}/etc/yum/repos.d/$feed_name + + echo "[${DISTRO}-feed-$feed_name]" >> $FEED_FILE + echo "name = $feed_name" >> $FEED_FILE + echo "baseurl = $feed_uri" >> $FEED_FILE + echo "gpgcheck = 0" >> $FEED_FILE + done +} + +fakeroot rootfs_rpm_do_rootfs () { + set -x + + ${RPM_PREPROCESS_COMMANDS} + + mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ + echo "${TARGET_ARCH}-linux" >${IMAGE_ROOTFS}/etc/rpm/platform + + # Generate an apprpriate yum.conf + rm -rf ${YUMCONF} + cat > ${YUMCONF} << EOF +[main] +cachedir=/var/cache2/yum +keepcache=1 +debuglevel=10 +logfile=/var/log2/yum.log +exactarch=0 +obsoletes=1 +tolerant=1 + +EOF + + #priority=1 + mkdir -p ${IMAGE_ROOTFS}${DEPLOY_DIR_RPM} + + for arch in ${PACKAGE_ARCHS}; do + if [ ! -d ${DEPLOY_DIR_RPM}/$arch ]; then + continue; + fi + createrepo ${DEPLOY_DIR_RPM}/$arch + + echo "[${DISTRO}-feed-$arch]" >> ${YUMCONF} + echo "name = ${DISTRO} RPM $arch Feed" >> ${YUMCONF} + echo "baseurl=file://${DEPLOY_DIR_RPM}/$arch" >> ${YUMCONF} + echo "gpgcheck=0" >> ${YUMCONF} + echo "" >> ${YUMCONF} + #priority=$(expr $priority + 5) + + # Copy the packages into the target image + # Ugly ugly ugly but rpm is braindead and can't see outside the chroot + # when installing :( + cp -r ${DEPLOY_DIR_RPM}/$arch ${IMAGE_ROOTFS}${DEPLOY_DIR_RPM}/ + done + + # Uclibc builds don't provide this stuff... + if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then + if [ ! -z "${LINGUAS_INSTALL}" ]; then + for i in ${LINGUAS_INSTALL}; do + fakechroot yum ${YUMARGS} -y install $i + done + fi + fi + if [ ! -z "${PACKAGE_INSTALL}" ]; then + fakechroot yum ${YUMARGS} -y install ${PACKAGE_INSTALL} + fi + + # Add any recommended packages to the image + # (added as an extra script since yum itself doesn't support this) + yum-install-recommends.py ${IMAGE_ROOTFS} "fakechroot yum ${YUMARGS} -y install" + + # Symlinks created under fakeroot are wrong, now we have to fix them... + cd ${IMAGE_ROOTFS} + for f in `find . -type l -print` + do + link=`readlink $f | sed -e 's#${IMAGE_ROOTFS}##'` + rm $f + ln -s $link $f + done + + export D=${IMAGE_ROOTFS} + export OFFLINE_ROOT=${IMAGE_ROOTFS} + export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} + export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} + + ${ROOTFS_POSTINSTALL_COMMAND} + + mkdir -p ${IMAGE_ROOTFS}/etc/rpm-postinsts/ + rpm --root ${IMAGE_ROOTFS} -aq --queryformat 'Name: %{NAME}\n' --scripts > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined + awk -f ${AWKPOSTINSTSCRIPT} < ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined + rm ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined + + for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*.sh; do + if [ -f $i ] && sh $i; then + # rm $i + mv $i $i.done + fi + done + + install -d ${IMAGE_ROOTFS}/${sysconfdir}/rcS.d + # Stop $i getting expanded below... + i=\$i + cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S98configure << EOF +#!/bin/sh +for i in /etc/rpm-postinsts/*.sh; do + echo "Running postinst $i..." + if [ -f $i ] && sh $i; then + # rm $i + mv $i $i.done + else + echo "ERROR: postinst $i failed." + fi +done +rm -f ${sysconfdir}/rcS.d/S98configure +EOF + chmod 0755 ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S98configure + + install -d ${IMAGE_ROOTFS}/${sysconfdir} + echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version + + ${RPM_POSTPROCESS_COMMANDS} + ${ROOTFS_POSTPROCESS_COMMAND} + + rm -rf ${IMAGE_ROOTFS}/var/cache2/ + rm -rf ${IMAGE_ROOTFS}/var/run2/ + rm -rf ${IMAGE_ROOTFS}/var/log2/ + rm -rf ${IMAGE_ROOTFS}${DEPLOY_DIR_RPM}/ + + # remove lock files + rm -f ${IMAGE_ROOTFS}/var/lib/rpm/__db.* + + # remove no longer used yum.conf + rm -f ${IMAGE_ROOTFS}/etc/yum.conf + + log_check rootfs +} + +rootfs_rpm_log_check() { + target="$1" + lf_path="$2" + + lf_txt="`cat $lf_path`" + for keyword_die in "Cannot find package" "exit 1" ERR Fail + do + if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1 + then + echo "log_check: There were error messages in the logfile" + 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 + fi + done + test "$do_exit" = 1 && exit + true +} + +remove_packaging_data_files() { +# empty for now + : +} + +install_all_locales() { +# empty for now + : +} + +python () { + import bb + if bb.data.getVar('BUILD_IMAGES_FROM_FEEDS', d, True): + flags = bb.data.getVarFlag('do_rootfs', 'recrdeptask', d) + flags = flags.replace("do_package_write_rpm", "") + flags = flags.replace("do_deploy", "") + flags = flags.replace("do_populate_staging", "") + bb.data.setVarFlag('do_rootfs', 'recrdeptask', flags, d) + bb.data.setVar('RPM_PREPROCESS_COMMANDS', "rpm_insert_feed_uris", d) + bb.data.setVar('RPM_POSTPROCESS_COMMANDS', '', d) +} diff --git a/classes/rpm_core.bbclass b/classes/rpm_core.bbclass deleted file mode 100644 index f28abbb1c3..0000000000 --- a/classes/rpm_core.bbclass +++ /dev/null @@ -1,16 +0,0 @@ -RPMBUILDPATH="${WORKDIR}/rpm" - -RPMOPTS="--rcfile=${WORKDIR}/rpmrc" -RPMOPTS="--rcfile=${WORKDIR}/rpmrc --target ${TARGET_SYS}" -RPM="rpm ${RPMOPTS}" -RPMBUILD="rpmbuild --buildroot ${D} --short-circuit ${RPMOPTS}" - -rpm_core_do_preprpm() { - mkdir -p ${RPMBUILDPATH}/{SPECS,RPMS/{i386,i586,i686,noarch,ppc,mips,mipsel,arm},SRPMS,SOURCES,BUILD} - echo 'macrofiles:/usr/lib/rpm/macros:${WORKDIR}/macros' > ${WORKDIR}/rpmrc - echo '%_topdir ${RPMBUILDPATH}' > ${WORKDIR}/macros - echo '%_repackage_dir ${WORKDIR}' >> ${WORKDIR}/macros -} - -EXPORT_FUNCTIONS do_preprpm -addtask preprpm before do_fetch diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index 29624c3f78..b6c6ed939a 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -2,6 +2,8 @@ # Sanity check the users setup for common misconfigurations # +inherit qemu + def raise_sanity_error(msg): import bb bb.fatal(""" Openembedded's config sanity checker detected a potential misconfiguration. @@ -11,8 +13,6 @@ def raise_sanity_error(msg): %s""" % msg) def check_conf_exists(fn, data): - import bb, os - bbpath = [] fn = bb.data.expand(fn, data) vbbpath = bb.data.getVar("BBPATH", data) @@ -26,12 +26,12 @@ def check_conf_exists(fn, data): def check_sanity(e): from bb import note, error, data, __version__ - from bb.event import Handled, NotHandled, 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 - import os, commands + import commands # Check the bitbake version meets minimum requirements minversion = data.getVar('BB_MIN_VERSION', e.data , True) @@ -85,24 +85,10 @@ def check_sanity(e): required_utilities = "patch help2man diffstat texi2html makeinfo cvs svn bzip2 tar gzip gawk md5sum" - if data.getVar('TARGET_ARCH', e.data, True) == "arm": - # qemu-native needs gcc 3.x - if "qemu-native" not in assume_provided and "gcc3-native" in assume_provided: - gcc_version = commands.getoutput("${BUILD_PREFIX}gcc --version | head -n 1 | cut -f 3 -d ' '") - - if not check_gcc3(e.data) and gcc_version[0] != '3': - messages = messages + "gcc3-native was in ASSUME_PROVIDED but the gcc-3.x binary can't be found in PATH" - missing = missing + "gcc-3.x (needed for qemu-native)," - + # If we'll be running qemu, perform some sanity checks + if data.getVar('ENABLE_BINARY_LOCALE_GENERATION', e.data, True): if "qemu-native" in assume_provided: - if not check_app_exists("qemu-arm", e.data): - messages = messages + "qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH" - - if os.path.exists("/proc/sys/vm/mmap_min_addr"): - f = file("/proc/sys/vm/mmap_min_addr", "r") - if (f.read().strip() != "0"): - messages = messages + "/proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).\n\nTo fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.\n" - f.close() + required_utilities += " %s" % (qemu_target_binary(e.data)) for util in required_utilities.split(): if not check_app_exists( util, e.data ): @@ -185,7 +171,7 @@ def check_sanity(e): archs = data.getVar('PACKAGE_ARCHS', e.data, True).split() for arch in archs: if archs.count(arch) != 1: - messages = messages + "Error, Your PACKAGE_ARCHS field contains duplicates. Perhaps you set EXTRA_PACKAGE_ARCHS twice accidently through some tune file?\n" + messages = messages + "Error, Your PACKAGE_ARCHS field contains duplicates. Perhaps you set PACKAGE_EXTRA_ARCHS twice accidently through some tune file?\n" break if messages != "": @@ -193,10 +179,8 @@ def check_sanity(e): addhandler check_sanity_eventhandler python check_sanity_eventhandler() { - from bb import note, error, data, __version__ - from bb.event import getName - - if getName(e) == "ConfigParsed": + from bb.event import Handled, NotHandled + if bb.event.getName(e) == "ConfigParsed": check_sanity(e) return NotHandled diff --git a/classes/scons.bbclass b/classes/scons.bbclass index 6d0a783dc2..b139411c19 100644 --- a/classes/scons.bbclass +++ b/classes/scons.bbclass @@ -1,7 +1,7 @@ DEPENDS += "python-scons-native" scons_do_compile() { - ${STAGING_BINDIR_NATIVE}/scons PREFIX=${prefix} prefix=${prefix} || \ + ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} || \ oefatal "scons build execution failed." } @@ -11,4 +11,10 @@ scons_do_install() { oefatal "scons install execution failed." } -EXPORT_FUNCTIONS do_compile do_install +scons_do_stage() { + install -d ${D}${prefix} + ${STAGING_BINDIR_NATIVE}/scons PREFIX=${STAGING_DIR_HOST}/${prefix} prefix=${STAGING_DIR_HOST}/${prefix} install || \ + oefatal "scons stage execution failed." +} + +EXPORT_FUNCTIONS do_compile do_install do_stage diff --git a/classes/sdk.bbclass b/classes/sdk.bbclass index eb34bd04b5..198d147cb3 100644 --- a/classes/sdk.bbclass +++ b/classes/sdk.bbclass @@ -1,3 +1,8 @@ +# +# Note this class is deprecated and replaced by nativesdk.bbclass +# + + # SDK packages are built either explicitly by the user, # or indirectly via dependency. No need to be in 'world'. EXCLUDE_FROM_WORLD = "1" diff --git a/classes/seppuku.bbclass b/classes/seppuku.bbclass index ab8096eb45..546738dde8 100644 --- a/classes/seppuku.bbclass +++ b/classes/seppuku.bbclass @@ -319,6 +319,12 @@ python seppuku_eventhandler() { passw = bb.data.getVar("SEPPUKU_PASS", data, True) product = bb.data.getVar("SEPPUKU_PRODUCT", data, True) component = bb.data.getVar("SEPPUKU_COMPONENT", data, True) + proxy = bb.data.getVar('HTTP_PROXY', data, True ) + if (proxy): + phl = urllib2.ProxyHandler({'http' : proxy}) + poster.add_handler(phl) + opener.add_handler(phl) + # evil hack to figure out what is going on debug_file = open(os.path.join(bb.data.getVar("TMPDIR", data, True),"..","seppuku-log"),"a") diff --git a/classes/siteinfo.bbclass b/classes/siteinfo.bbclass index 55ab371af3..93cee4f890 100644 --- a/classes/siteinfo.bbclass +++ b/classes/siteinfo.bbclass @@ -16,26 +16,25 @@ # If 'what' doesn't exist then an empty value is returned # def get_siteinfo_list(d): - import bb - target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + bb.data.getVar('HOST_OS', d, 1) targetinfo = {\ "armeb-linux": "endian-big bit-32 common-linux common-glibc arm-common",\ "armeb-linux-gnueabi": "endian-big bit-32 common-linux common-glibc arm-common armeb-linux",\ "armeb-linux-uclibc": "endian-big bit-32 common-linux common-uclibc arm-common",\ - "armeb-linux-uclibcgnueabi": "endian-big bit-32 common-linux common-uclibc arm-common armeb-linux-uclibc",\ + "armeb-linux-uclibceabi": "endian-big bit-32 common-linux common-uclibc arm-common armeb-linux-uclibc",\ "arm-darwin": "endian-little bit-32 common-darwin",\ + "arm-darwin9": "endian-little bit-32 common-darwin",\ "arm-linux": "endian-little bit-32 common-linux common-glibc arm-common",\ "arm-linux-gnueabi": "endian-little bit-32 common-linux common-glibc arm-common arm-linux",\ "arm-linux-uclibc": "endian-little bit-32 common-linux common-uclibc arm-common",\ - "arm-linux-uclibcgnueabi": "endian-little bit-32 common-linux common-uclibc arm-common arm-linux-uclibc",\ + "arm-linux-uclibceabi": "endian-little bit-32 common-linux common-uclibc arm-common arm-linux-uclibc",\ "avr32-linux-uclibc": "endian-big bit-32 common-linux common-uclibc avr32-common",\ - "bfin-uclinux-uclibc": "endian-little bit-32 common-uclibc bfin-common",\ - "i386-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ - "i486-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ - "i586-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ - "i686-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "bfin-uclinux-uclibc": "endian-little bit-32 common-uclibc bfin-common",\ + "i386-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "i486-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "i586-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ + "i686-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ "i386-linux-uclibc": "endian-little bit-32 common-linux common-uclibc ix86-common",\ "i486-linux-uclibc": "endian-little bit-32 common-linux common-uclibc ix86-common",\ "i586-linux-uclibc": "endian-little bit-32 common-linux common-uclibc ix86-common",\ @@ -48,20 +47,23 @@ def get_siteinfo_list(d): "i486-mingw32": "endian-little bit-32 common-mingw ix86-common",\ "i586-mingw32": "endian-little bit-32 common-mingw ix86-common",\ "i686-mingw32": "endian-little bit-32 common-mingw ix86-common",\ - "mipsel-linux": "endian-little bit-32 common-linux common-glibc",\ - "mipsel-linux-uclibc": "endian-little bit-32 common-linux common-uclibc",\ - "mips-linux": "endian-big bit-32 common-linux common-glibc",\ - "mips-linux-uclibc": "endian-big bit-32 common-linux common-uclibc",\ + "ia64-linux": "endian-little bit-64 common-linux common-glibc",\ + "mipsel-linux": "endian-little bit-32 common-linux common-glibc mips-common",\ + "mipsel-linux-uclibc": "endian-little bit-32 common-linux common-uclibc mips-common",\ + "mips-linux": "endian-big bit-32 common-linux common-glibc mips-common",\ + "mips-linux-uclibc": "endian-big bit-32 common-linux common-uclibc mips-common",\ "powerpc-darwin": "endian-big bit-32 common-darwin",\ - "ppc-linux": "endian-big bit-32 common-linux common-glibc powerpc-common",\ - "ppc64-linux": "endian-big bit-64 common-linux common-glibc powerpc-common",\ + "ppc-linux": "endian-big bit-32 common-linux common-glibc powerpc-common powerpc-linux",\ + "ppc64-linux": "endian-big bit-64 common-linux common-glibc powerpc-common powerpc64-linux",\ "powerpc-linux": "endian-big bit-32 common-linux common-glibc powerpc-common",\ - "powerpc-linux-gnuspe": "endian-big bit-32 common-linux common-glibc powerpc-common",\ + "powerpc-linux-gnuspe": "endian-big bit-32 common-linux common-glibc powerpc-common powerpc-linux",\ "powerpc-linux-uclibc": "endian-big bit-32 common-linux common-uclibc powerpc-common",\ + "powerpc-linux-uclibcspe": "endian-big bit-32 common-linux common-uclibc powerpc-common powerpc-linux-uclibc",\ "sh3-linux": "endian-little bit-32 common-linux common-glibc sh-common",\ "sh4-linux": "endian-little bit-32 common-linux common-glibc sh-common",\ "sh4-linux-uclibc": "endian-little bit-32 common-linux common-uclibc sh-common",\ - "sparc-linux": "endian-big bit-32 common-linux common-glibc",\ + "sparc-linux": "endian-big bit-32 common-linux common-glibc",\ + "viac3-linux": "endian-little bit-32 common-linux common-glibc ix86-common",\ "x86_64-linux": "endian-little bit-64 common-linux common-glibc",\ "x86_64-linux-uclibc": "endian-little bit-64 common-linux common-uclibc"} if target in targetinfo: @@ -82,8 +84,6 @@ def get_siteinfo_list(d): # 2) ${FILE_DIRNAME}/site-${PV} - app version specific # def siteinfo_get_files(d): - import bb, os - sitefiles = "" # Determine which site files to look for diff --git a/classes/sourcepkg.bbclass b/classes/sourcepkg.bbclass index 200ff8c228..5aacf92d10 100644 --- a/classes/sourcepkg.bbclass +++ b/classes/sourcepkg.bbclass @@ -5,8 +5,6 @@ EXCLUDE_FROM ?= ".pc autom4te.cache" DISTRO ?= "openembedded" def get_src_tree(d): - import bb - import os, os.path workdir = bb.data.getVar('WORKDIR', d, 1) if not workdir: @@ -56,8 +54,6 @@ sourcepkg_do_archive_bb() { } python sourcepkg_do_dumpdata() { - import os - import os.path workdir = bb.data.getVar('WORKDIR', d, 1) distro = bb.data.getVar('DISTRO', d, 1) diff --git a/classes/src_distribute.bbclass b/classes/src_distribute.bbclass index 30b2670011..22044752ef 100644 --- a/classes/src_distribute.bbclass +++ b/classes/src_distribute.bbclass @@ -1,29 +1,46 @@ +SRC_DISTRIBUTE_DLONLY ?= "0" SRC_DISTRIBUTECOMMAND[func] = "1" + +addtask distribute_sources before do_build after do_fetch python do_distribute_sources () { + import re + + bb.build.exec_func("do_fetch", d) + l = bb.data.createCopy(d) bb.data.update_data(l) - licenses = (bb.data.getVar('LICENSE', d, 1) or "unknown").split() - sources_dir = bb.data.getVar('SRC_DISTRIBUTEDIR', d, 1) - import re + licenses = (bb.data.getVar('LICENSE', d, 1) or "unknown").split() for license in licenses: for entry in license.split("|"): for url in ((bb.data.getVar('SRC_URI', d, 1) or '').split()): bb.fetch.init([url], d) s = bb.fetch.localpath(url, d) s = re.sub(';.*$', '', s) + + try: + dlonly = int(d.getVar("SRC_DISTRIBUTE_DLONLY", 1)) + except ValueError: + raise bb.build.FuncFailed("Invalid value for SRC_DISTRIBUTE_DLONLY: expected integer.") + if dlonly: + dldir = os.path.realpath(d.getVar("DL_DIR", 1) or "") + if dldir and not \ + os.path.realpath(s).startswith(dldir + os.path.sep): + continue + cmd = bb.data.getVar('SRC_DISTRIBUTECOMMAND', d, 1) if not cmd: - raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not defined") - bb.data.setVar('SRC', s, d) - bb.data.setVar('SRC_DISTRIBUTEDIR', "%s/%s" % (sources_dir, entry), d) - bb.build.exec_func('SRC_DISTRIBUTECOMMAND', d) + raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not set") + bb.debug(2, "srcdist: running %s" % cmd) + bb.data.setVar('SRC', os.path.normpath(s), l) + bb.data.setVar('LIC', entry, l) + bb.build.exec_func('SRC_DISTRIBUTECOMMAND', l) } -addtask distribute_sources before do_build after do_fetch +addtask distribute_sources_all after do_distribute_sources +do_distribute_sources_all[recrdeptask] = "do_distribute_sources" +do_distribute_sources_all[nostamp] = "1" -addtask distsrcall after do_distribute_sources -do_distsrcall[recrdeptask] = "do_distribute_sources" -base_do_distsrcall() { - : -} +# compatability wrapper +addtask distsrcall after do_distribute_sources_all +do_distsrcall[nostamp] = "1" diff --git a/classes/src_distribute_local.bbclass b/classes/src_distribute_local.bbclass index 5f0cef5bec..5cec2880aa 100644 --- a/classes/src_distribute_local.bbclass +++ b/classes/src_distribute_local.bbclass @@ -1,31 +1,37 @@ inherit src_distribute -# SRC_DIST_LOCAL possible values: -# copy copies the files from ${A} to the distributedir -# symlink symlinks the files from ${A} to the distributedir -# move+symlink moves the files into distributedir, and symlinks them back SRC_DIST_LOCAL ?= "move+symlink" SRC_DISTRIBUTEDIR ?= "${DEPLOY_DIR}/sources" -SRC_DISTRIBUTECOMMAND () { - s="${SRC}" - if [ ! -L "$s" ] && (echo "$s"|grep "^${DL_DIR}"); then - : - else - exit 0; - fi - mkdir -p ${SRC_DISTRIBUTEDIR} - case "${SRC_DIST_LOCAL}" in - copy) - test -e $s.md5 && cp -f $s.md5 ${SRC_DISTRIBUTEDIR}/ - cp -f $s ${SRC_DISTRIBUTEDIR}/ - ;; - symlink) - test -e $s.md5 && ln -sf $s.md5 ${SRC_DISTRIBUTEDIR}/ - ln -sf $s ${SRC_DISTRIBUTEDIR}/ - ;; - move+symlink) - mv $s ${SRC_DISTRIBUTEDIR}/ - ln -sf ${SRC_DISTRIBUTEDIR}/`basename $s` $s - ;; - esac +SRC_DISTRIBUTECOMMAND[dirs] = "${SRC_DISTRIBUTEDIR}/${LIC}/${PN}" + +# symlinks the files to the SRC_DISTRIBUTEDIR +SRC_DISTRIBUTECOMMAND-symlink () { + test -e ${SRC}.md5 && ln -sf ${SRC}.md5 . + ln -sf ${SRC} . +} + +# copies the files to the SRC_DISTRIBUTEDIR +SRC_DISTRIBUTECOMMAND-copy () { + test -e ${SRC}.md5 && cp -f ${SRC}.md5 . + cp -fr ${SRC} . +} + +# moves the files to the SRC_DISTRIBUTEDIR and symlinks them back +SRC_DISTRIBUTECOMMAND-move+symlink () { + if ! [ -L ${SRC} ]; then + mv ${SRC} . + ln -sf $PWD/`basename ${SRC}` ${SRC} + if [ -e ${SRC}.md5 ]; then + mv ${SRC}.md5 . + ln -sf $PWD/`basename ${SRC}.md5` ${SRC}.md5 + fi + fi +} + +#SRC_DISTRIBUTECOMMAND = "${@str(d.getVar('SRC_DISTRIBUTECOMMAND-%s' % d.getVar('SRC_DIST_LOCAL', 1), 1))}" +python () { + if d.getVar("SRC_DISTRIBUTECOMMAND", 1) is None: + cmd = d.getVar("SRC_DISTRIBUTECOMMAND-%s" % d.getVar("SRC_DIST_LOCAL", 1), 0) + if cmd: + d.setVar("SRC_DISTRIBUTECOMMAND", cmd) } diff --git a/classes/srctree.bbclass b/classes/srctree.bbclass new file mode 100644 index 0000000000..dbf8ad2c3f --- /dev/null +++ b/classes/srctree.bbclass @@ -0,0 +1,115 @@ +# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> +# Released under the MIT license (see COPYING.MIT for the terms) +# +# srctree.bbclass enables operation inside of an existing source tree for a +# project, rather than using the fetch/unpack/patch idiom. +# +# By default, it expects that you're keeping the recipe(s) inside the +# aforementioned source tree, but you could override S to point at an external +# directory and place the recipes in a normal collection/overlay, if you so +# chose. +# +# It also provides some convenience python functions for assembling your +# do_clean, if you want to leverage things like 'git clean' to simplify the +# operation. + + +# Grab convenience methods & sane default for do_clean +inherit clean + +# Build here +S = "${FILE_DIRNAME}" +SRC_URI = "" + + +def merge_tasks(d): + """ + merge_tasks performs two operations: + 1) removes do_patch and its deps from the build entirely. + 2) merges all of the operations that occur prior to do_populate_staging + into do_populate_staging. + + This is necessary, because of recipe variants (normal, native, cross, + sdk). If a bitbake run happens to want to build more than one of + these variants in a single run, it's possible for them to step on one + another's toes, due to the shared ${S}. Interleaved + configure/compile/install amongst variants will break things badly. + """ + from itertools import chain + from bb import note + + def __gather_taskdeps(task, seen): + for dep in d.getVarFlag(task, "deps"): + if not dep in seen: + __gather_taskdeps(dep, seen) + if not task in seen: + seen.append(task) + + def gather_taskdeps(task): + items = [] + __gather_taskdeps(task, items) + return items + + newtask = "do_populate_staging" + mergedtasks = gather_taskdeps(newtask) + mergedtasks.pop() + deltasks = gather_taskdeps("do_patch") + + for task in (key for key in d.keys() + if d.getVarFlag(key, "task") and + not key in mergedtasks): + deps = d.getVarFlag(task, "deps") + for mergetask in mergedtasks: + if mergetask in (d.getVarFlag(task, "recrdeptask"), + d.getVarFlag(task, "recdeptask"), + d.getVarFlag(task, "deptask")): + continue + + if mergetask in deps: + deps.remove(mergetask) + #note("removing dep on %s from %s" % (mergetask, task)) + + if not mergetask in deltasks and \ + not newtask in deps: + #note("adding dep on %s to %s" % (newtask, task)) + deps.append(newtask) + d.setVarFlag(task, "deps", deps) + + for task in mergedtasks[:-1]: + deps = d.getVarFlag(task, "deps") + for deltask in deltasks: + if deltask in deps: + deps.remove(deltask) + d.setVarFlag(task, "deps", deps) + + # Pull cross recipe task deps over + depends = (d.getVarFlag(task, "depends") or "" + for task in mergedtasks[:-1] + if not task in deltasks) + d.setVarFlag("do_populate_staging", "depends", " ".join(depends)) + +python () { + merge_tasks(d) +} + +# Manually run do_install & all of its deps, then do_stage +python do_populate_staging () { + from os.path import exists + from bb.build import exec_task, exec_func + from bb import note + + stamp = d.getVar("STAMP", True) + + def rec_exec_task(task, seen): + for dep in d.getVarFlag(task, "deps"): + if not dep in seen: + rec_exec_task(dep, seen) + seen.add(task) + #if not exists("%s.%s" % (stamp, task)): + note("%s: executing task %s" % (d.getVar("PF", True), task)) + exec_task(task, d) + + rec_exec_task("do_install", set()) + exec_func("do_stage", d) +} +do_populate_staging[lockfiles] += "${S}/.lock" diff --git a/classes/task-metadata-track.bbclass b/classes/task-metadata-track.bbclass new file mode 100644 index 0000000000..d3622aef68 --- /dev/null +++ b/classes/task-metadata-track.bbclass @@ -0,0 +1,96 @@ +# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> +# Released under the MIT license (see COPYING.MIT for the terms) +# +# This class uses events to capture the state of the datastore when the task +# starts, and after it completes. It diffs those captured states, and emits +# messages showing which variables changed, and what their values were changed +# to. +# +# It provides a mechanism to blacklist variables you expect to change, both +# globally and on a per-task basis. +# +# Known instances of tasks changing metadata: +# +# PSTAGE_PKGMANAGER changes by calls to pstage_set_pkgmanager in: +# do_clean, do_setscene, do_package_stage +# +# Subpackage metadata, read by the pkgdata functions in base.bbclass, in: +# do_package, do_package_stage, do_package_write_* + + +TASK_METADATA_BLACKLIST = "\ + __RUNQUEUE_DO_NOT_USE_EXTERNALLY \ +" + +#TASK_METADATA_BLACKLIST_do_clean = "\ +# PSTAGE_PKGMANAGER \ +#" + + +def dict_diff(olddict, newdict): + diff = {} + for key in set(olddict).union(set(newdict)): + old = olddict.get(key) + new = newdict.get(key) + if old != new: + diff[key] = (old, new) + + return diff + +def dict_for_data(data): + newdict = {} + for key in data.keys(): + newdict[key] = data.getVar(key, False) + return newdict + +def task_metadata_track_start(task, data): + originaldata = dict_for_data(data) + data.setVar("__originaldata_%s" % task, originaldata) + +def task_metadata_track_stop(task, data): + from bb import note + + pf = data.getVar("PF", True) + def emit(msg): + note("%s: %s" % (pf, msg)) + + originaldata = data.getVar("__originaldata_%s" % task, False) + newdata = dict_for_data(data) + blacklist = data.getVar("TASK_METADATA_BLACKLIST", True).split() + \ + (data.getVar("TASK_METADATA_BLACKLIST_%s" % task, True) or "").split() + + diff = dict_diff(originaldata, newdata) + diff_clean = [key for key in diff \ + if not key in blacklist and \ + not key.startswith("__originaldata_")] + + if diff_clean: + emit("Variables changed by %s:" % task) + for key in diff_clean: + (old, new) = diff[key] + emit(" %s:" % key) + emit(" '%s' -> '%s'" % (old, new)) + +python __task_metadata_track_eh () { + from bb.build import TaskStarted, TaskSucceeded + + if isinstance(e, TaskStarted): + if e.data is None: + from bb import fatal + fatal("e.data is none for %s" % e) + task_metadata_track_start(e.task, e.data) + elif isinstance(e, TaskSucceeded): + task_metadata_track_stop(e.task, e.data) +} +addhandler __task_metadata_track_eh + +addtask py_listtasks +do_py_listtasks[nostamp] = "1" +do_py_listtasks[recrdeptask] = "do_py_listtasks" +python do_py_listtasks() { + import sys + for e in d.keys(): + if d.getVarFlag(e, "task") and \ + d.getVarFlag(e, "python"): + sys.stdout.write("%s\n" % e) +} diff --git a/classes/testlab.bbclass b/classes/testlab.bbclass index bb47ee877f..fc923c5112 100644 --- a/classes/testlab.bbclass +++ b/classes/testlab.bbclass @@ -22,7 +22,7 @@ # Needs 'dot', 'opkg-cl' do_testlab() { -if [ -e ${IMAGE_ROOTFS}/etc/opkg ] ; then +if [ -e ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full" ] ; then TESTLAB_DIR="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-testlab" mkdir -p ${TESTLAB_DIR}/ diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index 0b7fc1d843..a45c1e679b 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -1,10 +1,19 @@ -def tinder_http_post(server, selector, content_type, body): +def tinder_http_post(d, server, selector, content_type, body): import httplib # now post it for i in range(0,5): try: - h = httplib.HTTP(server) - h.putrequest('POST', selector) + proxy = data.getVar('HTTP_PROXY', d, True ) + if (proxy): + if (proxy.endswith('/')): + proxy = proxy[:-1] + if (proxy.startswith('http://')): + proxy = proxy[7:] + h = httplib.HTTP(proxy) + h.putrequest('POST', 'http://%s%s' % (server, selector)) + else: + h = httplib.HTTP(server) + h.putrequest('POST', selector) h.putheader('content-type', content_type) h.putheader('content-length', str(len(body))) h.endheaders() @@ -12,8 +21,8 @@ def tinder_http_post(server, selector, content_type, body): errcode, errmsg, headers = h.getreply() #print errcode, errmsg, headers return (errcode,errmsg, headers, h.file) - except: - print "Error sending the report!" + except Exception, e: + print "Error sending the report! ", e # try again pass @@ -51,8 +60,7 @@ def tinder_format_http_post(d,status,log): for the tinderbox to be happy. """ - from bb import data, build - import os,random + import random # the variables we will need to send on this form post variables = { @@ -72,7 +80,6 @@ def tinder_format_http_post(d,status,log): "TARGETOS" : data.getVar('TARGET_OS', d, True) or "Unknown", "MACHINE" : data.getVar('MACHINE', d, True) or "Unknown", "DISTRO" : data.getVar('DISTRO', d, True) or "Unknown", - "zecke-rocks" : "sure", } # optionally add the status @@ -116,7 +123,7 @@ def tinder_build_start(d): #print "selector %s and url %s" % (selector, url) # now post it - errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) + errcode, errmsg, headers, h_file = tinder_http_post(d,server,selector,content_type, body) #print errcode, errmsg, headers report = h_file.read() @@ -151,7 +158,7 @@ def tinder_send_http(d, status, _log): new_log = _log while len(new_log) > 0: content_type, body = tinder_format_http_post(d,status,new_log[0:18000]) - errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) + errcode, errmsg, headers, h_file = tinder_http_post(d,server,selector,content_type, body) #print errcode, errmsg, headers #print h.file.read() new_log = new_log[18000:] diff --git a/classes/update-alternatives.bbclass b/classes/update-alternatives.bbclass index c63581c5d1..ddbf4c1947 100644 --- a/classes/update-alternatives.bbclass +++ b/classes/update-alternatives.bbclass @@ -11,7 +11,6 @@ update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} } def update_alternatives_after_parse(d): - import bb if bb.data.getVar('ALTERNATIVE_NAME', d) == None: raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d) if bb.data.getVar('ALTERNATIVE_PATH', d) == None: diff --git a/classes/update-rc.d.bbclass b/classes/update-rc.d.bbclass index 6328193bb9..b6491ed9d6 100644 --- a/classes/update-rc.d.bbclass +++ b/classes/update-rc.d.bbclass @@ -1,5 +1,5 @@ DEPENDS_append = " update-rc.d" -RDEPENDS_append = " update-rc.d" +RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}" INITSCRIPT_PARAMS ?= "defaults" @@ -16,22 +16,31 @@ update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} updatercd_prerm() { if test "x$D" = "x"; then - ${INIT_D_DIR}/${INITSCRIPT_NAME} stop + if test "$1" = "upgrade" -o "$1" = "remove"; then + ${INIT_D_DIR}/${INITSCRIPT_NAME} stop + fi fi } +# Note: to be Debian compliant, we should only invoke update-rc.d remove +# at the "purge" step, but opkg does not support it. So instead we also +# run it at the "remove" step if the init script no longer exists. + updatercd_postrm() { if test "x$D" != "x"; then OPT="-r $D" else OPT="" fi -update-rc.d $OPT ${INITSCRIPT_NAME} remove +if test "$1" = "remove" -o "$1" = "purge"; then + if ! test -e "${INIT_D_DIR}/${INITSCRIPT_NAME}"; then + update-rc.d $OPT ${INITSCRIPT_NAME} remove + fi +fi } def update_rc_after_parse(d): - import bb if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None: if bb.data.getVar('INITSCRIPT_NAME', d) == None: raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d) diff --git a/classes/vala.bbclass b/classes/vala.bbclass new file mode 100644 index 0000000000..125820c00c --- /dev/null +++ b/classes/vala.bbclass @@ -0,0 +1,14 @@ +DEPENDS += "vala-native" + +FILES_${PN}-dev += "\ + ${datadir}/vala/vapi/*.vapi \ + ${datadir}/vala/vapi/*.deps \ +" + +# .vapi and .deps files are arch independent and need to be present in the +# staging datadir for the native vala compiler +do_stage_append() { + install -d ${STAGING_DATADIR_NATIVE}/vala/vapi + find . -name "*.vapi" -exec install -m 0644 {} ${STAGING_DATADIR_NATIVE}/vala/vapi/ \; + find . -name "*.deps" -exec install -m 0644 {} ${STAGING_DATADIR_NATIVE}/vala/vapi/ \; +} diff --git a/classes/xfce.bbclass b/classes/xfce.bbclass index 48e012e67e..db6329c4ad 100644 --- a/classes/xfce.bbclass +++ b/classes/xfce.bbclass @@ -5,11 +5,11 @@ # Global class to make it easier to maintain XFCE packages HOMEPAGE = "http://www.xfce.org" -LICENSE = "LGPL-2" +LICENSE = "LGPLv2" DEPENDS += "startup-notification" XFCE_VERSION = ${PV} -SRC_URI = "http://www.us.xfce.org/archive/xfce-${XFCE_VERSION}/src/${PN}-${PV}.tar.bz2" +SRC_URI = "http://www.us.xfce.org/archive/xfce/${XFCE_VERSION}/src/${PN}-${PV}.tar.bz2" inherit autotools diff --git a/classes/xfce46.bbclass b/classes/xfce46.bbclass new file mode 100644 index 0000000000..c24dfa4d8c --- /dev/null +++ b/classes/xfce46.bbclass @@ -0,0 +1,28 @@ +# xfce46.bbclass + +# Global class to help maintain XFCE 4.6.* packages + +HOMEPAGE = "http://www.xfce.org" +LICENSE = "LGPLv2" + +DEPENDS += "startup-notification" + +SECTION ?= "x11/xfce" + +XFCE_VERSION = ${PV} + +SRC_URI = "http://mocha.xfce.org/archive/src/xfce/${PN}/${@'${PV}'[0:3]}/${PN}-${PV}.tar.bz2" + +inherit autotools gtk-icon-cache pkgconfig + +AUTOTOOLS_STAGE_PKGCONFIG = "1" + +EXTRA_OECONF += "--with-pluginsdir=${libdir}/xfce4/panel-plugins/" + +# FIXME: Put icons in their own package too? + +FILES_${PN} += "${datadir}/icons/* ${datadir}/applications/* ${libdir}/xfce4/modules/*.so*" +FILES_${PN}-doc += "${datadir}/xfce4/doc" + +FILES_${PN}-dev += "${libdir}/xfce4/*/*.la" +FILES_${PN}-dbg += "${libdir}/xfce4/*/.debug" diff --git a/classes/xlibs.bbclass b/classes/xlibs.bbclass index ae8f928f1e..fc52400b9f 100644 --- a/classes/xlibs.bbclass +++ b/classes/xlibs.bbclass @@ -6,10 +6,10 @@ XLIBS_CVS = "${FREEDESKTOP_CVS}/xlibs" inherit autotools pkgconfig do_stage() { - oe_runmake install prefix=${STAGING_DIR_HOST}${layout_prefix} \ + oe_runmake install prefix=${STAGING_DIR_HOST}${prefix} \ bindir=${STAGING_BINDIR} \ includedir=${STAGING_INCDIR} \ libdir=${STAGING_LIBDIR} \ datadir=${STAGING_DATADIR} \ - mandir=${STAGING_DIR_HOST}${layout_mandir} + mandir=${STAGING_DIR_HOST}${mandir} } |
