From 27448a1a43402464afd5d8304ccdfd33686d6db7 Mon Sep 17 00:00:00 2001 From: Wang Mingyu Date: Tue, 9 Apr 2024 15:09:51 +0800 Subject: coreutils: upgrade 9.4 -> 9.5 0001-posixtm-pacify-clang-18.patch CVE-2024-0684.patch removed since they're included in 9.5 0001-local.mk-fix-cross-compiling-problem.patch remove-usr-local-lib-from-m4.patch refreshed for 9.5 License-Update: Copyright updatedto 2024. (From OE-Core rev: ee37670851c6659f3ba18654507b9923da68dac4) Signed-off-by: Wang Mingyu Signed-off-by: Richard Purdie --- ...0001-local.mk-fix-cross-compiling-problem.patch | 12 +- .../coreutils/0001-posixtm-pacify-clang-18.patch | 38 ---- .../coreutils/coreutils/CVE-2024-0684.patch | 39 ---- .../coreutils/remove-usr-local-lib-from-m4.patch | 7 +- meta/recipes-core/coreutils/coreutils_9.4.bb | 221 --------------------- meta/recipes-core/coreutils/coreutils_9.5.bb | 219 ++++++++++++++++++++ 6 files changed, 228 insertions(+), 308 deletions(-) delete mode 100644 meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch delete mode 100644 meta/recipes-core/coreutils/coreutils/CVE-2024-0684.patch delete mode 100644 meta/recipes-core/coreutils/coreutils_9.4.bb create mode 100644 meta/recipes-core/coreutils/coreutils_9.5.bb diff --git a/meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch b/meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch index 66f9a716c9..97a6357ab9 100644 --- a/meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch +++ b/meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch @@ -1,4 +1,7 @@ -Subject: local.mk: fix cross compiling problem +From 7cb2d20cfa2a27191255031d231cd41917dcffe8 Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Mon, 26 Dec 2016 16:10:35 +0800 +Subject: [PATCH] local.mk: fix cross compiling problem We meet the following error when cross compiling. | Makefile:3418: *** Recursive variable 'INSTALL' references itself (eventually). Stop. @@ -12,15 +15,12 @@ Signed-off-by: Chen Qi 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/local.mk b/src/local.mk -index 36dfa4e..c5898cc 100644 +index 96ee941..cdd47d6 100644 --- a/src/local.mk +++ b/src/local.mk -@@ -649,4 +649,4 @@ cu_install_program = @INSTALL_PROGRAM@ +@@ -704,4 +704,4 @@ cu_install_program = @INSTALL@ else cu_install_program = src/ginstall endif -INSTALL = $(cu_install_program) -c +INSTALL_PROGRAM = $(cu_install_program) --- -2.1.0 - diff --git a/meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch b/meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch deleted file mode 100644 index e6c84be3c4..0000000000 --- a/meta/recipes-core/coreutils/coreutils/0001-posixtm-pacify-clang-18.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 67c298c36f69b6906840b7584be06b7b5f33f829 Mon Sep 17 00:00:00 2001 -From: Paul Eggert -Date: Tue, 16 Jan 2024 17:21:08 -0800 -Subject: [PATCH] posixtm: pacify clang 18 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Problem reported by Khem Raj in: -https://lists.gnu.org/r/bug-gnulib/2024-01/msg00045.html -* lib/posixtm.c (posixtime): Pacify clang 18 by converting bool to int. -Arguably this is a bug in draft C2x, since the non-pointer args to -ckd_add should promote just like any other expressions do; -but that’s not clang’s fault. - -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00046.html] -Signed-off-by: Khem Raj ---- - ChangeLog | 10 ++++++++++ - lib/posixtm.c | 2 +- - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/lib/posixtm.c b/lib/posixtm.c -index ef9f55f873..a072c7cad0 100644 ---- a/lib/posixtm.c -+++ b/lib/posixtm.c -@@ -191,7 +191,7 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits) - | (tm0.tm_min ^ tm1.tm_min) - | (tm0.tm_sec ^ tm1.tm_sec))) - { -- if (ckd_add (&t, t, leapsec)) -+ if (ckd_add (&t, t, +leapsec)) - return false; - *p = t; - return true; --- -2.43.0 - diff --git a/meta/recipes-core/coreutils/coreutils/CVE-2024-0684.patch b/meta/recipes-core/coreutils/coreutils/CVE-2024-0684.patch deleted file mode 100644 index 0c68e2dce0..0000000000 --- a/meta/recipes-core/coreutils/coreutils/CVE-2024-0684.patch +++ /dev/null @@ -1,39 +0,0 @@ -From c4c5ed8f4e9cd55a12966d4f520e3a13101637d9 Mon Sep 17 00:00:00 2001 -From: Paul Eggert -Date: Tue, 16 Jan 2024 13:48:32 -0800 -Subject: [PATCH 1/1] split: do not shrink hold buffer -MIME-Version: 1.0 -Content-Type: text/plain; charset=utf8 -Content-Transfer-Encoding: 8bit - -* src/split.c (line_bytes_split): Do not shrink hold buffer. -If it’s large for this batch it’s likely to be large for the next -batch, and for ‘split’ it’s not worth the complexity/CPU hassle to -shrink it. Do not assume hold_size can be bufsize. - -CVE: CVE-2024-0684 -Upstream-Status: Backport [https://github.com/coreutils/coreutils/commit/c4c5ed8f4e9cd55a12966d4f520e3a13101637d9] -Signed-off-by: Simone Weiß ---- - src/split.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/src/split.c b/src/split.c -index 64020c859..037960a59 100644 ---- a/src/split.c -+++ b/src/split.c -@@ -809,10 +809,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize) - { - cwrite (n_out == 0, hold, n_hold); - n_out += n_hold; -- if (n_hold > bufsize) -- hold = xirealloc (hold, bufsize); - n_hold = 0; -- hold_size = bufsize; - } - - /* Output to eol if present. */ --- -2.11.4.GIT - - diff --git a/meta/recipes-core/coreutils/coreutils/remove-usr-local-lib-from-m4.patch b/meta/recipes-core/coreutils/coreutils/remove-usr-local-lib-from-m4.patch index 1a8a9b9983..718de0ab78 100644 --- a/meta/recipes-core/coreutils/coreutils/remove-usr-local-lib-from-m4.patch +++ b/meta/recipes-core/coreutils/coreutils/remove-usr-local-lib-from-m4.patch @@ -1,4 +1,4 @@ -From a26530083a29eeee910bfd606ecc621acecd547a Mon Sep 17 00:00:00 2001 +From f53ffb5b27ab7d4a4c62df00ebd6a1a6936d1709 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 3 Aug 2011 14:12:30 -0700 Subject: [PATCH] coreutils: Fix build on uclibc @@ -12,16 +12,15 @@ and make life easier for cross compilation process. Signed-off-by: Khem Raj Upstream-Status: Inappropriate [Upstream does care for AIX while we may not] - --- m4/getloadavg.m4 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4 -index 8e96965..63782a2 100644 +index 9d0236f..68f7c52 100644 --- a/m4/getloadavg.m4 +++ b/m4/getloadavg.m4 -@@ -41,18 +41,6 @@ AC_CHECK_FUNC([getloadavg], [], +@@ -46,18 +46,6 @@ if test $ac_cv_func_getloadavg != yes; then [LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes]) fi diff --git a/meta/recipes-core/coreutils/coreutils_9.4.bb b/meta/recipes-core/coreutils/coreutils_9.4.bb deleted file mode 100644 index 62ecdea6ec..0000000000 --- a/meta/recipes-core/coreutils/coreutils_9.4.bb +++ /dev/null @@ -1,221 +0,0 @@ -SUMMARY = "The basic file, shell and text manipulation utilities" -DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \ -manipulation utilities. These are the core utilities which are expected to exist on \ -every system." -HOMEPAGE = "http://www.gnu.org/software/coreutils/" -BUGTRACKER = "http://debbugs.gnu.org/coreutils" -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ - file://src/ls.c;beginline=1;endline=15;md5=b720a8b317035d66c555fc6d89e3674c \ - " -DEPENDS = "gmp libcap" -DEPENDS:class-native = "" - -inherit autotools gettext texinfo - -SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \ - file://remove-usr-local-lib-from-m4.patch \ - file://0001-local.mk-fix-cross-compiling-problem.patch \ - file://0001-posixtm-pacify-clang-18.patch \ - file://CVE-2024-0684.patch \ - file://run-ptest \ - " -SRC_URI[sha256sum] = "ea613a4cf44612326e917201bbbcdfbd301de21ffc3b59b6e5c07e040b275e52" - -# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842 -# -CVE_STATUS[CVE-2016-2781] = "disputed: runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue." - -EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}" -EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname" - -# acl and xattr are not default features -# -PACKAGECONFIG:class-target ??= "\ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \ -" - -# The lib/oe/path.py requires xattr -PACKAGECONFIG:class-native ??= "xattr" - -# oe-core builds need xattr support -PACKAGECONFIG:class-nativesdk ??= "xattr" - -# with, without, depends, rdepends -# -PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," -PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr," -PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,," -PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" -PACKAGECONFIG[openssl] = "--with-openssl=yes,--with-openssl=no,openssl" - -# [ df mktemp nice printenv base64 gets a special treatment and is not included in this -bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \ - env expand expr factor fmt fold groups head hostid id install \ - join link logname md5sum mkfifo nl nohup nproc od paste pathchk \ - pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \ - sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \ - tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes" - -# hostname gets a special treatment and is not included in this -base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \ - mknod mv pwd rm rmdir sleep stty sync touch true uname stat" - -sbindir_progs= "chroot" - -# Split stdbuf into its own package, so one can include -# coreutils-stdbuf without getting the rest of coreutils, but make -# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils" -# always provides all coreutils -PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" -FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so" -RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" - -# However, when the single-binary PACKAGECONFIG is used, stdbuf -# functionality is built into the single coreutils binary, so there's -# no point splitting /usr/bin/stdbuf to its own package. Instead, add -# an RPROVIDE so that rdepending on coreutils-stdbuf will work -# regardless of whether single-binary is in effect. -RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}" - -# Let aclocal use the relative path for the m4 file rather than the -# absolute since coreutils has a lot of m4 files, otherwise there might -# be an "Argument list too long" error when it is built in a long/deep -# directory. -acpaths = "-I ./m4" - -# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h -do_compile:prepend () { - mkdir -p ${B}/src -} - -do_install:class-native() { - autotools_do_install - # remove groups to fix conflict with shadow-native - rm -f ${D}${STAGING_BINDIR_NATIVE}/groups - # The return is a must since native doesn't need the - # do_install:append() in the below. - return -} - -do_install:append() { - for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done - - install -d ${D}${base_bindir} - [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done - - install -d ${D}${sbindir} - [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done - - # [ requires special handling because [.coreutils will cause the sed stuff - # in update-alternatives to fail, therefore use lbracket - the name used - # for the actual source file. - mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN} -} - -inherit update-alternatives - -ALTERNATIVE_PRIORITY = "100" -# Make hostname's priority higher than busybox but lower than net-tools -ALTERNATIVE_PRIORITY[hostname] = "90" -ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df" -ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1" - -ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" - -ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64" -ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}" -ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1" - -ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp" -ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}" -ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1" - -ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df" -ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}" -ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1" - -ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice" -ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}" -ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1" - -ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv" -ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}" - -ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/[" -ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}" - -ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1" -ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1" -ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1" -ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1" - -# The statx() requires glibc >= 2.28 and linux kernel >= 4.11, it doesn't work -# when glibc >= 2.28 ((Ubuntu 20.04 in docker) and kernel < 4.11 (Host OS -# CentOS 7), we can check kernel version and disable it, but that would cause -# two different signatures for coreutils-native, so disable it unconditionally -# for deterministic build. -EXTRA_OECONF:append:class-native = " ac_cv_func_statx=0" - -python __anonymous() { - for prog in d.getVar('base_bindir_progs').split(): - d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) - - for prog in d.getVar('sbindir_progs').split(): - d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog)) -} - -BBCLASSEXTEND = "native nativesdk" - -inherit ptest - -RDEPENDS:${PN}-ptest += "bash findutils gawk make perl perl-modules python3-core sed shadow" - -# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy -# may need tweaking if DEPENDS changes -# Can't use ${PN}-dev here since flags with overrides and key expansion not supported -RRECOMMENDS:coreutils-dev[nodeprrecs] = "1" -RRECOMMENDS:${PN}-dev += "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev" - -do_install_ptest () { - install -d ${D}${PTEST_PATH}/tests - cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests - sed -i 's/ginstall/install/g' `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq` - install -d ${D}${PTEST_PATH}/build-aux - install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ - install -Dm 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/config.h - cp ${B}/Makefile ${D}${PTEST_PATH}/ - cp ${S}/init.cfg ${D}${PTEST_PATH}/ - cp -r ${B}/src ${D}${PTEST_PATH}/ - cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src - sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile - sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile - sed -i '/^CC =/s/ --sysroot=.*recipe-sysroot/ /g' ${D}${PTEST_PATH}/Makefile - chmod -R 777 ${D}${PTEST_PATH} - - # Disable subcase stty-pairs.sh, it will cause test framework hang - sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile - - # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems - sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile - - # Tweak test d_type-check to use python3 instead of python - sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check - install ${B}/src/getlimits ${D}/${bindir} - - # handle multilib - sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest -} - -do_install_ptest:append:libc-musl () { - # these tests fail due to bash on musl systems - # xmalloc: cannot allocate 16146 bytes - sed -i -e '/tests\/dd\/no-allocate.sh/d' ${D}${PTEST_PATH}/Makefile - sed -i -e '/tests\/split\/line-bytes.sh/d' ${D}${PTEST_PATH}/Makefile -} -FILES:${PN}-ptest += "${bindir}/getlimits" diff --git a/meta/recipes-core/coreutils/coreutils_9.5.bb b/meta/recipes-core/coreutils/coreutils_9.5.bb new file mode 100644 index 0000000000..9a5f836ebe --- /dev/null +++ b/meta/recipes-core/coreutils/coreutils_9.5.bb @@ -0,0 +1,219 @@ +SUMMARY = "The basic file, shell and text manipulation utilities" +DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \ +manipulation utilities. These are the core utilities which are expected to exist on \ +every system." +HOMEPAGE = "http://www.gnu.org/software/coreutils/" +BUGTRACKER = "http://debbugs.gnu.org/coreutils" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ + file://src/ls.c;beginline=1;endline=15;md5=9ac94aaed7fd46fd8df7147a9e3410cb \ + " +DEPENDS = "gmp libcap" +DEPENDS:class-native = "" + +inherit autotools gettext texinfo + +SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \ + file://remove-usr-local-lib-from-m4.patch \ + file://0001-local.mk-fix-cross-compiling-problem.patch \ + file://run-ptest \ + " +SRC_URI[sha256sum] = "cd328edeac92f6a665de9f323c93b712af1858bc2e0d88f3f7100469470a1b8a" + +# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842 +# +CVE_STATUS[CVE-2016-2781] = "disputed: runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue." + +EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}" +EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname" + +# acl and xattr are not default features +# +PACKAGECONFIG:class-target ??= "\ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \ +" + +# The lib/oe/path.py requires xattr +PACKAGECONFIG:class-native ??= "xattr" + +# oe-core builds need xattr support +PACKAGECONFIG:class-nativesdk ??= "xattr" + +# with, without, depends, rdepends +# +PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," +PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr," +PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,," +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" +PACKAGECONFIG[openssl] = "--with-openssl=yes,--with-openssl=no,openssl" + +# [ df mktemp nice printenv base64 gets a special treatment and is not included in this +bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \ + env expand expr factor fmt fold groups head hostid id install \ + join link logname md5sum mkfifo nl nohup nproc od paste pathchk \ + pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \ + sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \ + tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes" + +# hostname gets a special treatment and is not included in this +base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \ + mknod mv pwd rm rmdir sleep stty sync touch true uname stat" + +sbindir_progs= "chroot" + +# Split stdbuf into its own package, so one can include +# coreutils-stdbuf without getting the rest of coreutils, but make +# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils" +# always provides all coreutils +PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" +FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so" +RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" + +# However, when the single-binary PACKAGECONFIG is used, stdbuf +# functionality is built into the single coreutils binary, so there's +# no point splitting /usr/bin/stdbuf to its own package. Instead, add +# an RPROVIDE so that rdepending on coreutils-stdbuf will work +# regardless of whether single-binary is in effect. +RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}" + +# Let aclocal use the relative path for the m4 file rather than the +# absolute since coreutils has a lot of m4 files, otherwise there might +# be an "Argument list too long" error when it is built in a long/deep +# directory. +acpaths = "-I ./m4" + +# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h +do_compile:prepend () { + mkdir -p ${B}/src +} + +do_install:class-native() { + autotools_do_install + # remove groups to fix conflict with shadow-native + rm -f ${D}${STAGING_BINDIR_NATIVE}/groups + # The return is a must since native doesn't need the + # do_install:append() in the below. + return +} + +do_install:append() { + for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done + + install -d ${D}${base_bindir} + [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done + + install -d ${D}${sbindir} + [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done + + # [ requires special handling because [.coreutils will cause the sed stuff + # in update-alternatives to fail, therefore use lbracket - the name used + # for the actual source file. + mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN} +} + +inherit update-alternatives + +ALTERNATIVE_PRIORITY = "100" +# Make hostname's priority higher than busybox but lower than net-tools +ALTERNATIVE_PRIORITY[hostname] = "90" +ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df" +ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1" + +ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" + +ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64" +ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}" +ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1" + +ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp" +ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}" +ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1" + +ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df" +ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}" +ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1" + +ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice" +ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}" +ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1" + +ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv" +ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}" + +ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/[" +ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}" + +ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1" +ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1" +ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1" +ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1" + +# The statx() requires glibc >= 2.28 and linux kernel >= 4.11, it doesn't work +# when glibc >= 2.28 ((Ubuntu 20.04 in docker) and kernel < 4.11 (Host OS +# CentOS 7), we can check kernel version and disable it, but that would cause +# two different signatures for coreutils-native, so disable it unconditionally +# for deterministic build. +EXTRA_OECONF:append:class-native = " ac_cv_func_statx=0" + +python __anonymous() { + for prog in d.getVar('base_bindir_progs').split(): + d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) + + for prog in d.getVar('sbindir_progs').split(): + d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog)) +} + +BBCLASSEXTEND = "native nativesdk" + +inherit ptest + +RDEPENDS:${PN}-ptest += "bash findutils gawk make perl perl-modules python3-core sed shadow" + +# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy +# may need tweaking if DEPENDS changes +# Can't use ${PN}-dev here since flags with overrides and key expansion not supported +RRECOMMENDS:coreutils-dev[nodeprrecs] = "1" +RRECOMMENDS:${PN}-dev += "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev" + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/tests + cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests + sed -i 's/ginstall/install/g' `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq` + install -d ${D}${PTEST_PATH}/build-aux + install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ + install -Dm 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/config.h + cp ${B}/Makefile ${D}${PTEST_PATH}/ + cp ${S}/init.cfg ${D}${PTEST_PATH}/ + cp -r ${B}/src ${D}${PTEST_PATH}/ + cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src + sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile + sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile + sed -i '/^CC =/s/ --sysroot=.*recipe-sysroot/ /g' ${D}${PTEST_PATH}/Makefile + chmod -R 777 ${D}${PTEST_PATH} + + # Disable subcase stty-pairs.sh, it will cause test framework hang + sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile + + # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems + sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile + + # Tweak test d_type-check to use python3 instead of python + sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check + install ${B}/src/getlimits ${D}/${bindir} + + # handle multilib + sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest +} + +do_install_ptest:append:libc-musl () { + # these tests fail due to bash on musl systems + # xmalloc: cannot allocate 16146 bytes + sed -i -e '/tests\/dd\/no-allocate.sh/d' ${D}${PTEST_PATH}/Makefile + sed -i -e '/tests\/split\/line-bytes.sh/d' ${D}${PTEST_PATH}/Makefile +} +FILES:${PN}-ptest += "${bindir}/getlimits" -- cgit v1.2.3-54-g00ecf