All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] glibc: move ld.so.conf back to main package
@ 2020-05-18 11:36 Rasmus Villemoes
  2020-05-18 11:55 ` Martin Jansa
  2020-06-02 10:02 ` ✗ patchtest: failure for glibc: move ld.so.conf back to main package (rev2) Patchwork
  0 siblings, 2 replies; 9+ messages in thread
From: Rasmus Villemoes @ 2020-05-18 11:36 UTC (permalink / raw)
  To: openembedded-core
  Cc: Richard Purdie, Martin Jansa, Khem Raj, Andreas Oberritter,
	Rasmus Villemoes

There are cases where one doesn't want ldconfig on target (e.g. for
read-only root filesystems, it's rather pointless), yet one still
needs ld.so.conf to be present at image build time:

When some recipe installs libraries to a non-standard location, and
dutifully drops in a file in /etc/ld.so.conf.d/foo.conf, we need the
ld.so.conf containing the

  include /etc/ld.so.conf.d/*.conf

stanza to get those other locations picked up.

So change the packaging logic so that there's always an ld.so.conf
present when the build-time ldconfig runs, then delete it (and the .d
directory) when they would serve no purpose at run-time.

While here, fix a typo in the bb.note so one can just copy-paste the
line from the log-file and redo the command.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 meta/lib/oe/rootfs.py                     | 11 ++++++++++-
 meta/recipes-core/glibc/glibc-package.inc |  4 ++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index cd65e62030..0ff4278d15 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -297,9 +297,18 @@ class Rootfs(object, metaclass=ABCMeta):
 
     def _run_ldconfig(self):
         if self.d.getVar('LDCONFIGDEPEND'):
-            bb.note("Executing: ldconfig -r" + self.image_rootfs + "-c new -v")
+            bb.note("Executing: ldconfig -r " + self.image_rootfs + " -c new -v")
             self._exec_shell_cmd(['ldconfig', '-r', self.image_rootfs, '-c',
                                   'new', '-v'])
+        # If DISTRO_FEATURES doesn't contain ldconfig, and the
+        # ldconfig binary hasn't been pulled in explicitly, remove the
+        # configuration file(s) from the image.
+        keep_conf = bb.utils.contains("DISTRO_FEATURES", "ldconfig", True, False, self.d)
+        keep_conf = keep_conf or os.path.exists(os.path.join(self.image_rootfs, self.d.getVar('base_sbindir'), 'ldconfig'))
+        if not keep_conf:
+            sysconfdir = os.path.join(self.image_rootfs, self.d.getVar('sysconfdir'))
+            bb.utils.remove(os.path.join(sysconfdir, 'ld.so.conf'))
+            bb.utils.remove(os.path.join(sysconfdir, 'ld.so.conf.d'), recurse=True)
 
     def _check_for_kernel_modules(self, modules_dir):
         for root, dirs, files in os.walk(modules_dir, topdown=True):
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index aa8e059216..387e90a0ab 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -23,9 +23,9 @@ ARCH_DYNAMIC_LOADER_aarch64 = "ld-linux-${TARGET_ARCH}.so.1"
 libc_baselibs_append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}"
 INSANE_SKIP_${PN}_append_aarch64 = " libdir"
 
-FILES_${PN} = "${libc_baselibs} ${libexecdir}/*"
+FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
 RRECOMMENDS_${PN} = "${@bb.utils.filter('DISTRO_FEATURES', 'ldconfig', d)}"
-FILES_ldconfig = "${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf"
+FILES_ldconfig = "${base_sbindir}/ldconfig"
 FILES_ldd = "${bindir}/ldd"
 FILES_libsegfault = "${base_libdir}/libSegFault*"
 FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*"
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-02 10:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 11:36 [PATCH] glibc: move ld.so.conf back to main package Rasmus Villemoes
2020-05-18 11:55 ` Martin Jansa
2020-05-18 12:12   ` Rasmus Villemoes
2020-05-18 12:23     ` [OE-core] " Phil Blundell
2020-05-18 12:29     ` Andreas Oberritter
2020-05-18 13:25       ` Rasmus Villemoes
2020-05-18 14:36         ` Andreas Oberritter
2020-06-02  9:44           ` [PATCH v2] " Rasmus Villemoes
2020-06-02 10:02 ` ✗ patchtest: failure for glibc: move ld.so.conf back to main package (rev2) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.