diff options
Diffstat (limited to 'classes/base.bbclass')
-rw-r--r-- | classes/base.bbclass | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass index c8ee75627f..7609c05851 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -85,7 +85,7 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): def base_dep_prepend(d): - import bb; + 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 @@ -412,7 +412,6 @@ python do_listtasks() { addtask clean do_clean[dirs] = "${TOPDIR}" do_clean[nostamp] = "1" -do_clean[bbdepcmd] = "" python base_do_clean() { """clear the build and temp directories""" dir = bb.data.expand("${WORKDIR}", d) @@ -425,27 +424,33 @@ python base_do_clean() { os.system('rm -f '+ dir) } +#Uncomment this for bitbake 1.8.12 +#addtask rebuild after do_${BB_DEFAULT_TASK} addtask rebuild do_rebuild[dirs] = "${TOPDIR}" do_rebuild[nostamp] = "1" -do_rebuild[bbdepcmd] = "" python base_do_rebuild() { """rebuild a package""" - bb.build.exec_task('do_clean', d) - bb.build.exec_task('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1), d) + 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 do_mrproper[dirs] = "${TOPDIR}" do_mrproper[nostamp] = "1" -do_mrproper[bbdepcmd] = "" python base_do_mrproper() { """clear downloaded sources, build and temp directories""" dir = bb.data.expand("${DL_DIR}", d) if dir == '/': bb.build.FuncFailed("wrong DATADIR") bb.debug(2, "removing " + dir) os.system('rm -rf ' + dir) - bb.build.exec_task('do_clean', d) + bb.build.exec_func('do_clean', d) } addtask fetch @@ -539,7 +544,7 @@ def oe_unpack_file(file, data, url = None): cmd = 'tar x --no-same-owner -f %s' % file elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'): cmd = 'tar xz --no-same-owner -f %s' % file - elif file.endswith('.tbz') or file.endswith('.tar.bz2'): + elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'): cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'): cmd = 'gzip -dc %s > %s' % (file, efile) @@ -666,6 +671,17 @@ python base_eventhandler() { if pesteruser: bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) + # + # Handle removing stamps for 'rebuild' task + # + if name.startswith("StampUpdate"): + for (fn, task) in e.targets: + #print "%s %s" % (task, fn) + if task == "do_rebuild": + dir = "%s.*" % e.stampPrefix[fn] + bb.note("Removing stamps: " + dir) + os.system('rm -f '+ dir) + if not data in e.__dict__: return NotHandled @@ -680,7 +696,6 @@ python base_eventhandler() { addtask configure after do_unpack do_patch do_configure[dirs] = "${S} ${B}" -do_configure[bbdepcmd] = "do_populate_staging" do_configure[deptask] = "do_populate_staging" base_do_configure() { : @@ -688,7 +703,6 @@ base_do_configure() { addtask compile after do_configure do_compile[dirs] = "${S} ${B}" -do_compile[bbdepcmd] = "do_populate_staging" base_do_compile() { if [ -e Makefile -o -e makefile ]; then oe_runmake || die "make failed" @@ -782,8 +796,10 @@ def get_subpkgedata_fn(pkg, d): import bb, os archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ") archs.reverse() + pkgdata = bb.data.expand('${STAGING_DIR}/pkgdata/', d) + targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d) for arch in archs: - fn = bb.data.expand('${STAGING_DIR}/pkgdata/' + arch + '${TARGET_VENDOR}-${TARGET_OS}/runtime/%s' % pkg, d) + fn = pkgdata + arch + targetdir + pkg if os.path.exists(fn): return fn return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d) @@ -819,6 +835,20 @@ python read_subpackage_metadata () { bb.data.setVar(key, sdata[key], d) } +# Make sure MACHINE isn't exported +# (breaks binutils at least) +MACHINE[unexport] = "1" + +# Make sure TARGET_ARCH isn't exported +# (breaks Makefiles using implicit rules, e.g. quilt, as GNU make has this +# in them, undocumented) +TARGET_ARCH[unexport] = "1" + +# Make sure DISTRO isn't exported +# (breaks sysvinit at least) +DISTRO[unexport] = "1" + + def base_after_parse(d): import bb, os, exceptions @@ -838,8 +868,6 @@ def base_after_parse(d): if this_machine and not re.match(need_machine, this_machine): raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine) - - pn = bb.data.getVar('PN', d, 1) # OBSOLETE in bitbake 1.7.4 @@ -851,22 +879,6 @@ def base_after_parse(d): if use_nls != None: bb.data.setVar('USE_NLS', use_nls, d) - # Make sure MACHINE isn't exported - # (breaks binutils at least) - bb.data.delVarFlag('MACHINE', 'export', d) - bb.data.setVarFlag('MACHINE', 'unexport', 1, d) - - # Make sure TARGET_ARCH isn't exported - # (breaks Makefiles using implicit rules, e.g. quilt, as GNU make has this - # in them, undocumented) - bb.data.delVarFlag('TARGET_ARCH', 'export', d) - bb.data.setVarFlag('TARGET_ARCH', 'unexport', 1, d) - - # Make sure DISTRO isn't exported - # (breaks sysvinit at least) - bb.data.delVarFlag('DISTRO', 'export', d) - bb.data.setVarFlag('DISTRO', 'unexport', 1, d) - # Git packages should DEPEND on git-native srcuri = bb.data.getVar('SRC_URI', d, 1) if "git://" in srcuri: @@ -896,7 +908,7 @@ def base_after_parse(d): if len(paths) == 0: return - for s in bb.data.getVar('SRC_URI', d, 1).split(): + for s in srcuri.split(): if not s.startswith("file://"): continue local = bb.data.expand(bb.fetch.localpath(s, d), d) @@ -907,7 +919,19 @@ def base_after_parse(d): return python () { + import bb + from bb import __version__ base_after_parse(d) + + # 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): |