From c724ad44d6adfda201f33c15378cab8d9e7ee902 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 3 Nov 2009 14:45:02 +0100 Subject: base.bbclass: Better error message in case the Config Parser fails http://patchwork.openembedded.org/patch/1088/ Tested-by: Ed Nelson --- classes/base.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index d29ba4bfcf..89ee917d20 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -661,7 +661,7 @@ python base_do_fetch() { 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) -- cgit v1.2.3 From 0d722f5b12f447a46af3f935c0c516bfab927893 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sun, 8 Nov 2009 20:48:44 +0000 Subject: base.bbclass: Drop legacy rebuild mangling code Signed-off-by: Richard Purdie --- classes/base.bbclass | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 89ee917d20..4cda29cf38 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -529,21 +529,11 @@ python do_cleanall() { do_cleanall[recrdeptask] = "do_clean" addtask cleanall after do_clean -#Uncomment this for bitbake 1.8.12 -#addtask rebuild after do_${BB_DEFAULT_TASK} -addtask rebuild +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 @@ -1235,18 +1225,7 @@ def base_after_parse(d): 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): -- cgit v1.2.3 From 9a5937f6c6417ba8fd3464f03c69782d29813bbc Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sun, 8 Nov 2009 20:54:00 +0000 Subject: base.bbclass: Drop import bb and import os as no longer needed Signed-off-by: Richard Purdie --- classes/base.bbclass | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 4cda29cf38..a3ea7bc685 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -49,7 +49,7 @@ def base_path_out(path, d): # for MD5/SHA handling def base_chk_load_parser(config_paths): - import ConfigParser, os, bb + import ConfigParser parser = ConfigParser.ConfigParser() if len(parser.read(config_paths)) < 1: raise ValueError("no ini files could be found") @@ -57,7 +57,6 @@ def base_chk_load_parser(config_paths): return parser 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 @@ -128,7 +127,6 @@ 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 @@ -150,7 +148,6 @@ def base_dep_prepend(d): return deps def base_read_file(filename): - import bb try: f = file( filename, "r" ) except IOError, reason: @@ -166,21 +163,18 @@ def base_ifelse(condition, iftrue = True, iffalse = False): 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 @@ -188,7 +182,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] @@ -200,7 +193,6 @@ 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: @@ -211,8 +203,6 @@ DEPENDS_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] @@ -229,7 +219,6 @@ def base_package_name(d): return pn 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 @@ -448,7 +437,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)) @@ -553,7 +541,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) @@ -731,7 +718,7 @@ def subprocess_setup(): signal.signal(signal.SIGPIPE, signal.SIG_DFL) def oe_unpack_file(file, data, url = None): - import bb, os, subprocess + import subprocess if not url: url = "file://%s" % file dots = file.split(".") @@ -809,7 +796,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) @@ -836,7 +823,6 @@ METADATA_REVISION = "${@base_get_scm_revision(d)}" METADATA_BRANCH = "${@base_get_scm_branch(d)}" def base_get_scm(d): - import os 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", @@ -897,7 +883,6 @@ def base_get_metadata_svn_revision(path, d): return revision def base_get_metadata_git_branch(path, d): - import os 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: @@ -905,7 +890,6 @@ def base_get_metadata_git_branch(path, d): return "" def base_get_metadata_git_revision(path, d): - import os 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 @@ -916,7 +900,7 @@ addhandler base_eventhandler python base_eventhandler() { from bb import note, error, data from bb.event import Handled, NotHandled, getName - import os + name = getName(e) if name == "TaskCompleted": @@ -1071,7 +1055,6 @@ def read_pkgdatafile(fn): 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) @@ -1083,25 +1066,20 @@ def get_subpkgedata_fn(pkg, d): 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(): @@ -1118,7 +1096,6 @@ python read_subpackage_metadata () { # Collapse FOO_pkg variables into FOO # def read_subpkgdata_dict(pkg, d): - import bb ret = {} subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d)) for var in subd: @@ -1141,7 +1118,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: @@ -1224,7 +1201,6 @@ def base_after_parse(d): bb.data.setVar('MULTIMACH_ARCH', multiarch, d) python () { - import bb base_after_parse(d) } -- cgit v1.2.3 From c942cea699be2e07b4dfe9ced8b200756c80eb02 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 30 Oct 2009 21:59:06 +0000 Subject: packagedata.bbclass: Split package data handling functions out from base.bclass (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 77 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 75 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index a3ea7bc685..7f24482605 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1008,6 +1008,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. @@ -1028,81 +1030,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): - 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 - # Make sure MACHINE isn't exported # (breaks binutils at least) MACHINE[unexport] = "1" -- cgit v1.2.3 From 0fc2395bd61abaac94c670e671042f59c6d88e00 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 9 Nov 2009 14:07:11 +0000 Subject: base.bbclass: Promote packagedata inherit to a direct inherit due to ordering issues Signed-off-by: Richard Purdie --- classes/base.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 7f24482605..9de2c67af1 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1008,7 +1008,7 @@ addtask build after do_populate_staging do_build = "" do_build[func] = "1" -INHERIT =+ "packagedata" +inherit packagedata # Functions that update metadata based on files outputted # during the build process. -- cgit v1.2.3 From bea72c2fecde175add169bb55df1922b048030c8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 30 Oct 2009 21:48:21 +0000 Subject: Start removal of layout_* variables and replace these with new mechanisms to allow nextgen SDK generation (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 9de2c67af1..3f610ac384 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -977,8 +977,8 @@ base_do_stage () { : } -do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${layout_bindir} ${STAGING_DIR_TARGET}/${layout_libdir} \ - ${STAGING_DIR_TARGET}/${layout_includedir} \ +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} \ -- cgit v1.2.3 From b66fa6b32686ef5a750de1bb2fb317448c682863 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 17:23:05 +0000 Subject: autotools.bbclass: Separate out useful staging functions into base.bbclass and call from autotools classes (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 3f610ac384..8404a07025 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -973,6 +973,70 @@ base_do_compile() { fi } + +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} +} + + base_do_stage () { : } -- cgit v1.2.3 From bf755f0c721a91a3067fdac9f936a72e11f99cbc Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 17:30:32 +0000 Subject: binconfig/pkgconfig.bbclass: Convert staging functions into SYSROOT_PREPROCESS_FUNCS operating on SYSROOT_DESTDIR Signed-off-by: Richard Purdie --- classes/base.bbclass | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 8404a07025..024f8227bc 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1051,8 +1051,13 @@ do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGE # 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/" + python do_populate_staging () { 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) } addtask install after do_compile -- cgit v1.2.3 From 5c7d389a900e2c821a5e5572f7a1bc568f86be18 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 17:38:29 +0000 Subject: packaged-staging.bbclass: Use a variable for the location of the staging lock file (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 1 + 1 file changed, 1 insertion(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 024f8227bc..a75324b48e 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1053,6 +1053,7 @@ addtask populate_staging after do_install SYSROOT_PREPROCESS_FUNCS ?= "" SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" +SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" python do_populate_staging () { bb.build.exec_func('do_stage', d) -- cgit v1.2.3 From 5b28d571177ba2c9d16c89a03f7c645a0e7050fb Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 20:40:34 +0000 Subject: base.bbclass: Rework staging function to use a DESTDIR style configuration based on the data from the do_install step (from Poky). This falls back to any standard do_stage function if defined, see the mailing list for more info. Signed-off-by: Richard Purdie --- classes/base.bbclass | 59 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 9 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index a75324b48e..583679d887 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1031,15 +1031,23 @@ sysroot_stage_dirs() { sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR} } - sysroot_stage_all() { sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR} } - -base_do_stage () { - : -} +def is_legacy_staging(d): + import bb + 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 + if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1": + legacy = True + return legacy do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \ ${STAGING_DIR_TARGET}/${includedir} \ @@ -1056,9 +1064,42 @@ SYSROOT_DESTDIR = "${WORKDIR}/sysroot-destdir/" SYSROOT_LOCK = "${STAGING_DIR}/staging.lock" python do_populate_staging () { - 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) + # + # 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)) + lock = bb.utils.lockfile(lockfile) + bb.build.exec_func('do_stage', d) + bb.build.exec_func('populate_staging_prehook', 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("packagedstageing_fastpath", d) + + lock = bb.utils.lockfile(lockfile) + os.system('cp -pPR %s/* /' % (sysrootdest)) + bb.utils.unlockfile(lock) } addtask install after do_compile @@ -1228,7 +1269,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 () { -- cgit v1.2.3 From 97c8212d54950b70cd955f94bdd66822ce3f2ba4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 20:42:28 +0000 Subject: base.bbclass: Note legacy staging packages in debug output Signed-off-by: Richard Purdie --- classes/base.bbclass | 2 ++ 1 file changed, 2 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 583679d887..5ae8b6130f 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1240,6 +1240,8 @@ def base_after_parse(d): python () { base_after_parse(d) + if is_legacy_staging(d): + bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True)) } def check_app_exists(app, d): -- cgit v1.2.3 From 0c0889223c330b8a3c9e122581805e2c3d9a7bd4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 2 Nov 2009 22:34:50 +0000 Subject: base.bbclass: Add stubs for functions when package-staging isn't active and fix a typo Signed-off-by: Richard Purdie --- classes/base.bbclass | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 5ae8b6130f..d33ef343c7 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1063,6 +1063,18 @@ 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 () { # # if do_stage exists, we're legacy. In that case run the do_stage, @@ -1095,7 +1107,7 @@ python do_populate_staging () { #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("packagedstageing_fastpath", d) + bb.build.exec_func("packagedstaging_fastpath", d) lock = bb.utils.lockfile(lockfile) os.system('cp -pPR %s/* /' % (sysrootdest)) -- cgit v1.2.3 From ab35aa34f3de37365d46692555c8a2ec3667da56 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 3 Nov 2009 00:38:53 +0000 Subject: base.bbclass: Fix staging for native and non-native packages Signed-off-by: Richard Purdie --- classes/base.bbclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index d33ef343c7..49bb8144d2 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1045,6 +1045,8 @@ def is_legacy_staging(d): 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 return legacy @@ -1110,7 +1112,7 @@ python do_populate_staging () { bb.build.exec_func("packagedstaging_fastpath", d) lock = bb.utils.lockfile(lockfile) - os.system('cp -pPR %s/* /' % (sysrootdest)) + os.system(bb.data.expand('cp -pPR ${SYSROOT_DESTDIR}${TMPDIR}/* ${TMPDIR}/', d)) bb.utils.unlockfile(lock) } -- cgit v1.2.3 From 4ecbf17b161b54780c26af2c6e90333f8825b013 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 10 Nov 2009 13:53:17 +0000 Subject: native.bbclass: Add BBCLASSEXTEND support (from poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 2 ++ 1 file changed, 2 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 49bb8144d2..dd48d9229e 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -199,6 +199,8 @@ def base_both_contain(variable1, variable2, checkvalue, d): 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. -- cgit v1.2.3 From 539d1d9592ca0cde57ce94e227b63fd1104bb9d5 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 10 Nov 2009 13:58:46 +0000 Subject: base.bbclass: Replace the base_package_name function with the base_prune_suffix() function from Poky and extend the number of special suffixes Signed-off-by: Richard Purdie --- classes/base.bbclass | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index dd48d9229e..aa1037e472 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -202,23 +202,13 @@ 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): - 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] - elif pn.endswith("-sdk"): - pn = pn[0:-4] - - - 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): bb.note("base_set_filespath usage is deprecated, %s should be fixed" % d.getVar("P", 1)) -- cgit v1.2.3 From 24f65d8096e185714b50b1e0bef084ea8cc8392d Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 11 Nov 2009 13:52:02 +0000 Subject: base.bbclass: Detect recipes where there are problems with staging functions after staging upgrades Signed-off-by: Richard Purdie --- classes/base.bbclass | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index aa1037e472..e4fc2ac34f 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1085,6 +1085,8 @@ python do_populate_staging () { 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('do_stage', d) bb.build.exec_func('populate_staging_prehook', d) @@ -1248,6 +1250,9 @@ python () { 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)) + } def check_app_exists(app, d): -- cgit v1.2.3 From fe9ff4fa1f8edf885ee1a9089366079fa6729a03 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 Nov 2009 10:31:04 +0000 Subject: base.bbclass: Fix legacy staging package generation as pre hook was called too late. Also allow legacy staging to be forced with FORCE_LEGACY_STAGING Signed-off-by: Richard Purdie --- classes/base.bbclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index e4fc2ac34f..9d063f2151 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1041,6 +1041,8 @@ def is_legacy_staging(d): 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} \ @@ -1088,8 +1090,8 @@ python do_populate_staging () { 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('do_stage', d) 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) -- cgit v1.2.3 From ca68e0eeba638451480ba936f5c72c4ec17e73cf Mon Sep 17 00:00:00 2001 From: Phil Blundell Date: Fri, 13 Nov 2009 17:22:22 +0000 Subject: base.bbclass: add support for checksums in .bb files --- classes/base.bbclass | 56 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 9d063f2151..ef0bf8567c 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -56,6 +56,50 @@ def base_chk_load_parser(config_paths): 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)) + shadata = (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): no_checksum = False # Try PN-PV-SRC_URI first and then try PN-SRC_URI @@ -639,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) } -- cgit v1.2.3 From 1f986867b61e756b0cd0a620f431e0d09b2bad62 Mon Sep 17 00:00:00 2001 From: Phil Blundell Date: Fri, 13 Nov 2009 17:32:32 +0000 Subject: fix c&p error in last patch --- classes/base.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index ef0bf8567c..3602801f50 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -89,7 +89,7 @@ def base_chk_file_vars(parser, localpath, params, data): if want_sha256sum: try: shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath)) - shadata = (shapipe.readline().split() or [ "" ])[0] + sha256data = (shapipe.readline().split() or [ "" ])[0] shapipe.close() except OSError, e: raise Exception("Executing shasum failed") -- cgit v1.2.3 From bc465d83ad8665211b6f9664b418f4eafcc5ca6c Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 16 Nov 2009 10:45:23 +0000 Subject: classes: Drop a number of unneeded import calls (from Poky) Signed-off-by: Richard Purdie --- classes/base.bbclass | 1 - 1 file changed, 1 deletion(-) (limited to 'classes/base.bbclass') diff --git a/classes/base.bbclass b/classes/base.bbclass index 3602801f50..384a67d3d6 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -1072,7 +1072,6 @@ sysroot_stage_all() { } def is_legacy_staging(d): - import bb stagefunc = bb.data.getVar('do_stage', d, True) legacy = True if stagefunc is None: -- cgit v1.2.3