Skip to contentSkip to conversation

libnl: fix packaging mistakes

PATCH In review André Draszik 3 participants 7 messages Aug 26, 2016 – Sep 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 libnl: fix packaging mistakes

- *.la files belong into -dev packages
- the genl-ctrl-list command line utility should go to into the CLI package, so as to prevent the libnl-genl library package from pulling in all of the command line utilities (as genl-ctrl-list is linked against libnl-cli-3.so.200)

---
 meta/recipes-support/libnl/libnl_3.2.25.bb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/recipes-support/libnl/libnl_3.2.25.bb +6 -6
index cabe841..2624915 100644
@@ -25,18 +25,18 @@ FILES_${PN} = "${libdir}/libnl-3.so.* \
                ${sysconfdir}"
 RREPLACES_${PN} = "libnl2"
 RCONFLICTS_${PN} = "libnl2"
+FILES_${PN}-dev += "${libdir}/libnl/cli/*/*.la"
 FILES_${PN}-staticdev += "${libdir}/libnl/cli/*/*.a"
 
-PACKAGES += "${PN}-cli ${PN}-route ${PN}-nf ${PN}-genl ${PN}-idiag"
+PACKAGES += "${PN}-cli ${PN}-genl ${PN}-idiag ${PN}-nf ${PN}-route"
 FILES_${PN}-cli   = "${libdir}/libnl-cli-3.so.* \
                      ${libdir}/libnl/cli/*/*.so \
-                     ${libdir}/libnl/cli/*/*.la \
+                     ${sbindir}/genl-ctrl-list \
                      ${sbindir}/nl-*"
-FILES_${PN}-route = "${libdir}/libnl-route-3.so.*"
+FILES_${PN}-genl  = "${libdir}/libnl-genl-3.so.* \
+                     ${libdir}/libnl-genl.so.*"
 FILES_${PN}-idiag = "${libdir}/libnl-idiag-3.so.*"
 FILES_${PN}-nf    = "${libdir}/libnl-nf-3.so.*"
-FILES_${PN}-genl  = "${libdir}/libnl-genl-3.so.* \
-                     ${libdir}/libnl-genl.so.* \
-                     ${sbindir}/genl-ctrl-list"
+FILES_${PN}-route = "${libdir}/libnl-route-3.so.*"
 RREPLACES_${PN}-genl = "libnl-genl2 libnl-genl-3-200"
 RCONFLICTS_${PN}-genl = "libnl-genl2 libnl-genl-3-200"
Signature · 1 line
2.9.3
#1 lore raw

PATCH 2/3 libnl: update to v3.2.28

See
http://lists.infradead.org/pipermail/libnl/2016-August/002187.html
http://lists.infradead.org/pipermail/libnl/2016-August/002200.html

---
 .../libnl/{libnl_3.2.25.bb => libnl_3.2.28.bb}          | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
 rename meta/recipes-support/libnl/{libnl_3.2.25.bb => libnl_3.2.28.bb} (67%)
meta/recipes-support/libnl/libnl_3.2.28.bb renamed from meta/recipes-support/libnl/libnl_3.2.25.bb +10 -7
similarity index 67%
rename from meta/recipes-support/libnl/libnl_3.2.25.bb
rename to meta/recipes-support/libnl/libnl_3.2.28.bb
index 2624915..b792818 100644
@@ -3,20 +3,20 @@ HOMEPAGE = "http://www.infradead.org/~tgr/libnl/"
 SECTION = "libs/network"
 
 PE = "1"
-PR = "r1"
 
 LICENSE = "LGPLv2.1"
 LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
 
 DEPENDS = "flex-native bison-native"
 
-SRC_URI = "http://www.infradead.org/~tgr/${BPN}/files/${BP}.tar.gz \
+SRC_URI = "https://github.com/thom311/${BPN}/releases/download/${BPN}${@d.getVar('PV', True).replace('.','_')}/${BP}.tar.gz \
            file://fix-pktloc_syntax_h-race.patch \
            file://fix-pc-file.patch \
           "
+UPSTREAM_CHECK_URI = "https://github.com/thom311/${BPN}/releases"
 
-SRC_URI[md5sum] = "03f74d0cd5037cadc8cdfa313bbd195c"
-SRC_URI[sha256sum] = "8beb7590674957b931de6b7f81c530b85dc7c1ad8fbda015398bc1e8d1ce8ec5"
+SRC_URI[md5sum] = "bab12db1eb94a42129f712a44be91a67"
+SRC_URI[sha256sum] = "cd608992c656e8f6e3ab6c1391b162a5a51c49336b9219f7f390e61fc5437c41"
 
 inherit autotools pkgconfig
 
