diff options
Diffstat (limited to 'poky/meta/classes')
-rw-r--r-- | poky/meta/classes/ccmake.bbclass | 97 | ||||
-rw-r--r-- | poky/meta/classes/cmake.bbclass | 9 | ||||
-rw-r--r-- | poky/meta/classes/go.bbclass | 19 | ||||
-rw-r--r-- | poky/meta/classes/goarch.bbclass | 19 | ||||
-rw-r--r-- | poky/meta/classes/insane.bbclass | 55 | ||||
-rw-r--r-- | poky/meta/classes/sanity.bbclass | 2 | ||||
-rw-r--r-- | poky/meta/classes/sstate.bbclass | 6 |
7 files changed, 190 insertions, 17 deletions
diff --git a/poky/meta/classes/ccmake.bbclass b/poky/meta/classes/ccmake.bbclass new file mode 100644 index 000000000..4114daa61 --- /dev/null +++ b/poky/meta/classes/ccmake.bbclass @@ -0,0 +1,97 @@ +inherit terminal + +python do_ccmake() { + import shutil + + # copy current config for diffing + config = os.path.join(d.getVar("B"), "CMakeCache.txt") + if os.path.exists(config): + shutil.copy(config, config + ".orig") + + oe_terminal(d.expand("ccmake ${OECMAKE_GENERATOR_ARGS} ${OECMAKE_SOURCEPATH} -Wno-dev"), + d.getVar("PN") + " - ccmake", d) + + if os.path.exists(config) and os.path.exists(config + ".orig"): + if bb.utils.md5_file(config) != bb.utils.md5_file(config + ".orig"): + # the cmake class uses cmake --build, which will by default + # regenerate configuration, simply mark the compile step as tainted + # to ensure it is re-run + bb.note("Configuration changed, recompile will be forced") + bb.build.write_taint('do_compile', d) + +} +do_ccmake[depends] += "cmake-native:do_populate_sysroot" +do_ccmake[nostamp] = "1" +do_ccmake[dirs] = "${B}" +addtask ccmake after do_configure + +def cmake_parse_config_cache(path): + with open(path, "r") as f: + for i in f: + i = i.rstrip("\n") + if len(i) == 0 or i.startswith("//") or i.startswith("#"): + continue # empty or comment + key, value = i.split("=", 1) + key, keytype = key.split(":") + if keytype in ["INTERNAL", "STATIC"]: + continue # skip internal and static config options + yield key, keytype, value + +def cmake_diff_config_vars(a, b): + removed, added = [], [] + + for ak, akt, av in a: + found = False + for bk, bkt, bv in b: + if bk == ak: + found = True + if bkt != akt or bv != av: # changed + removed.append((ak, akt, av)) + added.append((bk, bkt, bv)) + break + # remove any missing from b + if not found: + removed.append((ak, akt, av)) + + # add any missing from a + for bk, bkt, bv in b: + if not any(bk == ak for ak, akt, av in a): + added.append((bk, bkt, bv)) + + return removed, added + +python do_ccmake_diffconfig() { + import shutil + config = os.path.join(d.getVar("B"), "CMakeCache.txt") + if os.path.exists(config) and os.path.exists(config + ".orig"): + if bb.utils.md5_file(config) != bb.utils.md5_file(config + ".orig"): + # scan the changed options + old = list(cmake_parse_config_cache(config + ".orig")) + new = list(cmake_parse_config_cache(config)) + _, added = cmake_diff_config_vars(old, new) + + if len(added) != 0: + with open(d.expand("${WORKDIR}/configuration.inc"), "w") as f: + f.write("EXTRA_OECMAKE += \" \\\n") + for k, kt, v in added: + escaped = v if " " not in v else "\"{0}\"".format(v) + f.write(" -D{0}:{1}={2} \\\n".format(k, kt, escaped)) + f.write(" \"\n") + bb.plain("Configuration recipe fragment written to: {0}".format(d.expand("${WORKDIR}/configuration.inc"))) + + with open(d.expand("${WORKDIR}/site-file.cmake"), "w") as f: + for k, kt, v in added: + f.write("SET({0} \"{1}\" CACHE {2} "")\n".format(k, v, kt)) + bb.plain("Configuration cmake fragment written to: {0}".format(d.expand("${WORKDIR}/site-file.cmake"))) + + # restore the original config + shutil.copy(config + ".orig", config) + else: + bb.plain("No configuration differences, skipping configuration fragment generation.") + else: + bb.fatal("No config files found. Did you run ccmake?") +} +do_ccmake_diffconfig[nostamp] = "1" +do_ccmake_diffconfig[dirs] = "${B}" +addtask ccmake_diffconfig + diff --git a/poky/meta/classes/cmake.bbclass b/poky/meta/classes/cmake.bbclass index e16630434..d3f0d7084 100644 --- a/poky/meta/classes/cmake.bbclass +++ b/poky/meta/classes/cmake.bbclass @@ -10,13 +10,14 @@ OECMAKE_GENERATOR ?= "Ninja" python() { generator = d.getVar("OECMAKE_GENERATOR") - if generator == "Unix Makefiles": - args = "-G 'Unix Makefiles' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE") + if "Unix Makefiles" in generator: + args = "-G '" + generator + "' -DCMAKE_MAKE_PROGRAM=" + d.getVar("MAKE") d.setVar("OECMAKE_GENERATOR_ARGS", args) d.setVarFlag("do_compile", "progress", "percent") - elif generator == "Ninja": + elif "Ninja" in generator: + args = "-G '" + generator + "' -DCMAKE_MAKE_PROGRAM=ninja" d.appendVar("DEPENDS", " ninja-native") - d.setVar("OECMAKE_GENERATOR_ARGS", "-G Ninja -DCMAKE_MAKE_PROGRAM=ninja") + d.setVar("OECMAKE_GENERATOR_ARGS", args) d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+") else: bb.fatal("Unknown CMake Generator %s" % generator) diff --git a/poky/meta/classes/go.bbclass b/poky/meta/classes/go.bbclass index 7069c5fec..78c2d6880 100644 --- a/poky/meta/classes/go.bbclass +++ b/poky/meta/classes/go.bbclass @@ -8,6 +8,25 @@ GOROOT = "${STAGING_LIBDIR}/go" export GOROOT export GOROOT_FINAL = "${libdir}/go" +export GOARCH = "${TARGET_GOARCH}" +export GOOS = "${TARGET_GOOS}" +export GOHOSTARCH="${BUILD_GOARCH}" +export GOHOSTOS="${BUILD_GOOS}" + +GOARM[export] = "0" +GOARM_arm_class-target = "${TARGET_GOARM}" +GOARM_arm_class-target[export] = "1" + +GO386[export] = "0" +GO386_x86_class-target = "${TARGET_GO386}" +GO386_x86_class-target[export] = "1" +GO386_i586_class-target = "${TARGET_GO386}" +GO386_i586_class-target[export] = "1" + +GOMIPS[export] = "0" +GOMIPS_mips_class-target = "${TARGET_GOMIPS}" +GOMIPS_mips_class-target[export] = "1" + DEPENDS_GOLANG_class-target = "virtual/${TUNE_PKGARCH}-go virtual/${TARGET_PREFIX}go-runtime" DEPENDS_GOLANG_class-native = "go-native" DEPENDS_GOLANG_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${TARGET_PREFIX}go-runtime" diff --git a/poky/meta/classes/goarch.bbclass b/poky/meta/classes/goarch.bbclass index 7aaf26aed..909646b8d 100644 --- a/poky/meta/classes/goarch.bbclass +++ b/poky/meta/classes/goarch.bbclass @@ -3,18 +3,26 @@ BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH'), d)}" BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}" HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}" HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}" -HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" +HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('BASE_GOARM'), d)}" HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}" TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}" TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}" -TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" +TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('BASE_GOARM'), d)}" TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}" GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}" +# Use the MACHINEOVERRIDES to map ARM CPU architecture passed to GO via GOARM. +# This is combined with *_ARCH to set HOST_GOARM and TARGET_GOARM. +BASE_GOARM = '' +BASE_GOARM_armv7ve = '7' +BASE_GOARM_armv7a = '7' +BASE_GOARM_armv6 = '6' +BASE_GOARM_armv5 = '5' + # Go supports dynamic linking on a limited set of architectures. # See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go GO_DYNLINK = "" @@ -76,12 +84,7 @@ def go_map_arch(a, d): def go_map_arm(a, f, d): import re if re.match('arm.*', a): - if 'armv7' in f: - return '7' - elif 'armv6' in f: - return '6' - elif 'armv5' in f: - return '5' + return f return '' def go_map_386(a, f, d): diff --git a/poky/meta/classes/insane.bbclass b/poky/meta/classes/insane.bbclass index 37b8bb003..4267cbd0f 100644 --- a/poky/meta/classes/insane.bbclass +++ b/poky/meta/classes/insane.bbclass @@ -27,7 +27,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \ installed-vs-shipped compile-host-path install-host-path \ pn-overrides infodir build-deps \ unknown-configure-option symlink-to-sysroot multilib \ - invalid-packageconfig host-user-contaminated uppercase-pn \ + invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \ " ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ perms dep-cmp pkgvarcheck perm-config perm-line perm-link \ @@ -1033,6 +1033,54 @@ python do_qa_staging() { bb.fatal("QA staging was broken by the package built above") } +python do_qa_patch() { + import subprocess + + ########################################################################### + # Check patch.log for fuzz warnings + # + # Further information on why we check for patch fuzz warnings: + # http://lists.openembedded.org/pipermail/openembedded-core/2018-March/148675.html + # https://bugzilla.yoctoproject.org/show_bug.cgi?id=10450 + ########################################################################### + + logdir = d.getVar('T') + patchlog = os.path.join(logdir,"log.do_patch") + + if os.path.exists(patchlog): + fuzzheader = '--- Patch fuzz start ---' + fuzzfooter = '--- Patch fuzz end ---' + statement = "grep -e '%s' %s > /dev/null" % (fuzzheader, patchlog) + if subprocess.call(statement, shell=True) == 0: + msg = "Fuzz detected:\n\n" + fuzzmsg = "" + inFuzzInfo = False + f = open(patchlog, "r") + for line in f: + if fuzzheader in line: + inFuzzInfo = True + fuzzmsg = "" + elif fuzzfooter in line: + fuzzmsg = fuzzmsg.replace('\n\n', '\n') + msg += fuzzmsg + msg += "\n" + inFuzzInfo = False + elif inFuzzInfo and not 'Now at patch' in line: + fuzzmsg += line + f.close() + msg += "The context lines in the patches can be updated with devtool:\n" + msg += "\n" + msg += " devtool modify %s\n" % d.getVar('PN') + msg += " devtool finish --force-patch-refresh %s <layer_path>\n\n" % d.getVar('PN') + msg += "Don't forget to review changes done by devtool!\n" + if 'patch-fuzz' in d.getVar('ERROR_QA'): + bb.error(msg) + elif 'patch-fuzz' in d.getVar('WARN_QA'): + bb.warn(msg) + msg = "Patch log indicates that patches do not apply cleanly." + package_qa_handle_error("patch-fuzz", msg, d) +} + python do_qa_configure() { import subprocess @@ -1087,7 +1135,7 @@ Rerun configure task after fixing this.""" for config in configs: gnu = "grep \"^[[:space:]]*AM_GNU_GETTEXT\" %s >/dev/null" % config if subprocess.call(gnu, shell=True) == 0: - error_msg = "%s required but not in DEPENDS for file %s. Missing inherit gettext?" + error_msg = "AM_GNU_GETTEXT used but no inherit gettext" package_qa_handle_error("configure-gettext", error_msg, d) ########################################################################### @@ -1137,6 +1185,9 @@ python do_qa_unpack() { #addtask qa_staging after do_populate_sysroot before do_build do_populate_sysroot[postfuncs] += "do_qa_staging " +# Check for patch fuzz +do_patch[postfuncs] += "do_qa_patch " + # Check broken config.log files, for packages requiring Gettext which # don't have it in DEPENDS. #addtask qa_configure after do_configure before do_compile diff --git a/poky/meta/classes/sanity.bbclass b/poky/meta/classes/sanity.bbclass index cab092140..4cbb1f3a6 100644 --- a/poky/meta/classes/sanity.bbclass +++ b/poky/meta/classes/sanity.bbclass @@ -876,7 +876,7 @@ def check_sanity_everybuild(status, d): with open(checkfile, "r") as f: saved_tmpdir = f.read().strip() if (saved_tmpdir != tmpdir): - status.addresult("Error, TMPDIR has changed location. You need to either move it back to %s or rebuild\n" % saved_tmpdir) + status.addresult("Error, TMPDIR has changed location. You need to either move it back to %s or delete it and rebuild\n" % saved_tmpdir) else: bb.utils.mkdirhier(tmpdir) # Remove setuid, setgid and sticky bits from TMPDIR diff --git a/poky/meta/classes/sstate.bbclass b/poky/meta/classes/sstate.bbclass index 6f51d9c18..424acfb15 100644 --- a/poky/meta/classes/sstate.bbclass +++ b/poky/meta/classes/sstate.bbclass @@ -689,7 +689,8 @@ def pstaging_fetch(sstatefetch, d): # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK, # we'll want to allow network access for the current set of fetches. - if localdata.getVar('BB_NO_NETWORK') == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK') == "1": + if bb.utils.to_boolean(localdata.getVar('BB_NO_NETWORK')) and \ + bb.utils.to_boolean(localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK')): localdata.delVar('BB_NO_NETWORK') # Try a fetch from the sstate mirror, if it fails just return and @@ -867,7 +868,8 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False, *, # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK, # we'll want to allow network access for the current set of fetches. - if localdata.getVar('BB_NO_NETWORK') == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK') == "1": + if bb.utils.to_boolean(localdata.getVar('BB_NO_NETWORK')) and \ + bb.utils.to_boolean(localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK')): localdata.delVar('BB_NO_NETWORK') from bb.fetch2 import FetchConnectionCache |