From b7d2861976669d4f6decc55762ba83fe0371d6d5 Mon Sep 17 00:00:00 2001 From: Andrew Geissler Date: Fri, 24 Jul 2020 16:15:54 -0500 Subject: poky: subtree update:968fcf4989..23deb29c1b Arthur She (1): igt-gpu-tools: Add PACKAGECONFIG for Chamelium support Bruce Ashfield (4): linux-yocto/5.4: update to v5.4.51 linux-yocto-rt/5.4: fix mmdrop stress test issues kernel-yocto: account for extracted defconfig in elements check kernel-devsrc: fix on-target module build for v5.8+ Changqing Li (2): dpkg: change SRC_URI to take dpkg from git gtk-immodules-cache.bbclass: fix post install scriptlet error Charlie Davies (1): u-boot: fix condition to allow use of *.cfg Chen Qi (1): rpm: fix nativesdk's default var location Christian Eggers (2): avahi: Fix typo in recipe util-linux: Set license for library sub packages Daniel Ammann (1): image.bbclass: improve wording when image size exceeds the specified limit Dmitry Baryshkov (1): gcc-10.1: add fix for PR 96130 Douglas (2): nativesdk: clear MACHINE_FEATURES nativesdk: Set the CXXFLAGS to the BUILDSDK_CXXFLAGS He Zhe (1): cryptodev-module: Backport a patch to fix build failure with kernel v5.8 Hongxu Jia (1): e2fsprogs: fix up check for hardlinks always false if inode > 0xFFFFFFFF Jens Rehsack (3): subversion: extend for nativesdk serf: extend for nativesdk kmod: add packageconfig for xz and ssl Joshua Watt (8): virtual/libgbm is the provider of gbm.pc diffoscope: upgrade 150 -> 151 python3-pycryptodomex: upgrade 3.9.7 -> 3.9.8 python3-pycryptodome: upgrade 3.9.7 -> 3.9.8 classes/reproducible: Move to library code lib/oe/reproducible: Fix error when no git HEAD classes/cmake: Fix host detection classes/package: Use HOST_OS for runtime dependencies Kamil Dziezyk (1): qemu: fix for virtfs configuration error in qemu 5.0.0 Kevin Hao (3): wic/filemap: Drop the unused block_is_unmapped() wic/filemap: Drop the unused get_unmapped_ranges() wic/filemap: Fall back to standard copy when no way to get the block map Khem Raj (4): go: Disbale CGO for riscv64 go-dep: Fix build on riscv64 musl: Update to latest tip site: Make sys_siglist default to no Konrad Weihmann (2): bitbake: pyshyacc: allow double COMMA statements ptest: append to FILES Kurt Kiefer (1): linux-firmware: add ibt-20 package Lee Chee Yang (1): bison: fix Argument list too long error Mingli Yu (1): python3: define a profile directory path Naveen Saini (3): libva: upgrade 2.7.1 -> 2.8.0 libva-initial: upgrade 2.7.1 -> 2.8.0 libva-utils: upgrade 2.7.1 -> 2.8.0 Oleksandr (1): expat: Added ptest Pierre-Jean Texier (1): u-boot: upgrade 2020.04 -> 2020.07 Rasmus Villemoes (1): cml1: Move find_cfgs() helper to cml1.bbclass Ricardo Salveti (1): sudo: set with-rundir to /run/sudo Richard Purdie (34): bitbake: fetch2: Change git fetcher not to destroy old references oeqa/selftest/sstatetests: Avoid polluting DL_DIR bitbake: server/process: Fix a rare lockfile race qemurunner: Ensure pid location is deterministic qemurunner: Add extra debug info when qemu fails to start bitbake: server/process: Ensure UI-less servers don't sit in infinite loops oeqa/utils/qemurunner: Fix missing pid file tracebacks mpfr: upgrade 4.0.2 -> 4.1.0 libuv: upgrade 1.38.0 -> 1.38.1 btrfs-tools: upgrade 5.6.1 -> 5.7 init-system-helpers: upgrade 1.57 -> 1.58 createrepo-c: upgrade 0.15.11 -> 0.16.0 mtd-utils: upgrade 2.1.1 -> 2.1.2 dpkg: upgrade 1.20.0 -> 1.20.5 python3-cython: upgrade 0.29.20 -> 0.29.21 python3-git: upgrade 3.1.3 -> 3.1.7 asciidoc: upgrade 9.0.0 -> 9.0.1 libnsl2: upgrade 1.2.0 -> 1.3.0 rpcsvc-proto: upgrade 1.4.1 -> 1.4.2 stress-ng: upgrade 0.11.14 -> 0.11.15 epiphany: upgrade 3.36.2 -> 3.36.3 ffmpeg: upgrade 4.3 -> 4.3.1 gnupg: upgrade 2.2.20 -> 2.2.21 mpg123: upgrade 1.26.1 -> 1.26.2 libevent: upgrade 2.1.11 -> 2.1.12 webkitgtk: upgrade 2.28.2 -> 2.28.3 libgcrypt: upgrade 1.8.5 -> 1.8.6 bitbake: server/process: Fix note reference -> info bitbake: cooker: Fix unmatched files handling leading to misleading warnings bitbake: build: Allow deltask to take multiple tasknames pseudo: Update to add OFC fcntl lock updates oeqa/qemurunner: Add priority/nice information for running processes bitbake: cooker: Improve multiconfig configuration error reporting bitbake: cooker: Handle multiconfig name mappings correctly Robert Yang (1): openssl: openssl-bin requires openssl-conf to run Ross Burton (9): insane: consolidate skipping of temporary do_package files perf: add PACKAGECONFIG for CoreSight support autotools: don't special-case help2man-native for dependencies flex: fix build with autoconf 2.70 nasm: fix build with autoconf 2.70 init-ifupdown: always make machine-specific insane: improve arch test messages startup-notification: add time_t type mismatch patch from upstream gcc: mitigate the Straight-line Speculation attack Sakib Sajal (5): qemu: fix CVE-2020-13362 qemu: fix CVE-2020-13659 qemu: fix CVE-2020-13800 qemu: fix CVE-2020-13791 busybox: make hwclock compatible with glibc 2.31 Tanu Kaskinen (2): alsa-lib: upgrade 1.2.3.1 -> 1.2.3.2 pulseaudio: improve the Thumb frame pointer fix Taras Kondratiuk (1): nfs-utils: use rpcgen tool from HOSTTOOLS_DIR Tim Orling (2): lib/oe/recipeutils.py: add AUTHOR; BBCLASSEXTEND scripts/lib/recipetool/create.py: fix regex strings Wang Mingyu (4): dbus: upgrade 1.12.18 -> 1.12.20 fribidi: upgrade 1.0.9 -> 1.0.10 glib-2.0: upgrade 2.64.3 -> 2.64.4 libvorbis: upgrade 1.3.6 -> 1.3.7 Yi Zhao (1): bind: upgrade 9.11.19 -> 9.11.21 Yongxin Liu (2): linux-firmware: fix the wrong file path for ibt-misc linux-firmware: move ibt-misc to the end of ibt packages akuster (3): cve-check.bbclass: always save cve report ref-system-requirements: update supported hosts lists glibc: whitelist CVE-2010-10029 zhengruoqin (1): gnutls: Fix krb5 code license to GPLv2.1+ to match the LICENSE file. Signed-off-by: Andrew Geissler Change-Id: Iae9b13b7fe09bb3c0ab953a063793c95e8b17468 --- poky/meta/classes/autotools.bbclass | 2 +- poky/meta/classes/cmake.bbclass | 19 ++++-- poky/meta/classes/cml1.bbclass | 10 +++ poky/meta/classes/cve-check.bbclass | 32 ++++++++++ poky/meta/classes/gtk-immodules-cache.bbclass | 1 + poky/meta/classes/image.bbclass | 4 +- poky/meta/classes/insane.bbclass | 25 ++++---- poky/meta/classes/kernel-yocto.bbclass | 2 +- poky/meta/classes/nativesdk.bbclass | 3 +- poky/meta/classes/package.bbclass | 10 +-- poky/meta/classes/ptest.bbclass | 2 +- poky/meta/classes/reproducible_build.bbclass | 90 +-------------------------- 12 files changed, 85 insertions(+), 115 deletions(-) (limited to 'poky/meta/classes') diff --git a/poky/meta/classes/autotools.bbclass b/poky/meta/classes/autotools.bbclass index 6c2a33ac72..1f3c771c69 100644 --- a/poky/meta/classes/autotools.bbclass +++ b/poky/meta/classes/autotools.bbclass @@ -5,7 +5,7 @@ def autotools_dep_prepend(d): pn = d.getVar('PN') deps = '' - if pn in ['autoconf-native', 'automake-native', 'help2man-native']: + if pn in ['autoconf-native', 'automake-native']: return deps deps += 'autoconf-native automake-native ' diff --git a/poky/meta/classes/cmake.bbclass b/poky/meta/classes/cmake.bbclass index 94ed8061bb..8243f7ce8c 100644 --- a/poky/meta/classes/cmake.bbclass +++ b/poky/meta/classes/cmake.bbclass @@ -70,15 +70,22 @@ CMAKE_BUILD_PARALLEL_LEVEL_task-install = "${@oe.utils.parallel_make(d, True)}" OECMAKE_TARGET_COMPILE ?= "all" OECMAKE_TARGET_INSTALL ?= "install" +def map_host_os_to_system_name(host_os): + if host_os.startswith('mingw'): + return 'Windows' + if host_os.startswith('linux'): + return 'Linux' + return host_os + # CMake expects target architectures in the format of uname(2), # which do not always match TARGET_ARCH, so all the necessary # conversions should happen here. -def map_target_arch_to_uname_arch(target_arch): - if target_arch == "powerpc": +def map_host_arch_to_uname_arch(host_arch): + if host_arch == "powerpc": return "ppc" - if target_arch == "powerpc64": + if host_arch == "powerpc64": return "ppc64" - return target_arch + return host_arch cmake_do_generate_toolchain_file() { if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then @@ -88,8 +95,8 @@ cmake_do_generate_toolchain_file() { # CMake system name must be something like "Linux". # This is important for cross-compiling. $cmake_crosscompiling -set( CMAKE_SYSTEM_NAME `echo ${TARGET_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` ) -set( CMAKE_SYSTEM_PROCESSOR ${@map_target_arch_to_uname_arch(d.getVar('TARGET_ARCH'))} ) +set( CMAKE_SYSTEM_NAME ${@map_host_os_to_system_name(d.getVar('HOST_OS'))} ) +set( CMAKE_SYSTEM_PROCESSOR ${@map_host_arch_to_uname_arch(d.getVar('HOST_ARCH'))} ) set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} ) set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} ) set( CMAKE_C_COMPILER_LAUNCHER ${OECMAKE_C_COMPILER_LAUNCHER} ) diff --git a/poky/meta/classes/cml1.bbclass b/poky/meta/classes/cml1.bbclass index c7f6723cb3..8ab240589a 100644 --- a/poky/meta/classes/cml1.bbclass +++ b/poky/meta/classes/cml1.bbclass @@ -1,3 +1,13 @@ +# returns all the elements from the src uri that are .cfg files +def find_cfgs(d): + sources=src_patches(d, True) + sources_list=[] + for s in sources: + if s.endswith('.cfg'): + sources_list.append(s) + + return sources_list + cml1_do_configure() { set -e unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS diff --git a/poky/meta/classes/cve-check.bbclass b/poky/meta/classes/cve-check.bbclass index 514897e8b8..0889e7544a 100644 --- a/poky/meta/classes/cve-check.bbclass +++ b/poky/meta/classes/cve-check.bbclass @@ -30,6 +30,9 @@ CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/nvdcve_1.1.db" CVE_CHECK_LOG ?= "${T}/cve.log" CVE_CHECK_TMP_FILE ?= "${TMPDIR}/cve_check" +CVE_CHECK_SUMMARY_DIR ?= "${LOG_DIR}/cve" +CVE_CHECK_SUMMARY_FILE_NAME ?= "cve-summary" +CVE_CHECK_SUMMARY_FILE ?= "${CVE_CHECK_SUMMARY_DIR}/${CVE_CHECK_SUMMARY_FILE_NAME}" CVE_CHECK_DIR ??= "${DEPLOY_DIR}/cve" CVE_CHECK_MANIFEST ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cve" @@ -46,6 +49,32 @@ CVE_CHECK_PN_WHITELIST ?= "" # CVE_CHECK_WHITELIST ?= "" +python cve_save_summary_handler () { + import shutil + import datetime + + cve_tmp_file = d.getVar("CVE_CHECK_TMP_FILE") + + cve_summary_name = d.getVar("CVE_CHECK_SUMMARY_FILE_NAME") + cvelogpath = d.getVar("CVE_CHECK_SUMMARY_DIR") + bb.utils.mkdirhier(cvelogpath) + + timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') + cve_summary_file = os.path.join(cvelogpath, "%s-%s.txt" % (cve_summary_name, timestamp)) + + shutil.copyfile(cve_tmp_file, cve_summary_file) + + if cve_summary_file and os.path.exists(cve_summary_file): + cvefile_link = os.path.join(cvelogpath, cve_summary_name) + + if os.path.exists(os.path.realpath(cvefile_link)): + os.remove(cvefile_link) + os.symlink(os.path.basename(cve_summary_file), cvefile_link) +} + +addhandler cve_save_summary_handler +cve_save_summary_handler[eventmask] = "bb.event.BuildCompleted" + python do_cve_check () { """ Check recipe for patched and unpatched CVEs @@ -331,5 +360,8 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data): f.write(write_string) if d.getVar("CVE_CHECK_CREATE_MANIFEST") == "1": + cvelogpath = d.getVar("CVE_CHECK_SUMMARY_DIR") + bb.utils.mkdirhier(cvelogpath) + with open(d.getVar("CVE_CHECK_TMP_FILE"), "a") as f: f.write("%s" % write_string) diff --git a/poky/meta/classes/gtk-immodules-cache.bbclass b/poky/meta/classes/gtk-immodules-cache.bbclass index 9bb0af8b26..8e783fb493 100644 --- a/poky/meta/classes/gtk-immodules-cache.bbclass +++ b/poky/meta/classes/gtk-immodules-cache.bbclass @@ -22,6 +22,7 @@ else gtk-query-immodules-2.0 > ${libdir}/gtk-2.0/2.10.0/immodules.cache fi if [ ! -z `which gtk-query-immodules-3.0` ]; then + mkdir -p ${libdir}/gtk-3.0/3.0.0 gtk-query-immodules-3.0 > ${libdir}/gtk-3.0/3.0.0/immodules.cache fi fi diff --git a/poky/meta/classes/image.bbclass b/poky/meta/classes/image.bbclass index 694b58fc9f..3b5600e550 100644 --- a/poky/meta/classes/image.bbclass +++ b/poky/meta/classes/image.bbclass @@ -548,14 +548,14 @@ def get_rootfs_size(d): if rootfs_maxsize: rootfs_maxsize_int = int(rootfs_maxsize) if base_size > rootfs_maxsize_int: - bb.fatal("The rootfs size %d(K) overrides IMAGE_ROOTFS_MAXSIZE: %d(K)" % \ + bb.fatal("The rootfs size %d(K) exceeds IMAGE_ROOTFS_MAXSIZE: %d(K)" % \ (base_size, rootfs_maxsize_int)) # Check the initramfs size against INITRAMFS_MAXSIZE (if set) if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize: initramfs_maxsize_int = int(initramfs_maxsize) if base_size > initramfs_maxsize_int: - bb.error("The initramfs size %d(K) overrides INITRAMFS_MAXSIZE: %d(K)" % \ + bb.error("The initramfs size %d(K) exceeds INITRAMFS_MAXSIZE: %d(K)" % \ (base_size, initramfs_maxsize_int)) bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should") bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n") diff --git a/poky/meta/classes/insane.bbclass b/poky/meta/classes/insane.bbclass index 649aea1da1..ee19ef673e 100644 --- a/poky/meta/classes/insane.bbclass +++ b/poky/meta/classes/insane.bbclass @@ -364,14 +364,14 @@ def package_qa_check_arch(path,name,d, elf, messages): target_os == "linux-gnu_ilp32" or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE'))) is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF") if not ((machine == elf.machine()) or is_32 or is_bpf): - package_qa_add_message(messages, "arch", "Architecture did not match (%s, expected %s) on %s" % \ - (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine), package_qa_clean_path(path,d))) + package_qa_add_message(messages, "arch", "Architecture did not match (%s, expected %s) in %s" % \ + (oe.qa.elf_machine_to_string(elf.machine()), oe.qa.elf_machine_to_string(machine), package_qa_clean_path(path, d, name))) elif not ((bits == elf.abiSize()) or is_32 or is_bpf): - package_qa_add_message(messages, "arch", "Bit size did not match (%d to %d) %s on %s" % \ - (bits, elf.abiSize(), bpn, package_qa_clean_path(path,d))) + package_qa_add_message(messages, "arch", "Bit size did not match (%d, expected %d) in %s" % \ + (elf.abiSize(), bits, package_qa_clean_path(path, d, name))) elif not ((littleendian == elf.isLittleEndian()) or is_bpf): - package_qa_add_message(messages, "arch", "Endiannes did not match (%d to %d) on %s" % \ - (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d))) + package_qa_add_message(messages, "arch", "Endiannes did not match (%d, expected %d) in %s" % \ + (elf.isLittleEndian(), littleendian, package_qa_clean_path(path,d, name))) QAPATHTEST[desktop] = "package_qa_check_desktop" def package_qa_check_desktop(path, name, d, elf, messages): @@ -459,10 +459,6 @@ def package_qa_check_buildpaths(path, name, d, elf, messages): if os.path.islink(path): return - # Ignore ipk and deb's CONTROL dir - if path.find(name + "/CONTROL/") != -1 or path.find(name + "/DEBIAN/") != -1: - return - tmpdir = bytes(d.getVar('TMPDIR'), encoding="utf-8") with open(path, 'rb') as f: file_content = f.read() @@ -1034,7 +1030,14 @@ python do_package_qa () { pkgfiles = {} for pkg in packages: pkgfiles[pkg] = [] - for walkroot, dirs, files in os.walk(os.path.join(pkgdest, pkg)): + pkgdir = os.path.join(pkgdest, pkg) + for walkroot, dirs, files in os.walk(pkgdir): + # Don't walk into top-level CONTROL or DEBIAN directories as these + # are temporary directories created by do_package. + if walkroot == pkgdir: + for control in ("CONTROL", "DEBIAN"): + if control in dirs: + dirs.remove(control) for file in files: pkgfiles[pkg].append(os.path.join(walkroot, file)) diff --git a/poky/meta/classes/kernel-yocto.bbclass b/poky/meta/classes/kernel-yocto.bbclass index 54a1a1627a..3311f6e84e 100644 --- a/poky/meta/classes/kernel-yocto.bbclass +++ b/poky/meta/classes/kernel-yocto.bbclass @@ -213,7 +213,7 @@ do_kernel_metadata() { meta_dir=$(kgit --meta) # run1: pull all the configuration fragments, no matter where they come from - elements="`echo -n ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}`" + elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} ${KERNEL_FEATURES}`" if [ -n "${elements}" ]; then echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches ${KERNEL_FEATURES} diff --git a/poky/meta/classes/nativesdk.bbclass b/poky/meta/classes/nativesdk.bbclass index 7b75710726..7f2692c51a 100644 --- a/poky/meta/classes/nativesdk.bbclass +++ b/poky/meta/classes/nativesdk.bbclass @@ -9,6 +9,7 @@ NATIVESDKLIBC ?= "libc-glibc" LIBCOVERRIDE = ":${NATIVESDKLIBC}" CLASSOVERRIDE = "class-nativesdk" MACHINEOVERRIDES = "" +MACHINE_FEATURES = "" MULTILIBS = "" @@ -57,7 +58,7 @@ EXTRA_OECONF_GCC_FLOAT = "" CPPFLAGS = "${BUILDSDK_CPPFLAGS}" CFLAGS = "${BUILDSDK_CFLAGS}" -CXXFLAGS = "${BUILDSDK_CFLAGS}" +CXXFLAGS = "${BUILDSDK_CXXFLAGS}" LDFLAGS = "${BUILDSDK_LDFLAGS}" # Change to place files in SDKPATH diff --git a/poky/meta/classes/package.bbclass b/poky/meta/classes/package.bbclass index 0af5f66733..f8dc1bb468 100644 --- a/poky/meta/classes/package.bbclass +++ b/poky/meta/classes/package.bbclass @@ -1039,7 +1039,7 @@ python split_and_strip_files () { dvar = d.getVar('PKGD') pn = d.getVar('PN') - targetos = d.getVar('TARGET_OS') + hostos = d.getVar('HOST_OS') oldcwd = os.getcwd() os.chdir(dvar) @@ -1194,7 +1194,7 @@ python split_and_strip_files () { if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'): results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, debugdir, debuglibdir, debugappend, debugsrcdir, d)) - if debugsrcdir and not targetos.startswith("mingw"): + if debugsrcdir and not hostos.startswith("mingw"): if (d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'): results = oe.utils.multiprocess_launch(splitstaticdebuginfo, staticlibs, d, extraargs=(dvar, debugstaticdir, debugstaticlibdir, debugstaticappend, debugsrcdir, d)) else: @@ -1761,7 +1761,7 @@ python package_do_shlibs() { else: shlib_pkgs = packages.split() - targetos = d.getVar('TARGET_OS') + hostos = d.getVar('HOST_OS') workdir = d.getVar('WORKDIR') @@ -1912,9 +1912,9 @@ python package_do_shlibs() { soname = None if cpath.islink(file): continue - if targetos == "darwin" or targetos == "darwin8": + if hostos == "darwin" or hostos == "darwin8": darwin_so(file, needed, sonames, renames, pkgver) - elif targetos.startswith("mingw"): + elif hostos.startswith("mingw"): mingw_dll(file, needed, sonames, renames, pkgver) elif os.access(file, os.X_OK) or lib_re.match(file): linuxlist.append(file) diff --git a/poky/meta/classes/ptest.bbclass b/poky/meta/classes/ptest.bbclass index fa4c36ec76..47611edea2 100644 --- a/poky/meta/classes/ptest.bbclass +++ b/poky/meta/classes/ptest.bbclass @@ -6,7 +6,7 @@ PTEST_PATH ?= "${libdir}/${BPN}/ptest" PTEST_BUILD_HOST_FILES ?= "Makefile" PTEST_BUILD_HOST_PATTERN ?= "" -FILES_${PN}-ptest = "${PTEST_PATH}" +FILES_${PN}-ptest += "${PTEST_PATH}" SECTION_${PN}-ptest = "devel" ALLOW_EMPTY_${PN}-ptest = "1" PTEST_ENABLED = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0', d)}" diff --git a/poky/meta/classes/reproducible_build.bbclass b/poky/meta/classes/reproducible_build.bbclass index 8da40f656a..2f3bd90b07 100644 --- a/poky/meta/classes/reproducible_build.bbclass +++ b/poky/meta/classes/reproducible_build.bbclass @@ -70,100 +70,16 @@ do_deploy_source_date_epoch[sstate-plaindirs] = "${SDE_DEPLOYDIR}" addtask do_deploy_source_date_epoch_setscene addtask do_deploy_source_date_epoch before do_configure after do_patch -def get_source_date_epoch_from_known_files(d, sourcedir): - source_date_epoch = None - newest_file = None - known_files = set(["NEWS", "ChangeLog", "Changelog", "CHANGES"]) - for file in known_files: - filepath = os.path.join(sourcedir, file) - if os.path.isfile(filepath): - mtime = int(os.lstat(filepath).st_mtime) - # There may be more than one "known_file" present, if so, use the youngest one - if not source_date_epoch or mtime > source_date_epoch: - source_date_epoch = mtime - newest_file = filepath - if newest_file: - bb.debug(1, "SOURCE_DATE_EPOCH taken from: %s" % newest_file) - return source_date_epoch - -def find_git_folder(d, sourcedir): - # First guess: WORKDIR/git - # This is the default git fetcher unpack path - workdir = d.getVar('WORKDIR') - gitpath = os.path.join(workdir, "git/.git") - if os.path.isdir(gitpath): - return gitpath - - # Second guess: ${S} - gitpath = os.path.join(sourcedir, ".git") - if os.path.isdir(gitpath): - return gitpath - - # Perhaps there was a subpath or destsuffix specified. - # Go looking in the WORKDIR - exclude = set(["build", "image", "license-destdir", "patches", "pseudo", - "recipe-sysroot", "recipe-sysroot-native", "sysroot-destdir", "temp"]) - for root, dirs, files in os.walk(workdir, topdown=True): - dirs[:] = [d for d in dirs if d not in exclude] - if '.git' in dirs: - return root - - bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir) - return None - -def get_source_date_epoch_from_git(d, sourcedir): - source_date_epoch = None - if "git://" in d.getVar('SRC_URI'): - gitpath = find_git_folder(d, sourcedir) - if gitpath: - import subprocess - source_date_epoch = int(subprocess.check_output(['git','log','-1','--pretty=%ct'], cwd=gitpath)) - bb.debug(1, "git repository: %s" % gitpath) - return source_date_epoch - -def get_source_date_epoch_from_youngest_file(d, sourcedir): - if sourcedir == d.getVar('WORKDIR'): - # These sources are almost certainly not from a tarball - return None - - # Do it the hard way: check all files and find the youngest one... - source_date_epoch = None - newest_file = None - for root, dirs, files in os.walk(sourcedir, topdown=True): - files = [f for f in files if not f[0] == '.'] - - for fname in files: - filename = os.path.join(root, fname) - try: - mtime = int(os.lstat(filename).st_mtime) - except ValueError: - mtime = 0 - if not source_date_epoch or mtime > source_date_epoch: - source_date_epoch = mtime - newest_file = filename - - if newest_file: - bb.debug(1, "Newest file found: %s" % newest_file) - return source_date_epoch - -def fixed_source_date_epoch(): - bb.debug(1, "No tarball or git repo found to determine SOURCE_DATE_EPOCH") - return 0 - python create_source_date_epoch_stamp() { + import oe.reproducible + epochfile = d.getVar('SDE_FILE') # If it exists we need to regenerate as the sources may have changed if os.path.isfile(epochfile): bb.debug(1, "Deleting existing SOURCE_DATE_EPOCH from: %s" % epochfile) os.remove(epochfile) - sourcedir = d.getVar('S') - source_date_epoch = ( - get_source_date_epoch_from_git(d, sourcedir) or - get_source_date_epoch_from_known_files(d, sourcedir) or - get_source_date_epoch_from_youngest_file(d, sourcedir) or - fixed_source_date_epoch() # Last resort - ) + source_date_epoch = oe.reproducible.get_source_date_epoch(d, d.getVar('S')) bb.debug(1, "SOURCE_DATE_EPOCH: %d" % source_date_epoch) bb.utils.mkdirhier(d.getVar('SDE_DIR')) -- cgit v1.2.3