From 009b8c0b74b0586ec79ff21eaefa21e1f07356a0 Mon Sep 17 00:00:00 2001
From: Kevin Daudt <kdaudt@alpinelinux.org>
Date: Mon, 22 Jul 2024 15:24:23 +0000
Subject: [PATCH] community/zabbix: upgrade to 7.0.1

---
 community/zabbix/APKBUILD                     | 28 +++++--------
 community/zabbix/fix-msghdr.patch             | 40 -------------------
 community/zabbix/musl-fix-includes.patch      | 15 -------
 community/zabbix/ui-services-fix-php-80.patch | 40 -------------------
 4 files changed, 11 insertions(+), 112 deletions(-)
 delete mode 100644 community/zabbix/fix-msghdr.patch
 delete mode 100644 community/zabbix/musl-fix-includes.patch
 delete mode 100644 community/zabbix/ui-services-fix-php-80.patch

diff --git a/community/zabbix/APKBUILD b/community/zabbix/APKBUILD
index db1327f821e2..59dee1fedef3 100644
--- a/community/zabbix/APKBUILD
+++ b/community/zabbix/APKBUILD
@@ -3,8 +3,8 @@
 # Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
 # Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
 pkgname=zabbix
-pkgver=7.0.0
-pkgrel=2
+pkgver=7.0.1
+pkgrel=0
 pkgdesc="Enterprise-class open source distributed monitoring"
 url="https://www.zabbix.com/"
 arch="all"
@@ -49,7 +49,7 @@ makedepends="
 install="$pkgname.pre-install"
 pkgusers="zabbix"
 pkggroups="zabbix"
-options="!check" # no tests available
+options="net !check" # no tests available
 subpackages="
 	$pkgname-agent
 	$pkgname-agent-openrc:agent_openrc
