Subject: [alpine-aports] [PATCH] testing/networkmanager: update to 1.0.0

From: Stuart Cardall <[email-masked]>
Date: Tue, 28 Apr 2015 00:38:05 +0000

resubmitting with ncurses-terminfo moved from $depends_dev to
$make_depends.
---
 testing/networkmanager/APKBUILD                    | 84 +++++++++++++++-------
 testing/networkmanager/disable_set_hostname.patch  | 20 ++++++
 testing/networkmanager/musl-fix-headers.patch      | 78 --------------------
 testing/networkmanager/networkmanager.conf         |  2 +
 testing/networkmanager/networkmanager.post-install | 14 ++++
 testing/networkmanager/networkmanager.rules        |  9 +++
 testing/networkmanager/new-fix-musl-headers.patch  | 31 ++++++++
 testing/networkmanager/nm-policy-hostname.patch    | 11 ---
 8 files changed, 134 insertions(+), 115 deletions(-)
 create mode 100644 testing/networkmanager/disable_set_hostname.patch
 delete mode 100644 testing/networkmanager/musl-fix-headers.patch
 create mode 100644 testing/networkmanager/networkmanager.conf
 create mode 100644 testing/networkmanager/networkmanager.post-install
 create mode 100644 testing/networkmanager/networkmanager.rules
 create mode 100644 testing/networkmanager/new-fix-musl-headers.patch
 delete mode 100644 testing/networkmanager/nm-policy-hostname.patch

diff --git a/testing/networkmanager/APKBUILD b/testing/networkmanager/APKBUILD
index 44b5891..8f0ea9b 100644
--- a/testing/networkmanager/APKBUILD
+++ b/testing/networkmanager/APKBUILD
@@ -1,24 +1,28 @@
 # Contributor: William Pitcock <[email-masked]>
-# Maintainer: William Pitcock <[email-masked]>
+# Maintainer: Stuart Cardall <[email-masked]>
 pkgname=networkmanager
-pkgver=0.9.8.10
-_ver=0.9
-pkgrel=1
+pkgver=1.0.0
+_ver=1.0
+pkgrel=0
 pkgdesc="network management tool"
 url="http://projects.gnome.org/NetworkManager/"
 arch="all"
 license="GPL"
 depends="dhcpcd iptables dbus"
-depends_dev="dbus-glib-dev udev-dev libnl3-dev util-linux-dev linux-headers
-	polkit-dev ppp-dev zlib-dev wireless-tools-dev
-	nss-dev nspr-dev gobject-introspection-dev"
-makedepends="$depends_dev intltool"
-install=""
+depends_dev="dbus-glib-dev udev-dev libnl3-dev util-linux-dev linux-headers polkit-dev ppp-dev zlib-dev
+		wireless-tools-dev nss-dev nspr-dev gobject-introspection-dev libndp-dev libmm-glib-dev
+                modemmanager-dev newt-dev bluez-dev libsoup-dev libteam-dev rp-pppoe valgrind dnsmasq
+                openresolv dhclient vala gtk-doc"
+makedepends="$depends_dev intltool ncurses-terminfo"
+install="$pkgname.post-install"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
 source="http://ftp.gnome.org/pub/GNOME/sources/NetworkManager/$_ver/NetworkManager-$pkgver.tar.xz