@@ -28,15 +28,18 @@ RCONFLICTS_${PN} = "libnl2"
 FILES_${PN}-dev += "${libdir}/libnl/cli/*/*.la"
 FILES_${PN}-staticdev += "${libdir}/libnl/cli/*/*.a"
 
-PACKAGES += "${PN}-cli ${PN}-genl ${PN}-idiag ${PN}-nf ${PN}-route"
+PACKAGES += "${PN}-cli ${PN}-genl ${PN}-idiag ${PN}-nf ${PN}-route ${PN}-xfrm"
 FILES_${PN}-cli   = "${libdir}/libnl-cli-3.so.* \
                      ${libdir}/libnl/cli/*/*.so \
-                     ${sbindir}/genl-ctrl-list \
-                     ${sbindir}/nl-*"
+                     ${bindir}/genl-ctrl-list \
+                     ${bindir}/idiag-socket-details \
+                     ${bindir}/nf-* \
+                     ${bindir}/nl-*"
 FILES_${PN}-genl  = "${libdir}/libnl-genl-3.so.* \
                      ${libdir}/libnl-genl.so.*"
 FILES_${PN}-idiag = "${libdir}/libnl-idiag-3.so.*"
 FILES_${PN}-nf    = "${libdir}/libnl-nf-3.so.*"
 FILES_${PN}-route = "${libdir}/libnl-route-3.so.*"
+FILES_${PN}-xfrm  = "${libdir}/libnl-xfrm-3.so.*"
 RREPLACES_${PN}-genl = "libnl-genl2 libnl-genl-3-200"
 RCONFLICTS_${PN}-genl = "libnl-genl2 libnl-genl-3-200"
Signature · 1 line
2.9.3
#2 lore raw

PATCH 3/3 libnl: backport musl fix (strerror_r / strerror_l)

In reply to André Draszik

musl doesn't implement the non-posix compliant, deprecated, glibc-only special version of strerror_r that libnl had been using so far.

Backport the patch(set) that switches libnl over to using strerror_l().

---
 ...01-lib-add-utility-function-nl_strerror_l.patch | 146 ++++++++
 ...to-using-strerror_l-instead-of-strerror_r.patch | 403 +++++++++++++++++++++
 ...to-using-strerror_l-instead-of-strerror_r.patch |  82 +++++
 meta/recipes-support/libnl/libnl_3.2.28.bb         |   5 +-
 4 files changed, 635 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libnl/libnl/0001-lib-add-utility-function-nl_strerror_l.patch
 create mode 100644 meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch
 create mode 100644 meta/recipes-support/libnl/libnl/0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch
meta/recipes-support/libnl/libnl/0001-lib-add-utility-function-nl_strerror_l.patch new file +146 -0
new file mode 100644
index 0000000..b734028
@@ -0,0 +1,146 @@
+From 683f27fbb68ca2028a7b3468f17164d484df2759 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <[email protected]>
+Date: Thu, 25 Aug 2016 13:14:59 +0100
+Subject: [PATCH 1/3] lib: add utility function nl_strerror_l()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+libnl currently uses strerror_r() throughout, but this is
+problematic because there is a non-standard GNU version
+implemented in glibc, and the standard POSIX version, which
+differ in signature. When using glibc, one can choose
+between the two versions using feature test macros
+_GNU_SOURCE and _POSIX_C_SOURCE.
+
+Given libnl is built using the former, we always get the
+glibc special version, and all code so far has been written
+for that non-standard version.
+
+Other C libraries like musl on the other hand only try
+to be posix compliant, and only ever provide the posix
+version of strerror_r(), which has a different signature.
+
+The alternative is to use strerror_l() rather than
+strerror_r() http://austingroupbugs.net/view.php?id=655
+- this will avoid the non-confirming versions issue
+- strerror_l() is now recommended by POSIX to replace
+  strerror_r() usage
+
+So rather than changing all uses of strerror_r() to be in
+line with posix, we are going to switch to the recommended
+interface strerror_l().
+
+Since strerror_l() is slightly more difficuly to use, we
+add a little (private) wrapper that we can use from all
+current callsites of strerror_r().
+
+Signed-off-by: André Draszik <[email protected]>
+Reviewed-by: Stephane Ayotte <[email protected]>
+Signed-off-by: Thomas Haller <[email protected]>
+---
+Upstream-Status: Backport https://github.com/thom311/libnl/commit/683f27fbb68ca2028a7b3468f17164d484df2759
+ include/Makefile.am             |  1 +
+ include/netlink-private/utils.h | 17 +++++++++++++++++
+ lib/utils.c                     | 24 ++++++++++++++++++++++++
+ libnl-3.sym                     |  5 +++++
+ 4 files changed, 47 insertions(+)
+ create mode 100644 include/netlink-private/utils.h
+
+diff --git a/include/Makefile.am b/include/Makefile.am
+index 804e984..f8b977a 100644
+--- a/include/Makefile.am
++++ b/include/Makefile.am
+@@ -166,6 +166,7 @@ noinst_HEADERS = \
+ 	netlink-private/socket.h \
+ 	netlink-private/tc.h \
+ 	netlink-private/types.h \
++	netlink-private/utils.h \
+ 	netlink-private/cache-api.h \
+ 	netlink-private/object-api.h \
+ 	netlink-private/route/link/api.h \
+diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h
+new file mode 100644
+index 0000000..77aadb3
+--- /dev/null
++++ b/include/netlink-private/utils.h
+@@ -0,0 +1,17 @@
++/*
++ * netlink-private/utils.h	Local Utility Functions
++ *
++ *	This library is free software; you can redistribute it and/or
++ *	modify it under the terms of the GNU Lesser General Public
++ *	License as published by the Free Software Foundation version 2.1
++ *	of the License.
++ *
++ * Copyright (c) 2003-2012 Thomas Graf <[email protected]>
++ */
++
++#ifndef NETLINK_UTILS_PRIV_H_
++#define NETLINK_UTILS_PRIV_H_
++
++extern const char *	nl_strerror_l(int err);
++
++#endif
+diff --git a/lib/utils.c b/lib/utils.c
+index 61c3d95..c1c1b72 100644
+--- a/lib/utils.c
++++ b/lib/utils.c
+@@ -25,10 +25,12 @@
+  */
+ 
+ #include <netlink-private/netlink.h>
++#include <netlink-private/utils.h>
+ #include <netlink/netlink.h>
+ #include <netlink/utils.h>
+ #include <linux/socket.h>
+ #include <stdlib.h> /* exit() */
++#include <locale.h>
+ 
+ /**
+  * Global variable indicating the desired level of debugging output.
+@@ -118,6 +120,28 @@ int __nl_read_num_str_file(const char *path, int (*cb)(long, const char *))
+ 
+ 	return 0;
+ }
++
++const char *nl_strerror_l(int err)
++{
++	int errno_save = errno;
++	locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
++	const char *buf;
++
++	if (loc == (locale_t)0) {
++		if (errno == ENOENT)
++			loc = newlocale(LC_MESSAGES_MASK,
++					"POSIX", (locale_t)0);
++	}
++	if (loc != (locale_t)0) {
++		buf = strerror_l(err, loc);
++		freelocale(loc);
++	} else {
++		buf = "newlocale() failed";
++	}
++
++	errno = errno_save;
++	return buf;
++}
+ /** @endcond */
+ 
+ /**
+diff --git a/libnl-3.sym b/libnl-3.sym
+index 4e09bdd..9119e66 100644
+--- a/libnl-3.sym
++++ b/libnl-3.sym
+@@ -351,3 +351,8 @@ libnl_3_2_28 {
+ global:
+ 	nl_object_diff64;
+ } libnl_3_2_27;
++
++libnl_3_2_29 {
++global:
++	nl_strerror_l;
++} libnl_3_2_28;
+-- 
+2.9.3
+
meta/recipes-support/libnl/libnl/0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch new file +403 -0

403 lines not on this page · raw message

meta/recipes-support/libnl/libnl/0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch new file +82 -0

82 lines not on this page · raw message

meta/recipes-support/libnl/libnl_3.2.28.bb +4 -1
index b792818..7ddbd40 100644
@@ -12,7 +12,10 @@ DEPENDS = "flex-native bison-native"
 SRC_URI = "https://github.com/thom311/${BPN}/releases/download/${BPN}${@d.getVar('PV', True).replace('.','_')}/${BP}.tar.gz \
            file://fix-pktloc_syntax_h-race.patch \
            file://fix-pc-file.patch \
-          "
+           file://0001-lib-add-utility-function-nl_strerror_l.patch \
+           file://0002-lib-switch-to-using-strerror_l-instead-of-strerror_r.patch \
+           file://0003-src-switch-to-using-strerror_l-instead-of-strerror_r.patch \
+"
 UPSTREAM_CHECK_URI = "https://github.com/thom311/${BPN}/releases"
 
 SRC_URI[md5sum] = "bab12db1eb94a42129f712a44be91a67"
Signature · 1 line
2.9.3
#3 lore raw
In reply to André Draszik

this series looks ok to me.

Quoted 41 lines · André Draszik

- *.la files belong into -dev packages
- the genl-ctrl-list command line utility should go to into the CLI package, so as to prevent the libnl-genl library package from pulling in all of the command line utilities (as genl-ctrl-list is linked against libnl-cli-3.so.200)

---
 meta/recipes-support/libnl/libnl_3.2.25.bb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/recipes-support/libnl/libnl_3.2.25.bb +6 -6
index cabe841..2624915 100644
@@ -25,18 +25,18 @@ FILES_${PN} = "${libdir}/libnl-3.so.* \
                ${sysconfdir}"
 RREPLACES_${PN} = "libnl2"
 RCONFLICTS_${PN} = "libnl2"
+FILES_${PN}-dev += "${libdir}/libnl/cli/*/*.la"
 FILES_${PN}-staticdev += "${libdir}/libnl/cli/*/*.a"
 