@@ -71,11 +71,8 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/zabbix/zabbix/archive/${pkgv
 	zabbix-agent2.initd
 	zabbix-proxy.initd
 
-	fix-msghdr.patch
-	musl-fix-includes.patch
 	zabbix_server.conf.patch
 	zabbix_agent2.conf.patch
-	ui-services-fix-php-80.patch
 	"
 builddir="$srcdir/$pkgname-${pkgver/_/}"
 
@@ -241,13 +238,13 @@ webif() {
 	mkdir -p $_wwwdir
 	cp -r "$builddir"/ui/* "$_wwwdir"
 
-	# Comply with AGPL-3.0 license
-	mkdir -p "$_wwwdir"/local/conf
-	printf '<?php return ["BRAND_FOOTER" => "Zabbix %s © 2001–2024, Zabbix SIA, modified on %s, source %s",];' \
-		"$pkgver" \
-		"https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/zabbix" \
-		"$(date '+%Y-%m-%d')" \
-		>"$_wwwdir"/local/conf/brand.conf.php
+	# Comply with AGPL-3.0 license (whenever we have custom patches)
+	# mkdir -p "$_wwwdir"/local/conf
+	# printf '<?php return ["BRAND_FOOTER" => "Zabbix %s © 2001–2024, Zabbix SIA, modified on %s, source %s",];' \
+	# 	"$pkgver" \
+	# 	"$(date '+%Y-%m-%d')" \
+	# 	"https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/zabbix" \
+	# 	>"$_wwwdir"/local/conf/brand.conf.php
 }
 
 agent() {
@@ -300,15 +297,12 @@ agent2_openrc() {
 }
 
 sha512sums="
-3f00ac67f4b750922a4b8270b78913dc04f9575bd040e17b4dc8ee212c29d6052b08e7ea25c08daed6fdbf67671129e2dbcd23587a50c85b49cbf7636f4e9bab  zabbix-7.0.0.tar.gz
+b517c6a8981afcfdafe2cf568d2d2ec68b2f1c0e330725720726afd7967a27b775e7733e53871154e14f6fa6997c73ea597eb00e3c96ff5f44cc9dffe4047b79  zabbix-7.0.1.tar.gz
 9998ee172a28002d98bacc3f76038ff52b8cf2b206e101418d76b4ca3de94afaf92cb4f7a6235ecf177f74beb9dd3ea1f3983c4f164b4f60bb601acba65aa175  zabbix-server.initd
 9c06527bf653c40585fa7eeb3f7a0b2fc454031d24cd0d1633aed87b78a681c5227a193c5b9fcfcea0839135874e27ba7dd9b198573f905f680a2856f79e9512  zabbix-server.confd
 7beca0fc6e254c1692e0e74deb9eb3d06ac78f5f6b08f3ab0491861e11e09f00f57bb4d22e11517dab86456e87bd13110805bfb38a715d2f1e68549937b29c76  zabbix-agentd.initd
 fed1e11ca4d97ad348308d02dff800598748c427bc427c3d52b9bca6a9269904c83ae6be08bacccc65d3d71c6ce50f895782d0650e27244bd2bdbe4ecb807e78  zabbix-agent2.initd
 a26e7ac422ff60a4b8eed3603022c3a1bde640870bb9286ab061c3cb5c2fd7e91ddb317cb3d1cf61034adda0a080fc212ad416c9e2853a1deb03c5279753f4e2  zabbix-proxy.initd
-a519b2bced34fec74a4db0fbfdbcca832fc71b9268e30dbd3b7a9e0e0a4bce310229f3fce35f990573c8980ae60ef3cca0d54ee22d22430532e172d15c68e102  fix-msghdr.patch
-442f7dcc47129955618f8c43ff0d706dcad582725e37256477992ee10c18d93484c4180a815437ce736dbcf880cbf08cf9642b7a07e9d6c2f6aa994712ea5286  musl-fix-includes.patch
 183e2d99800d8eebb932cb31c5a3e8742ce6a15e87aec50dc49d9c20b35840eb7ede9920aa62d2c7a5e3f584f5c3df398aa08e93f98fa537a3ba6db63b472a1f  zabbix_server.conf.patch
 35ea336a8f3e0bdcec4a0cde01fcd9edfa20a94f29ca3a1905aa8a60938f34101ef8d9bdebf744a7ac53ee3b1ece4c3491def52c6bd8394ce6fed88ca93586b1  zabbix_agent2.conf.patch
-c4a0ae137f70bf477a74a43424a66a759f8828907d441213fbe5cba6e6865b3741ae625be534698423853cfaaeed9823dd537b7aa1689e2992a36ff8a5a24127  ui-services-fix-php-80.patch
 "
diff --git a/community/zabbix/fix-msghdr.patch b/community/zabbix/fix-msghdr.patch
deleted file mode 100644
index 699d745bd76d..000000000000
--- a/community/zabbix/fix-msghdr.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-musl has padding on struct msghdr fields so the designated initialiser fails with int-conversion:
-
-src/libs/zbxsysinfo/linux/net.c:115:95: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Werror=int-conversion]
-  115 |         struct msghdr           s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0};
-
-this is because the assignment becomes to padding, and the resulting struct is broken
-diff --git a/src/libs/zbxsysinfo/linux/net.c b/src/libs/zbxsysinfo/linux/net.c
-index 4b0a634..1ccc2c4 100644
---- a/src/libs/zbxsysinfo/linux/net.c
-+++ b/src/libs/zbxsysinfo/linux/net.c
-@@ -112,13 +112,27 @@ static int	find_tcp_port_by_state_nl(unsigned short port, int state, int *found)
- 
- 	struct sockaddr_nl	s_sa = { AF_NETLINK, 0, 0, 0 };
- 	struct iovec		s_io[1] = { { &request, sizeof(request) } };
--	struct msghdr		s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0};
-+	struct msghdr		s_msg;
-+	s_msg.msg_name = (void *)&s_sa;
-+	s_msg.msg_namelen = sizeof(struct sockaddr_nl);
-+	s_msg.msg_iov = s_io;
-+	s_msg.msg_iovlen = 1;
-+	s_msg.msg_control = NULL;
-+	s_msg.msg_controllen = 0;
-+	s_msg.msg_flags = 0;
- 
- 	char			buffer[BUFSIZ] = { 0 };
- 
- 	struct sockaddr_nl	r_sa = { AF_NETLINK, 0, 0, 0 };
- 	struct iovec		r_io[1] = { { buffer, BUFSIZ } };
--	struct msghdr		r_msg = { (void *)&r_sa, sizeof(struct sockaddr_nl), r_io, 1, NULL, 0, 0};
-+	struct msghdr		r_msg;
-+	r_msg.msg_name = (void *)&r_sa;
-+	r_msg.msg_namelen = sizeof(struct sockaddr_nl);
-+	r_msg.msg_iov = r_io;
-+	r_msg.msg_iovlen = 1;
-+	r_msg.msg_control = NULL;
-+	r_msg.msg_controllen = 0;
-+	r_msg.msg_flags = 0;
- 
- 	struct nlmsghdr		*r_hdr;
- 
diff --git a/community/zabbix/musl-fix-includes.patch b/community/zabbix/musl-fix-includes.patch
deleted file mode 100644
index b43b60f2cc64..000000000000
--- a/community/zabbix/musl-fix-includes.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/include/common/zbxsysinc.h b/include/common/zbxsysinc.h
-index e7632ef..37655f6 100644
---- a/include/common/zbxsysinc.h
-+++ b/include/common/zbxsysinc.h
-@@ -130,10 +130,6 @@
- #	include <sys/times.h>
- #endif
- 
--#ifdef HAVE_LINUX_KERNEL_H
--#	include <linux/kernel.h>
--#endif
--
- #ifdef HAVE_ARPA_NAMESER_H
- #	ifdef MAC_OS_X
- #		define BIND_8_COMPAT 1
diff --git a/community/zabbix/ui-services-fix-php-80.patch b/community/zabbix/ui-services-fix-php-80.patch
deleted file mode 100644
index 3ca1044ea087..000000000000
--- a/community/zabbix/ui-services-fix-php-80.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Fixes the following error due to strict_types being enabled:
-
-PHP message: PHP Fatal error:  Uncaught TypeError: array_slice(): Argument #3
-($length) must be of type ?int, string given
-
-diff --git a/ui/app/partials/service.list.edit.php b/ui/app/partials/service.list.edit.php
-index f761463..9bf13af 100644
---- a/ui/app/partials/service.list.edit.php
-+++ b/ui/app/partials/service.list.edit.php
-@@ -65,7 +65,7 @@ foreach ($data['services'] as $serviceid => $service) {
- 	if ($data['is_filtered']) {
- 		$parents = [];
- 
--		foreach (array_slice($service['parents'], 0, $data['max_in_table']) as $parent) {
-+		foreach (array_slice($service['parents'], 0, (int) $data['max_in_table']) as $parent) {
- 			if ($parents) {
- 				$parents[] = ', ';
- 			}
-@@ -82,7 +82,7 @@ foreach ($data['services'] as $serviceid => $service) {
- 
- 	$root_cause = [];
- 
--	foreach (array_slice($service['problem_events'], 0, $data['max_in_table']) as $problem_event) {
-+	foreach (array_slice($service['problem_events'], 0, (int) $data['max_in_table']) as $problem_event) {
- 		if ($root_cause) {
- 			$root_cause[] = ', ';
- 		}
-diff --git a/ui/app/partials/service.list.php b/ui/app/partials/service.list.php
-index 4af0556..1ba799c 100644
---- a/ui/app/partials/service.list.php
-+++ b/ui/app/partials/service.list.php
-@@ -78,7 +78,7 @@ foreach ($data['services'] as $serviceid => $service) {
- 
- 	$root_cause = [];
- 
--	foreach (array_slice($service['problem_events'], 0, $data['max_in_table']) as $problem_event) {
-+	foreach (array_slice($service['problem_events'], 0, (int) $data['max_in_table']) as $problem_event) {
- 		if ($root_cause) {
- 			$root_cause[] = ', ';
- 		}
-- 
GitLab