-	nm-policy-hostname.patch
-	musl-fix-headers.patch
-	networkmanager.initd"
+	$pkgname.conf
+	$pkgname.initd
+	$pkgname.rules
+	new-fix-musl-headers.patch
+	disable_set_hostname.patch
+	"
 
 _builddir="$srcdir"/NetworkManager-$pkgver
 prepare() {
@@ -29,6 +33,14 @@ prepare() {
 		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
 		esac
 	done
+	# Build fails without IPTOS_CLASS_CS6 defined (required by systemd) ###
+        # http://cgit.openembedded.org/openembedded-core/commit/?id=7562021eef5b7585122c92db8b686808ebe7d85e
+	# Remove systemd functionality. This also removes many: "error: redefinition of 'struct ethhdr'"
+	local f= files=$(find src/dhcp-manager/systemd-dhcp -type f) # --without-systemd has no effect
+	files="$files $(find src/dhcp-manager -maxdepth 1 -type f -name "*-systemd.*")"
+	for f in $files; do # do NOT build --with-dbus-sys-dir=/etc/dbus-1 (nm service will crash)
+		printf "" > $f
+	done
 }
 
 build() {
@@ -38,9 +50,17 @@ build() {
 		--mandir=/usr/share/man \
 		--infodir=/usr/share/info \
 		--localstatedir=/var \
-		--enable-ifupdown \
-		--with-dhcpcd=yes \
+		--with-systemdsystemunitdir=no \
 		--enable-more-warnings=yes \
+ 		--enable-ifupdown \
+		--enable-concheck \
+ 		--with-dhcpcd=yes \
+		--with-crypto=nss \
+		--with-modem-manager-1 \
+		--with-nmtui=yes \
+		--with-wext=yes \
+		--with-resolvconf=yes \
+		--disable-wimax \
 		|| return 1
 	# ourLDFLAGS confuses the gir-scanner
 	unset LDFLAGS
@@ -59,17 +79,29 @@ package() {
 		"$pkgdir"/usr/lib/pppd/*/nm-pppd-plugin.la || return 1
 
 	mv "$pkgdir"/usr/lib/locale "$pkgdir"/usr/share/ || return 1
+
+	install -m644 -D "$srcdir/$pkgname.conf" \
+                "$pkgdir/etc/NetworkManager/NetworkManager.conf" || return 1
+	# allow plugdev users to modify connections
+	install -m644 -D "$srcdir/$pkgname.rules" \
+                "$pkgdir/usr/share/polkit-1/rules.d/01-org.freedesktop.NetworkManager.settings.modify.system.rules" || return 1
 }
 
-md5sums="aad2558887e25417c52eb2deaade2f85  NetworkManager-0.9.8.10.tar.xz
-e7437269b5eefc6aee3cf081f87d2acb  nm-policy-hostname.patch
-4b39b583fb9aa0b6b7c27e8b8d42ff86  musl-fix-headers.patch
-c1c4609f415d7288e223d8c99e2d52d3  networkmanager.initd"
-sha256sums="064d27223d3824859df12e1fb25b787fec1c68bbc864dc52a0289b9211c4c972  NetworkManager-0.9.8.10.tar.xz
-209f3a1737a4fcb1661c851127de430ddb8218c75d1d75c193bf418146d3246c  nm-policy-hostname.patch
-dece9a05b8638681995ab5cc40f5ee336cf8076bcb717b6360365f3a59e09ced  musl-fix-headers.patch
-3a67ecb96fb34b36b8da93909066a2a355aaadef2e0dda6f2ae1004e2307dc53  networkmanager.initd"
-sha512sums="8688b8dceadf87d26b76bdda76ecb0b383ecaa7991487e6f6ddc150cf311f2f0cb3487afd91f19ecde2925585e8d53c8761fd45743f25c488eff6a7811ca4200  NetworkManager-0.9.8.10.tar.xz
-45a30a76b9a5df1661ec3afa6d8890f2d56e8e080a8d0584f7f57262b20b6b997b7dfcc34eb0522e673788a584875038af4d47956743b5761f0d981e656e0560  nm-policy-hostname.patch
-7a4d31c39981142ead3943922c89b3ec1780b85be31760aec923043192301496ac8f68ded48a757610e0a301df84b725520d2170a1e17687e363c78da1d22fa6  musl-fix-headers.patch
-d312bcb4f0d99331e189494bcb9fb1262cf3356e904573f7417b4429a1b8de083b9a6d51605b88d17be14e47ce2e9a3f4ea6e444790c3ffeccfe1c1d3cdd73d9  networkmanager.initd"
+md5sums="71cae8707a90fa92e28cafbc9262b548  NetworkManager-1.0.0.tar.xz
+b722fa02f904a9c8ed0d2ec21cbfc588  networkmanager.conf
+c1c4609f415d7288e223d8c99e2d52d3  networkmanager.initd
+a39b4feaf1edecc057596be6d82ba634  networkmanager.rules
+eb52238b018c2ca9cd969facbf3e4a39  new-fix-musl-headers.patch
+4f2c03bce7febd1eede0dc2c5f8b30d9  disable_set_hostname.patch"
+sha256sums="3a66afec670c975edd9832e620b725a5f16ed267a1b9e1b2d51ef27250d85947  NetworkManager-1.0.0.tar.xz
+cd2a4b0079c0726973c1cf226c4e1cb4f2d27d02c16e0e08af7e4d6b8770423c  networkmanager.conf
+3a67ecb96fb34b36b8da93909066a2a355aaadef2e0dda6f2ae1004e2307dc53  networkmanager.initd
+01f4b833c515e88c1963a0ee56ffbf70c59c5efc4dd59a5174498d2fabfc9362  networkmanager.rules
+ea205946b52fca22b9ef8b1f3a4e89a69dca430201b5b0f441564d1659d9f295  new-fix-musl-headers.patch
+6fc7bc258ac01c2d2578f5a29e7eee55b98bbf8f32dae6d28dede7d7ee5e5c4e  disable_set_hostname.patch"
+sha512sums="7089496ce31bfdffe99c0f031b6326734d2e36b3bb9a2ed0ecbe3dad64bff0dc993b2e6bcac770b31bcfe634833bd8dbabc23d128356dbba8243a6d8fc489a5e  NetworkManager-1.0.0.tar.xz
+a6e507260e2ceffad4cacb2b49a1d4f6b933e5ae8bc50c1bd56f828298c5dc8d9d17aa4be766faeacefbe3c6c0c748e4ef499a55bb5ee40f0f04bbf766fbbc82  networkmanager.conf
+d312bcb4f0d99331e189494bcb9fb1262cf3356e904573f7417b4429a1b8de083b9a6d51605b88d17be14e47ce2e9a3f4ea6e444790c3ffeccfe1c1d3cdd73d9  networkmanager.initd
+9820ed2ead0af689644842de57657bb10330a1eaff0e85b21ae9913f55e399e47d8b41b0a12956f30de80272b4424c6e55f33acbc88e156879003a260bf576f6  networkmanager.rules
+18eff8eadcb8d47742a5c760c0c4a217d82749edc0060dc3b62e6aa0671f456de9d0c11b1669b302371410cd4036bf21aee468ed1d61e7a84afd3b694bc69984  new-fix-musl-headers.patch
+cdc8c26720b983f8afb11ee08c87aab863522633d8dc08e8cea080ed8d94378b3534aedf09efc6e7481599cfede6122b5f6a86b0b45e0a8bb653f95d4c5beaf8  disable_set_hostname.patch"
diff --git a/testing/networkmanager/disable_set_hostname.patch b/testing/networkmanager/disable_set_hostname.patch
new file mode 100644
index 0000000..773e263
--- /dev/null
+++ b/testing/networkmanager/disable_set_hostname.patch
@@ -0,0 +1,20 @@
+diff -Nur NetworkManager-0.9.0.orig/src/nm-policy.c NetworkManager-0.9.0/src/nm-policy.c
+--- NetworkManager-0.9.0.orig/src/nm-policy.c	2011-08-23 06:41:02.099686450 +0000
++++ NetworkManager-0.9.0/src/nm-policy.c	2011-08-23 06:43:38.227791737 +0000
+@@ -302,6 +302,7 @@
+ 		return;
+ 	}
+ 
++#if 0
+ 	/* Try automatically determined hostname from the best device's IP config */
+ 	if (!best4)
+ 		best4 = get_best_ip4_device (policy->manager, &best_req4);
+@@ -356,6 +357,7 @@
+ 		}
+ 	}
+ 
++#endif
+ 	/* If no automatically-configured hostname, try using the hostname from
+ 	 * when NM started up.
+ 	 */
+
diff --git a/testing/networkmanager/musl-fix-headers.patch b/testing/networkmanager/musl-fix-headers.patch
deleted file mode 100644
index 9a713c6..0000000
--- a/testing/networkmanager/musl-fix-headers.patch
+++ /dev/null
@@ -1,78 +0,0 @@
---- ./src/nm-device-ethernet.c.orig
-+++ ./src/nm-device-ethernet.c
-@@ -25,15 +25,16 @@
- #include <netinet/in.h>
- #include <string.h>
- #include <stdlib.h>
--#include <linux/sockios.h>
--#include <linux/ethtool.h>
- #include <sys/ioctl.h>
- #include <unistd.h>
--#include <linux/if.h>
- #include <errno.h>
- #include <netinet/ether.h>
- 
- #include <gudev/gudev.h>
-+
-+#include <linux/sockios.h>
-+#include <linux/ethtool.h>
-+#include <linux/if.h>
- 
- #include "nm-glib-compat.h"
- #include "nm-device-ethernet.h"
---- ./src/nm-device.c.orig
-+++ ./src/nm-device.c
-@@ -27,15 +27,12 @@
- #include <string.h>
- #include <unistd.h>
- #include <errno.h>
--#include <linux/sockios.h>
--#include <linux/ethtool.h>
- #include <sys/ioctl.h>
- #include <signal.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <arpa/inet.h>
- #include <fcntl.h>
--#include <linux/if.h>
- 
- #include "nm-glib-compat.h"
- #include "nm-device.h"
-@@ -67,6 +64,10 @@
- #include "nm-manager-auth.h"
- #include "nm-dbus-glib-types.h"
- #include "nm-dispatcher.h"
-+
-+#include <linux/if.h>
-+#include <linux/sockios.h>
-+#include <linux/ethtool.h>
- 
- static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context);
- 
---- ./src/nm-system.c.orig
-+++ ./src/nm-system.c
-@@ -40,11 +40,6 @@
- #include <resolv.h>
- #include <netdb.h>
- #include <glib.h>
--#include <linux/if.h>
--#include <linux/sockios.h>
--#include <linux/if_bonding.h>
--#include <linux/if_vlan.h>
--#include <linux/if_bridge.h>
- 
- #include "nm-system.h"
- #include "nm-device.h"
-@@ -62,6 +57,12 @@
- #include <netlink/route/link.h>
- #include <netlink/route/link/bonding.h>
- #include <netlink/route/link/vlan.h>
-+
-+#include <linux/if.h>
-+#include <linux/sockios.h>
-+#include <linux/if_bonding.h>
-+#include <linux/if_vlan.h>
-+#include <linux/if_bridge.h>
- 
- #if !HAVE_VLAN_FLAG_LOOSE_BINDING
- /* Older kernels don't have this flag */
diff --git a/testing/networkmanager/networkmanager.conf b/testing/networkmanager/networkmanager.conf
new file mode 100644
index 0000000..8da4fe0
--- /dev/null
+++ b/testing/networkmanager/networkmanager.conf
@@ -0,0 +1,2 @@
+[main]
+dhcp=dhcpcd
diff --git a/testing/networkmanager/networkmanager.post-install b/testing/networkmanager/networkmanager.post-install
new file mode 100644
index 0000000..66392d2
--- /dev/null
+++ b/testing/networkmanager/networkmanager.post-install
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+NORMAL="\033[1;0m"
+STRONG="\033[1;1m"
+GREEN="\033[1;32m"
+
+print_strong() {
+        local prompt="${STRONG}$1 ${GREEN}$2${NORMAL}"
+        printf "${prompt} %s\n"
+}
+
+print_strong "\nTo modify system network connections without the root password:" " add your user account to the 'plugdev' group.\n"
+exit 0
+
diff --git a/testing/networkmanager/networkmanager.rules b/testing/networkmanager/networkmanager.rules
new file mode 100644
index 0000000..66d21d6
--- /dev/null
+++ b/testing/networkmanager/networkmanager.rules
@@ -0,0 +1,9 @@
+// Let users in plugdev group modify NetworkManager
+polkit.addRule(function(action, subject) {
+    if (action.id == "org.freedesktop.NetworkManager.settings.modify.system" &&
+        subject.isInGroup("plugdev") && subject.active) {
+        return "yes";
+    }
+});
+
+
diff --git a/testing/networkmanager/new-fix-musl-headers.patch b/testing/networkmanager/new-fix-musl-headers.patch
new file mode 100644
index 0000000..e29f856
--- /dev/null
+++ b/testing/networkmanager/new-fix-musl-headers.patch
@@ -0,0 +1,31 @@
+## moving the <linux/xxxx> includes to below nm includes
+## no longer works in 1.0.0.
+--- NetworkManager-1.0.0/src/platform/wifi/wifi-utils.h
++++ NetworkManager-1.0.0/src/platform/wifi/wifi-utils.h.new
+@@ -22,10 +22,10 @@
+ #ifndef __WIFI_UTILS_H__
+ #define __WIFI_UTILS_H__
+ 
+-#include <net/ethernet.h>
+ #include <glib.h>
+ 
+ #include "nm-dbus-interface.h"
++#include <linux/if_ether.h>
+ 
+ typedef struct WifiData WifiData;
+
+--- NetworkManager-1.0.0/src/settings/nm-settings-connection.h
++++ NetworkManager-1.0.0/src/settings/nm-settings-connection.h.new
+@@ -22,10 +22,9 @@
+ #ifndef __NETWORKMANAGER_SETTINGS_CONNECTION_H__
+ #define __NETWORKMANAGER_SETTINGS_CONNECTION_H__
+ 
+-#include <net/ethernet.h>
+-
+ #include <nm-connection.h>
+ #include "nm-types.h"
++#include <linux/if_ether.h>
+ 
+ G_BEGIN_DECLS
+
+
diff --git a/testing/networkmanager/nm-policy-hostname.patch b/testing/networkmanager/nm-policy-hostname.patch
deleted file mode 100644
index e7a7b01..0000000
--- a/testing/networkmanager/nm-policy-hostname.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./src/nm-policy-hostname.h.orig	2013-06-10 09:31:15.721414505 +0000
-+++ ./src/nm-policy-hostname.h	2013-06-10 09:31:46.421718239 +0000
-@@ -22,6 +22,8 @@
- #ifndef NM_POLICY_HOSTNAME_H
- #define NM_POLICY_HOSTNAME_H
- 
-+#include <sys/socket.h>
-+#include <netinet/in.h>
- #include <glib.h>
- 
- gboolean nm_policy_set_system_hostname (const char *new_hostname, const char *msg);
-- 
2.3.6

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

---

From: Carlo Landmeter <[email-masked]>
Date: Tue, 28 Apr 2015 16:02:39 +0200

Im still getting: configure: error: readline library with terminfo support
is required (one of ncurses, curses, or termcap)

---

From: Carlo Landmeter <[email-masked]>
Date: Tue, 28 Apr 2015 16:07:56 +0200

Ive commited it but added readline-dev myself.