-PACKAGES += "${PN}-cli ${PN}-route ${PN}-nf ${PN}-genl ${PN}-idiag"
+PACKAGES += "${PN}-cli ${PN}-genl ${PN}-idiag ${PN}-nf ${PN}-route"
 FILES_${PN}-cli   = "${libdir}/libnl-cli-3.so.* \
                      ${libdir}/libnl/cli/*/*.so \
-                     ${libdir}/libnl/cli/*/*.la \
+                     ${sbindir}/genl-ctrl-list \
                      ${sbindir}/nl-*"
-FILES_${PN}-route = "${libdir}/libnl-route-3.so.*"
+FILES_${PN}-genl  = "${libdir}/libnl-genl-3.so.* \
+                     ${libdir}/libnl-genl.so.*"
 FILES_${PN}-idiag = "${libdir}/libnl-idiag-3.so.*"
 FILES_${PN}-nf    = "${libdir}/libnl-nf-3.so.*"
-FILES_${PN}-genl  = "${libdir}/libnl-genl-3.so.* \
-                     ${libdir}/libnl-genl.so.* \
-                     ${sbindir}/genl-ctrl-list"
+FILES_${PN}-route = "${libdir}/libnl-route-3.so.*"
 RREPLACES_${PN}-genl = "libnl-genl2 libnl-genl-3-200"
 RCONFLICTS_${PN}-genl = "libnl-genl2 libnl-genl-3-200"
#4 lore raw
In reply to André Draszik

Hi André,

It seems that this series cause errors when multilib:

https://autobuilder.yoctoproject.org/main/builders/nightly-multilib/builds/930/steps/BuildImages_2/logs/stdio

// Robert

Quoted 41 lines · André Draszik

- *.la files belong into -dev packages
- the genl-ctrl-list command line utility should go to into the CLI package, so as to prevent the libnl-genl library package from pulling in all of the command line utilities (as genl-ctrl-list is linked against libnl-cli-3.so.200)

---
 meta/recipes-support/libnl/libnl_3.2.25.bb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/recipes-support/libnl/libnl_3.2.25.bb +6 -6
index cabe841..2624915 100644
@@ -25,18 +25,18 @@ FILES_${PN} = "${libdir}/libnl-3.so.* \
                ${sysconfdir}"
 RREPLACES_${PN} = "libnl2"
 RCONFLICTS_${PN} = "libnl2"
+FILES_${PN}-dev += "${libdir}/libnl/cli/*/*.la"
 FILES_${PN}-staticdev += "${libdir}/libnl/cli/*/*.a"
 
-PACKAGES += "${PN}-cli ${PN}-route ${PN}-nf ${PN}-genl ${PN}-idiag"
+PACKAGES += "${PN}-cli ${PN}-genl ${PN}-idiag ${PN}-nf ${PN}-route"
 FILES_${PN}-cli   = "${libdir}/libnl-cli-3.so.* \
                      ${libdir}/libnl/cli/*/*.so \
-                     ${libdir}/libnl/cli/*/*.la \
+                     ${sbindir}/genl-ctrl-list \
                      ${sbindir}/nl-*"
-FILES_${PN}-route = "${libdir}/libnl-route-3.so.*"
+FILES_${PN}-genl  = "${libdir}/libnl-genl-3.so.* \
+                     ${libdir}/libnl-genl.so.*"
 FILES_${PN}-idiag = "${libdir}/libnl-idiag-3.so.*"
 FILES_${PN}-nf    = "${libdir}/libnl-nf-3.so.*"
-FILES_${PN}-genl  = "${libdir}/libnl-genl-3.so.* \
-                     ${libdir}/libnl-genl.so.* \
-                     ${sbindir}/genl-ctrl-list"
+FILES_${PN}-route = "${libdir}/libnl-route-3.so.*"
 RREPLACES_${PN}-genl = "libnl-genl2 libnl-genl-3-200"
 RCONFLICTS_${PN}-genl = "libnl-genl2 libnl-genl-3-200"