[v5,04/11] util-linux: one package per binary (pt 1b: symlinks)

Submitted by André Draszik on Feb. 4, 2019, 10:05 a.m. | Patch ID: 158476

Details

Message ID 20190204100552.25880-5-git@andred.net
State Accepted
Commit fc709be54fee06801446774ff1a434294c2eda9b
Headers show

Commit Message

André Draszik Feb. 4, 2019, 10:05 a.m.
From: André Draszik <andre.draszik@jci.com>

Some of the binaries have symlinks. Add them to the
package owning the binary they are pointing to.

Signed-off-by: André Draszik <andre.draszik@jci.com>
---
 meta/recipes-core/util-linux/util-linux.inc | 22 +++++++++++++++++++++
 1 file changed, 22 insertions(+)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index b8b3298239..bc693a41b4 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -52,6 +52,28 @@  python util_linux_binpackages () {
                           file_regex=r'(.*)', output_pattern='${PN}-%s',
                           description='${PN} %s',
                           hook=pkg_hook, extra_depends='', prepend=True)
+
+    # There are some symlinks for some binaries which we have ignored
+    # above. Add them to the package owning the binary they are
+    # pointing to
+    extras = {}
+    dvar = d.getVar('PKGD')
+    for root in [ '${base_sbindir}' ]:
+        root = d.expand(root)
+        for walkroot, dirs, files in os.walk(dvar + root):
+            for f in files:
+                file = os.path.join(walkroot, f)
+                if not os.path.islink(file):
+                    continue
+
+                pkg = os.path.basename(os.readlink(file))
+                extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1)
+
+    pn = d.getVar('PN')
+    for pkg, links in extras.items():
+        of = d.getVar('FILES_' + pn + '-' + pkg)
+        links = of + links
+        d.setVar('FILES_' + pn + '-' + pkg, links)
 }
 
 # we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS

Comments

André Draszik Feb. 5, 2019, 1:33 p.m.
This is a system generated Comment: Patch 158476 was automatically marked as superseded by patch 158515.