Subject: [alpine-aports] [PATCH] community/networkmanager: upgrade to 1.16.0

From: Milan P. Stanić <[email-masked]>
Date: Tue, 2 Apr 2019 12:26:52 +0200

remove wpa_supplicant from depends
rework some patches and add needed new ones
---
 community/networkmanager/APKBUILD             | 22 ++++----
 community/networkmanager/musl-basic.patch     | 37 +++----------
 .../musl-dlopen-configure-ac.patch            | 33 ++++++++++--
 .../networkmanager/musl-fix-includes.patch    | 54 +++++++++++++++++++
 .../musl-has-not-secure-getenv.patch          | 10 ++++
 .../networkmanager/musl-network-support.patch | 16 +++---
 .../networkmanager/musl-process-util.patch    | 40 ++++++++++++++
 7 files changed, 160 insertions(+), 52 deletions(-)
 create mode 100644 community/networkmanager/musl-fix-includes.patch
 create mode 100644 community/networkmanager/musl-has-not-secure-getenv.patch
 create mode 100644 community/networkmanager/musl-process-util.patch

diff --git a/community/networkmanager/APKBUILD b/community/networkmanager/APKBUILD
index c440763503..0f99f0377d 100644
--- a/community/networkmanager/APKBUILD
+++ b/community/networkmanager/APKBUILD
@@ -1,13 +1,13 @@
 # Contributor: Stuart Cardall <[email-masked]>
 # Maintainer: 
 pkgname=networkmanager
-pkgver=1.10.12
-pkgrel=1
+pkgver=1.16.0
+pkgrel=0
 pkgdesc="network management tool"
 url="http://projects.gnome.org/NetworkManager/"
 arch="all"
 license="GPL-2.0-or-later"
-depends="dhcpcd iptables dbus wpa_supplicant"
+depends="dhcpcd iptables dbus"
 install="$pkgname.pre-install $pkgname.pre-upgrade"
 depends_dev=
 makedepends="$depends_dev
@@ -43,6 +43,9 @@ source="https://download.gnome.org/sources/NetworkManager/${pkgver:0:4}/NetworkM
 	musl-basic.patch
 	musl-network-support.patch
 	musl-dlopen-configure-ac.patch
+	musl-fix-includes.patch
+	musl-process-util.patch
+	musl-has-not-secure-getenv.patch
 	"
 options="!check"
 
@@ -86,8 +89,6 @@ build() {
 		--disable-tests \
 		--without-valgrind \
 		--disable-wimax
-	# ourLDFLAGS confuses the gir-scanner
-	unset LDFLAGS
 	make libnm-core/nm-core-enum-types.h
 	make
 }
@@ -109,10 +110,13 @@ To modify system network connections without the root password: add your user ac
 EOF
 }
 
-sha512sums="ee167caff82f5cbc9b3ae102ff628d66bf59e609d009c78d1abf1460c9f400713a9378098e609d9e827cc4ca7eebe769b58dcaeb5920c32b101e1106f7d4d299  NetworkManager-1.10.12.tar.xz
+sha512sums="e9d8365d8e59e5bc7c0bc13482139fb96b1d87183c8884e71e84eaf05fe121f2bcac519edd916bd242be4e9a9e2d2140a1065f529a9a02bda87b6d2bd4192584  NetworkManager-1.16.0.tar.xz
 a6e507260e2ceffad4cacb2b49a1d4f6b933e5ae8bc50c1bd56f828298c5dc8d9d17aa4be766faeacefbe3c6c0c748e4ef499a55bb5ee40f0f04bbf766fbbc82  networkmanager.conf
 477c4cbb6e8c4805a61cdd9442c6a951c8f96173552d943a2f21938ba0facead455f247d65b2b79d1dcdd42abc6db8a8d06c49847bf028001c99ccfca1782bbd  networkmanager.initd
 9820ed2ead0af689644842de57657bb10330a1eaff0e85b21ae9913f55e399e47d8b41b0a12956f30de80272b4424c6e55f33acbc88e156879003a260bf576f6  networkmanager.rules
