package: add host-coreutils (branch yem/host-coreutils)
cover package: add host-coreutils (branch yem/host-coreutils)
Hello All!
This series introduces host-coreutils, to be built by packages that need it, when the host system does not have a recent-enough version.
For example, support ofr ln --relative is getting more and more present in a lot of packages, like systemd. realpath is also required.
Add a new dependency check, and if the hsot lacks the required features, build host-coreutils for those packages that strictly require it.
Regards,
Yann E. MORIN.
The following changes since commit d8c86be9cd70d7e821b9571a237a1a20243f5d58
support/testing: fix python-gitdb2 test (2019-12-18 21:12:22 +0100)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to b22ede353f1065e52c6098cc1750386a5ac12fda
package/libsepol: add dependency on host-coreutils for ln --relative (2019-12-18 21:35:26 +0100)
----------------------------------------------------------------
Yann E. MORIN (5):
package/coreutils: introduce a host variant core/dependencies: check if we need to build our own host-coreutils package/systemd: add dependency on host-coreutils package/libselinux: add dependency on host-coreutils for ln --relative package/libsepol: add dependency on host-coreutils for ln --relative
package/coreutils/coreutils.mk | 14 ++++ package/libselinux/0002-revert-ln-relative.patch | 26 ------- ...emove-ln-relative-usage-in-install-pywrap.patch | 27 -------- package/libselinux/libselinux.mk | 2 +- package/libsepol/0002-revert-ln-relative.patch | 29 -------- package/libsepol/libsepol.mk | 2 +- .../0001-install-don-t-use-ln-relative.patch | 80 ---------------------- package/systemd/systemd.mk | 2 + support/dependencies/check-host-coreutils.mk | 6 ++ support/dependencies/check-host-coreutils.sh | 12 ++++ 10 files changed, 36 insertions(+), 164 deletions(-) delete mode 100644 package/libselinux/0002-revert-ln-relative.patch delete mode 100644 package/libselinux/0005-Remove-ln-relative-usage-in-install-pywrap.patch delete mode 100644 package/libsepol/0002-revert-ln-relative.patch delete mode 100644 package/systemd/0001-install-don-t-use-ln-relative.patch create mode 100644 support/dependencies/check-host-coreutils.mk create mode 100755 support/dependencies/check-host-coreutils.sh
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/5 package/coreutils: introduce a host variant
More and more packages are now depending on ln --relative, some require realpath, both of which only got introduced in "recent" versions of coreutils; older distros had a separate realpath, though, but that is not in the list of our required dependencies, and was not installed by default.
So, we introduce a minimal host variant of coreutils to provide those programs.
--- package/coreutils/coreutils.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
package/coreutils/coreutils.mk +14 -0
@@ -148,4 +148,18 @@ endef endif COREUTILS_POST_INSTALL_TARGET_HOOKS += COREUTILS_FIX_CHROOT_LOCATION +# Explicitly install ln and realpath, which we *are* insterested in. +# A lot of other programs still get installed, however, but disabling +# them does not gain much at build time, and is a loooong list that is +# difficult to maintain... +HOST_COREUTILS_CONF_OPTS = \ + --disable-acl \ + --disable-libcap \ + --disable-rpath \ + --disable-single-binary \ + --disable-xattr \ + --without-gmp \ + --enable-install-program=ln,realpath + $(eval $(autotools-package)) +$(eval $(host-autotools-package))
Signature · 1 line
2.20.1
PATCH 2/5 core/dependencies: check if we need to build our own host-coreutils
In reply to Yann E. MORIN--- support/dependencies/check-host-coreutils.mk | 6 ++++++ support/dependencies/check-host-coreutils.sh | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 support/dependencies/check-host-coreutils.mk create mode 100755 support/dependencies/check-host-coreutils.sh
support/dependencies/check-host-coreutils.mk new file +6 -0
@@ -0,0 +1,6 @@ +# Check whether the host's coreutils are up to date enough +# to provide 'ln --relative' and 'realpath'. + +ifeq (,$(call suitable-host-package,coreutils)) +BR2_COREUTILS_HOST_DEPENDENCY = host-coreutils +endif
support/dependencies/check-host-coreutils.sh new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/sh + +# Exit on the first error +set -e + +# Does ln supports the --relative/-r option? +ln --relative --help >/dev/null 2>&1 + +# Does realpath exist? +realpath --help >/dev/null 2>&1 + +echo OK
Signature · 1 line
2.20.1
PATCH 3/5 package/systemd: add dependency on host-coreutils
In reply to Yann E. MORINThis is needed as systemd has gained a dependency on realpath(1) which was introduced in coreutils too recently for our supported distro to have it (Ubuntu 14.04 does not have it from coreutils, although there is a dedicated package for it).
This also means that we now have a ln that understands --relative, so we can drop our workaround, that upstream said they would never accept anyway [0].
[0] https://github.com/systemd/systemd/pull/5682
Fixes:
http://autobuild.buildroot.org/results/a9a/a9a285e482285d062892bab0d1a2e2f89928c92d/ http://autobuild.buildroot.org/results/6f5/6f5b1065859d866af6fa719f611c3ea7f4b88760/ ...
--- .../0001-install-don-t-use-ln-relative.patch | 80 ------------------- package/systemd/systemd.mk | 2 + 2 files changed, 2 insertions(+), 80 deletions(-) delete mode 100644 package/systemd/0001-install-don-t-use-ln-relative.patch
package/systemd/0001-install-don-t-use-ln-relative.patch deleted +0 -80
@@ -1,80 +0,0 @@ -From 006b1d65fd5ea6555fcb72054ecc20234f4175db Mon Sep 17 00:00:00 2001 -From: Adam Duskett <[email protected]> -Date: Sun, 31 Dec 2017 12:46:04 -0500 -Subject: [PATCH] install: don't use ln --relative - -Oldish enterprise-class distributions have too old versions of -coreutils, with ln not supporting --relative. - -So we fake it. - -ln --relative would create minimalist relative paths, but they are not -trivial to generate. Instead, we always create paths relative to the -root, i.e.: - - ln -s --relative /usr/bin/foo /usr/sbin/foo - -would create: /usr/sbin/foo -> ../bin/foo -while we do : /usr/sbin/foo -> ../../usr/bin/foo - -Signed-off-by: "Yann E. MORIN" <[email protected]> -[aduskett at gmail.com: Added meson.build section and dirname wrapper in add-wants] -[aduskett at gmail.com: Update for systemd v237] -Signed-off-by: Adam Duskett <[email protected]> -[tpiepho at impinj.com: Fix add-wants wrapper] -Signed-off-by: Trent Piepho <[email protected]> ---- - meson.build | 2 +- - tools/meson-make-symlink.sh | 3 ++- - units/meson-add-wants.sh | 6 ++++-- - 3 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/meson.build b/meson.build -index e5ceb1e169..9d3c746da4 100644 ---- a/meson.build -+++ b/meson.build -@@ -591,7 +591,7 @@ endforeach - conf.set_quoted('TELINIT', get_option('telinit-path')) - - if run_command('ln', '--relative', '--help').returncode() != 0 -- error('ln does not support --relative (added in coreutils 8.16)') -+ message('ln does not support --relative (added in coreutils 8.16)') - endif - - ############################################################ -diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh -index da0d13a341..4917eff7d1 100755 ---- a/tools/meson-make-symlink.sh -+++ b/tools/meson-make-symlink.sh -@@ -8,5 +8,6 @@ mkdir -vp "$(dirname "${DESTDIR:-}$2")" - if [ "$(dirname $1)" = . ]; then - ln -vfs -T "$1" "${DESTDIR:-}$2" - else -- ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2" -+ dds="$( dirname "$2" |sed -r -e 's:/+[^/]+:../:g; s:/$::' )" -+ ln -vfs -T "${dds}$1" "${DESTDIR:-}$2" - fi -diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh -index a483d75b86..4642673d98 100755 ---- a/units/meson-add-wants.sh -+++ b/units/meson-add-wants.sh -@@ -14,7 +14,7 @@ case "$target" in - ;; - esac - --unitpath="${DESTDIR:-}${unitdir}/${unit}" -+unitpath="${unitdir}/${unit}" - - case "$target" in - */) -@@ -25,4 +25,6 @@ case "$target" in - ;; - esac - --ln -vfs --relative "$unitpath" "$dir" -+[ ! -d "${dir}" ] && linkdir=`dirname "${dir}"` || linkdir="${dir}" -+dds="$(printf "%s" "${linkdir#${DESTDIR:-}}" |sed -r -e 's:/+[^/]+:../:g; s:/$::')" -+ln -vfs "$dds$unitpath" "$dir" --- -2.20.1 -
package/systemd/systemd.mk +2 -0
@@ -10,6 +10,7 @@ SYSTEMD_LICENSE = LGPL-2.1+, GPL-2.0+ (udev), Public Domain (few source files, s SYSTEMD_LICENSE_FILES = LICENSE.GPL2 LICENSE.LGPL2.1 README tools/chromiumos/LICENSE SYSTEMD_INSTALL_STAGING = YES SYSTEMD_DEPENDENCIES = \ + $(BR2_COREUTILS_HOST_DEPENDENCY) \ $(if $(BR2_PACKAGE_BASH_COMPLETION),bash-completion) \ host-gperf \ kmod \
@@ -553,6 +554,7 @@ HOST_SYSTEMD_CONF_OPTS = \ -Dsysvinit-path='' HOST_SYSTEMD_DEPENDENCIES = \ + $(BR2_COREUTILS_HOST_DEPENDENCY) \ host-util-linux \ host-patchelf \ host-libcap \
Signature · 1 line
2.20.1
PATCH 4/5 package/libselinux: add dependency on host-coreutils for ln --relative
In reply to Yann E. MORIN--- .../libselinux/0002-revert-ln-relative.patch | 26 ------------------ ...-ln-relative-usage-in-install-pywrap.patch | 27 ------------------- package/libselinux/libselinux.mk | 2 +- 3 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 package/libselinux/0002-revert-ln-relative.patch delete mode 100644 package/libselinux/0005-Remove-ln-relative-usage-in-install-pywrap.patch
package/libselinux/0002-revert-ln-relative.patch deleted +0 -26
@@ -1,26 +0,0 @@ -Makefile: revert libselinux: use ln --relative to create .so symlinks - -This reverts 71393a181d63c9baae5fe8dcaeb9411d1f253998 - -ln --relative is too recent to be available in all distributions, -especially enterprise-grade distros that can stick around as long as -they are maintained (up to 10 years in some cases?). - -For the sake of Buildroot, revert the upstream patch. - -Signed-off-by: "Yann E. MORIN" <[email protected]> -Signed-off-by: Fabrice Fontaine <[email protected]> -[Update for 2.8 (with assumption that SHLIBDIR=LIBDIR)] - -diff -durNw libselinux-2.7.orig/src/Makefile libselinux-2.7/src/Makefile ---- libselinux-2.7.orig/src/Makefile 2018-01-15 20:53:50.168525700 +0100 -+++ libselinux-2.7/src/Makefile 2018-01-15 20:55:27.061858005 +0100 -@@ -181,7 +181,7 @@ - install -m 755 $(LIBSO) $(DESTDIR)$(SHLIBDIR) - test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig - install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig -- ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET) -+ cd $(DESTDIR)$(LIBDIR) && ln -sf $(LIBSO) $(TARGET) - - install-pywrap: pywrap - test -d $(DESTDIR)$(PYTHONLIBDIR)/selinux || install -m 755 -d $(DESTDIR)$(PYTHONLIBDIR)/selinux
package/libselinux/0005-Remove-ln-relative-usage-in-install-pywrap.patch deleted +0 -27
@@ -1,27 +0,0 @@ -From af2284b8510161e8742787a632ebb2aaef8fc045 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni <[email protected]> -Date: Fri, 25 Oct 2019 13:36:29 +0200 -Subject: [PATCH] Remove ln --relative usage in install-pywrap - -[Upstream: https://github.com/SELinuxProject/selinux/pull/184] -Signed-off-by: Thomas Petazzoni <[email protected]> ---- - src/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Makefile b/src/Makefile -index 2b1696a0..799df2b0 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -175,7 +175,7 @@ install: all - install-pywrap: pywrap - $(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` - install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py -- ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT) -+ cd $(DESTDIR)$(PYTHONLIBDIR) && ln -sf selinux/_selinux$(PYCEXT) _selinux$(PYCEXT) - - install-rubywrap: rubywrap - test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL) --- -2.21.0 -
package/libselinux/libselinux.mk +1 -1
@@ -9,7 +9,7 @@ LIBSELINUX_SITE = https://github.com/SELinuxProject/selinux/releases/download/20 LIBSELINUX_LICENSE = Public Domain LIBSELINUX_LICENSE_FILES = LICENSE -LIBSELINUX_DEPENDENCIES = libsepol pcre +LIBSELINUX_DEPENDENCIES = $(BR2_COREUTILS_HOST_DEPENDENCY) libsepol pcre LIBSELINUX_INSTALL_STAGING = YES
Signature · 1 line
2.20.1
PATCH 5/5 package/libsepol: add dependency on host-coreutils for ln --relative
In reply to Yann E. MORIN--- .../libsepol/0002-revert-ln-relative.patch | 29 ------------------- package/libsepol/libsepol.mk | 2 +- 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 package/libsepol/0002-revert-ln-relative.patch
package/libsepol/0002-revert-ln-relative.patch deleted +0 -29
@@ -1,29 +0,0 @@ -From 16b2b0e21e10727065042a1baabd1a887757c65c Mon Sep 17 00:00:00 2001 -From: Adam Duskett <[email protected]> -Date: Mon, 9 Oct 2017 16:29:36 -0400 -Subject: [PATCH] Makefile: revert libsepol: use ln --relative to create .so symlinks - -This reverts 71393a181d63c9baae5fe8dcaeb9411d1f253998 - -ln --relative is too recent to be available in all distributions, -especially enterprise-grade distros that can stick around as long as -they are maintained (up to 10 years in some cases?). - -For the sake of Buildroot, revert the upstream patch. - -Signed-off-by: "Yann E. MORIN" <[email protected]> -Signed-off-by: Fabrice Fontaine <[email protected]> -[Update for 2.8 (with assumption that SHLIBDIR=LIBDIR)] - -diff -durNw libsepol-2.7.orig/src/Makefile libsepol-2.7/src/Makefile ---- libsepol-2.7.orig/src/Makefile 2018-01-15 21:37:12.821831315 +0100 -+++ libsepol-2.7/src/Makefile 2018-01-15 21:38:03.838497434 +0100 -@@ -92,7 +92,7 @@ - endif - test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig - install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig -- $(LN) -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET) -+ cd $(DESTDIR)$(LIBDIR) && ln -sf $(LIBSO) $(TARGET) - - relabel: - /sbin/restorecon $(LIBINSTALL)/$(LIBSO)
package/libsepol/libsepol.mk +1 -1
@@ -11,7 +11,7 @@ LIBSEPOL_LICENSE_FILES = COPYING LIBSEPOL_INSTALL_STAGING = YES LIBSEPOL_DEPENDENCIES = host-flex -HOST_LIBSEPOL_DEPENDENCIES = host-flex +HOST_LIBSEPOL_DEPENDENCIES = $(BR2_COREUTILS_HOST_DEPENDENCY) host-flex LIBSEPOL_MAKE_FLAGS = $(TARGET_CONFIGURE_OPTS)
Signature · 1 line
2.20.1
cover package: add host-coreutils (branch yem/host-coreutils)
In reply to Yann E. MORINHello,
Quoted 6 lines · On Wed, 18 Dec 2019 21:39:04 +0100 "Yann E. MORIN" <[email protected]>…
Yann E. MORIN (5):
package/coreutils: introduce a host variant core/dependencies: check if we need to build our own host-coreutils package/systemd: add dependency on host-coreutils package/libselinux: add dependency on host-coreutils for ln --relative package/libsepol: add dependency on host-coreutils for ln --relative
Thanks, I've applied to master!
One thing that would be nice is to check if package/coreutils/0001-fix-for-dummy-man-usage.patch is still needed, and if it is, what we can do about it. It's annoying to have AUTORECONF = YES and GETTEXTIZE = YES just for this patch.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com