-e9be48c1beba27e6f618e97d63838783e097a671773564285127393863ffc893b79660fab23beb09c62b7381fb046b2b035dc587f8715c07f376112e30c6fa56  musl-basic.patch
-1e0c519c101762c251225414e897139eee13d3556910bf9e4e86b58f0a9c298475d880be06420117960036da175fb05a5208c058a8eb4d8c424537703131ca58  musl-network-support.patch
-9120208c258f0db6cf9057f21c3b384e7ddc4b6876228cfb20475e3b6f7292025f649a77cdecd170918bec0c86f576718d62bec9dd70ebdd1ab8d48ae65cfb53  musl-dlopen-configure-ac.patch"
+966ecda70a33bc918e12085fd466a56f6d6356145dfe36b7e3456c21cb095454087e421fedb4ac48984113cdaa1eff9ab6bb9f670e40b48478da19ac576ad8f6  musl-basic.patch
+095c1d944f3274ba31435cd1af8e2affb4187bdd921a0cc0c185b59810b73cfab7919b5f551bab3d9e4644fbee8f9ac017b4c5d69a771fb68319cbefa37c71a3  musl-network-support.patch
+1b5a84cd1e0c2b40987e41b41747c0cb21fc12c6c439c114e820d7e17025222a241c44ea6b3c9388c6be3db38020e6f07f5d68977d54c5f9a4ba185c978c143b  musl-dlopen-configure-ac.patch
+226ac7bc68ebb73476169bcb9801839dda9439b7657ee1e58ffc595cdfa1c3ebb8c24285194715d0127e424bc4a2b93368721cbf6615e20cf7b37aba33f29508  musl-fix-includes.patch
+b5cd94928ca3ba1fb71aec28d9ff66f319f6d23131e02c90f1dfbfaf16c537935228a9981c95f29ffb74e91752a17801c94d09ca57b7ba98028262b9e8e5d322  musl-process-util.patch
+1e2ef2847815319a2137fa60fe5ae1954b282cbb66f70e152b67a218248e8eab284c7bb9664b5579bd9d63a415bdbbc6b68d43f6d094a0b22013297630a25041  musl-has-not-secure-getenv.patch"
diff --git a/community/networkmanager/musl-basic.patch b/community/networkmanager/musl-basic.patch
index 533ed98449..a3ad09f774 100644
--- a/community/networkmanager/musl-basic.patch
+++ b/community/networkmanager/musl-basic.patch
@@ -1,5 +1,6 @@
---- a/src/systemd/src/basic/stdio-util.h
-+++ b/src/systemd/src/basic/stdio-util.h
+Usual fix for musl libc
+--- a/shared/systemd/src/basic/stdio-util.h
++++ b/shared/systemd/src/basic/stdio-util.h
 @@ -19,7 +19,9 @@
    along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
@@ -10,45 +11,21 @@
  #include <stdarg.h>
  #include <stdio.h>
  #include <sys/types.h>
---- a/src/systemd/src/basic/util.h
-+++ b/src/systemd/src/basic/util.h
-@@ -46,6 +46,11 @@
+--- a/shared/systemd/src/basic/util.h
++++ b/shared/systemd/src/basic/util.h
+@@ -46,6 +46,12 @@
  #include "missing.h"
  #include "time-util.h"
  
 +#if !defined(__GLIBC__)
 +typedef int (*__compar_fn_t) (const void*, const void*);
 +typedef __compar_fn_t comparison_fn_t;
++typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
 +#endif
 +
  size_t page_size(void) _pure_;
  #define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
  
---- a/src/systemd/sd-adapt/nm-sd-adapt.h
-+++ b/src/systemd/sd-adapt/nm-sd-adapt.h
-@@ -134,7 +134,7 @@
- #  ifdef HAVE___SECURE_GETENV
- #    define secure_getenv __secure_getenv
- #  else
--#    error neither secure_getenv nor __secure_getenv is available
-+#    define secure_getenv getenv
- #  endif
- #endif
- 
---- a/src/systemd/src/basic/process-util.c
-+++ b/src/systemd/src/basic/process-util.c
-@@ -1018,8 +1018,9 @@
- /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
-  * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
-  * libpthread, as it is part of glibc anyway. */
--extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle);
--extern void* __dso_handle __attribute__ ((__weak__));
-+//extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle);
-+//extern void* __dso_handle __attribute__ ((__weak__));
-+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
- 
- pid_t getpid_cached(void) {
-         pid_t current_value;
 --- a/libnm-core/nm-json.c
 +++ b/libnm-core/nm-json.c
 @@ -23,6 +23,10 @@
diff --git a/community/networkmanager/musl-dlopen-configure-ac.patch b/community/networkmanager/musl-dlopen-configure-ac.patch
index 5df320b4c4..4f70664985 100644
--- a/community/networkmanager/musl-dlopen-configure-ac.patch
+++ b/community/networkmanager/musl-dlopen-configure-ac.patch
@@ -1,11 +1,34 @@
-musl: dlopen is included so LD_LIBS="" instead of LD_LIBS="none required"
+From cdd5865a6a31a593b8d33ee338638ebe3bed6391 Mon Sep 17 00:00:00 2001
+From: Beniamino Galvani <[email-masked]>
+Date: Fri, 29 Mar 2019 09:13:59 +0100
+Subject: [PATCH] build: fix searching dlopen in configure
+
+The 4th argument of AC_SEARCH_LIBS is a list of additional libraries,
+not the name of the variable to hold the result which is always
+ac_cv_search_$function. Also, we should ignore the result when it is
+"none required".
+
+Fixes: 1f2eeb85d80d ('build: rename $(LIBDL) to $(DL_LIBS) and modify detection')
+---
+ configure.ac | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 334d9272d..fc09bd461 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -275,6 +275,7 @@
+@@ -240,8 +240,9 @@ AM_CONDITIONAL(WITH_IWD, test x"${ac_with_iwd}" = x"yes")
+ dnl
  dnl Checks for libdl - on certain platforms its part of libc
  dnl
- AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
-+AS_IF([test "$ac_cv_search_dlopen" = "none required"],[ac_cv_search_dlopen=""])
- AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
+-AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
+-AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
++AC_SEARCH_LIBS([dlopen], [dl dld],
++	[test "$ac_cv_search_dlopen" = "none required" || AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen"]),
++	[])
  
  PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0],
+                   [AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/tap-driver.sh')
+-- 
+2.20.1
+
diff --git a/community/networkmanager/musl-fix-includes.patch b/community/networkmanager/musl-fix-includes.patch
new file mode 100644
index 0000000000..085a8adeaf
--- /dev/null
+++ b/community/networkmanager/musl-fix-includes.patch
@@ -0,0 +1,54 @@
+--- a/src/devices/nm-device.c
++++ b/src/devices/nm-device.c
+@@ -32,7 +32,11 @@
+ #include <arpa/inet.h>
+ #include <fcntl.h>
+ #include <linux/if_addr.h>
++#if defined(__GLIBC__)
+ #include <linux/if_arp.h>
++#else
++#include <linux/if.h>
++#endif
+ #include <linux/rtnetlink.h>
+ #include <linux/pkt_sched.h>
+
+--- a/src/nm-manager.c
++++ b/src/nm-manager.c
+@@ -26,6 +26,7 @@
+ #include <stdlib.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include <asm/types.h>
+ 
+ #include "nm-utils/nm-c-list.h"
+ 
+--- a/src/platform/nm-linux-platform.c
++++ b/src/platform/nm-linux-platform.c
+@@ -20,6 +20,7 @@
+ #include "nm-default.h"
+ 
+ #include "nm-linux-platform.h"
++#include "wpan/nm-wpan-utils.h"
+ 
+ #include <arpa/inet.h>
+ #include <dlfcn.h>
+@@ -27,7 +28,11 @@
+ #include <fcntl.h>
+ #include <libudev.h>
+ #include <linux/ip.h>
++#if defined(__GLIBC__)
+ #include <linux/if_arp.h>
++#else
++#include <linux/if.h>
++#endif
+ #include <linux/if_link.h>
+ #include <linux/if_tun.h>
+ #include <linux/if_tunnel.h>
+@@ -53,7 +58,6 @@
+ #include "nm-platform-private.h"
+ #include "wifi/nm-wifi-utils.h"
+ #include "wifi/nm-wifi-utils-wext.h"
+-#include "wpan/nm-wpan-utils.h"
+ #include "nm-utils/unaligned.h"
+ #include "nm-utils/nm-io-utils.h"
+ #include "nm-utils/nm-udev-utils.h"
diff --git a/community/networkmanager/musl-has-not-secure-getenv.patch b/community/networkmanager/musl-has-not-secure-getenv.patch
new file mode 100644
index 0000000000..074a4f2199
--- /dev/null
+++ b/community/networkmanager/musl-has-not-secure-getenv.patch
@@ -0,0 +1,10 @@
+--- a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h	2019-03-17 16:56:13.649901535 +0100
++++ b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h	2019-03-17 16:56:35.278786119 +0100
+@@ -65,7 +65,7 @@
+ #  ifdef HAVE___SECURE_GETENV
+ #    define secure_getenv __secure_getenv
+ #  else
+-#    error neither secure_getenv nor __secure_getenv is available
++#    define secure_getenv getenv
+ #  endif
+ #endif
diff --git a/community/networkmanager/musl-network-support.patch b/community/networkmanager/musl-network-support.patch
index 73c1930691..36536df67c 100644
--- a/community/networkmanager/musl-network-support.patch
+++ b/community/networkmanager/musl-network-support.patch
@@ -12,8 +12,8 @@
  #include <linux/if_infiniband.h>
  
  #include "nm-core-enum-types.h"
---- a/src/platform/wifi/wifi-utils.h
-+++ b/src/platform/wifi/wifi-utils.h
+--- a/src/platform/wifi/nm-wifi-utils.h
++++ b/src/platform/wifi/nm-wifi-utils.h
 @@ -22,7 +22,11 @@
  #ifndef __WIFI_UTILS_H__
  #define __WIFI_UTILS_H__
@@ -26,12 +26,12 @@
  
  #include "nm-dbus-interface.h"
  
---- a/src/systemd/src/basic/socket-util.h
-+++ b/src/systemd/src/basic/socket-util.h
-@@ -28,6 +28,11 @@
+--- a/shared/systemd/src/basic/socket-util.h	2019-03-16 15:41:33.287235649 +0100
++++ b/shared/systemd/src/basic/socket-util.h	2019-03-16 15:42:24.273912106 +0100
+@@ -12,6 +12,11 @@
+ #include <sys/socket.h>
+ #include <sys/types.h>
  #include <sys/un.h>
- #include <linux/netlink.h>
- #include <linux/if_packet.h>
 +#if !defined(__GLIBC__)
 +/* SIOCGSTAMPNS from linux/asm-generic.h 
 + * for src/systemd/src/libsystemd-network/sd-lldp.c */
@@ -39,4 +39,4 @@
 +#endif
  
  #include "macro.h"
- #include "util.h"
+ #include "missing_socket.h"
diff --git a/community/networkmanager/musl-process-util.patch b/community/networkmanager/musl-process-util.patch
new file mode 100644
index 0000000000..0eb0057fd6
--- /dev/null
+++ b/community/networkmanager/musl-process-util.patch
@@ -0,0 +1,40 @@
+--- a/shared/systemd/src/basic/process-util.c
++++ b/shared/systemd/src/basic/process-util.c
+@@ -21,6 +21,9 @@
+ #include <sys/wait.h>
+ #include <syslog.h>
+ #include <unistd.h>
++#ifndef __GLIBC__
++#include <pthread.h>
++#endif
+ #if 0 /* NM_IGNORED */
+ #if HAVE_VALGRIND_VALGRIND_H
+ #include <valgrind/valgrind.h>
+@@ -1168,11 +1171,13 @@ void reset_cached_pid(void) {
+         cached_pid = CACHED_PID_UNSET;
+ }
+ 
++#ifdef __GLIBC__
+ /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
+  * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
+  * libpthread, as it is part of glibc anyway. */
+ extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
+ extern void* __dso_handle _weak_;
++#endif
+ 
+ pid_t getpid_cached(void) {
+         static bool installed = false;
+@@ -1201,7 +1206,12 @@ pid_t getpid_cached(void) {
+                          * only half-documented (glibc doesn't document it but LSB does — though only superficially)
+                          * we'll check for errors only in the most generic fashion possible. */
+ 
+-                        if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) {
++                        #ifdef __GLIBC__
++                            if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) {
++                        #else
++                            if (pthread_atfork(NULL, NULL, reset_cached_pid) != 0) {
++                        #endif
++
+                                 /* OOM? Let's try again later */
+                                 cached_pid = CACHED_PID_UNSET;
+                                 return new_pid;
-- 
2.20.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---