summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2016-09-03 16:40:01 +0100
committerBertrand Jacquin <bertrand@jacquin.bzh>2016-09-04 00:07:33 +0100
commit38ec7da15b5cc9520ac2c1e464d9154d9c746e18 (patch)
treec7b013635538ef74fb794fc59f993f5647624db2
parentmedia-video/flvmeta: Move to EAPI 6 (diff)
downloadportage-38ec7da15b5cc9520ac2c1e464d9154d9c746e18.tar.xz
net-analyzer/nagios-check_varnish: Move to EAPI 6
Package-Manager: portage-2.2.28
-rw-r--r--net-analyzer/nagios-check_varnish/Manifest6
-rw-r--r--net-analyzer/nagios-check_varnish/files/1.1-Attempt-at-fixing-4.1-compat.patch96
-rw-r--r--net-analyzer/nagios-check_varnish/files/1.1-Improve-help-output-to-differentiate-between-v3-and-.patch41
-rw-r--r--net-analyzer/nagios-check_varnish/files/1.1-Make-gcc-explicitly-link-libm.-Fix-10.patch21
-rw-r--r--net-analyzer/nagios-check_varnish/files/1.1-add-support-for-varnish-4.patch130
-rw-r--r--net-analyzer/nagios-check_varnish/nagios-check_varnish-1.1.ebuild15
6 files changed, 304 insertions, 5 deletions
diff --git a/net-analyzer/nagios-check_varnish/Manifest b/net-analyzer/nagios-check_varnish/Manifest
index 0314bff4..1e1048b0 100644
--- a/net-analyzer/nagios-check_varnish/Manifest
+++ b/net-analyzer/nagios-check_varnish/Manifest
@@ -1,3 +1,7 @@
+AUX 1.1-Attempt-at-fixing-4.1-compat.patch 3457 SHA256 455aa1d169162d10f4e8502c01cc096924b25bea2a9354c4ff2e7757262a7687 WHIRLPOOL 311253af36bbdc52657cb1ecac8f3e3570e300d1a8bb704540bcf2a041ced971ec270f3a1485cf86a62ed98f37d7282f243884c2b2db6f033ad39ab7b14c5020
+AUX 1.1-Improve-help-output-to-differentiate-between-v3-and-.patch 1871 SHA256 1983b29d9859d10448b90928dedc091c52325235d83aed3b8b434a3862f8873c WHIRLPOOL 1cd6c832cff546df89bed6137d594cb7056cd99dbea9e2f134ab51a01274245d65a765648658ef1587ecf8f9ebb449c5b0de10575e63829822aaa017c1292d18
+AUX 1.1-Make-gcc-explicitly-link-libm.-Fix-10.patch 687 SHA256 772b8217621f4e77f3775877d0f8829e2c896430d161b5fdd0d7cde4d1eb0822 WHIRLPOOL a3578e1a86afed3227fe6d85bce88575ee20c4d8068b97fdfae3e1f39bb8159b7be88230651f794c3c7987999f0795489fc42bd15e22639b1835fbf2b0f45a71
+AUX 1.1-add-support-for-varnish-4.patch 4036 SHA256 667c702cac335a43431dd600bde4ebe77c3f3debe92326abf6695a6fd2caa28b WHIRLPOOL 1c1511414a953657165af495cd252f3294afee1f46e05b62653cb0091f1c35f24711a7fec3c3e5b5adf1897dd18adbb098e9f6b66bd13ad98ef841371d9c7cfa
DIST varnish-nagios-1.1.tar.gz 297915 SHA256 5a517b490edeb1a1362e53d0320eda42fb2360ee0261e6277b1df7c2c819871d WHIRLPOOL 68c6989bf31e58dc245320ae75774ce2bdd4804d7e2e13549d2d998ff5146d00fda9de7ef6034d27a1b7942cb16c8796a385d9ec7b0fe2e64f39da4b946c8964
-EBUILD nagios-check_varnish-1.1.ebuild 581 SHA256 80a4f06379e5493b6c74750da020084337882e12e494285f109102875a274877 WHIRLPOOL 93244ab41c4f8ca0317bc8b2e98582980bc388ebf9bbe467c23fe51964fea948aaabb276523e1b42e5af635f6d4d8ebd636dba427666cc8b835e784dbe33d8ae
+EBUILD nagios-check_varnish-1.1.ebuild 877 SHA256 6ff41f61e0de14d2aaf98a0245881ab0630d5a798930ef3f9873c33658f70bdc WHIRLPOOL 636c7a1a512fd4f04aa0884e70b9b850923829814c76a2a3b042cfab90f59dee35fdd6eebfa2ef4654012ad194c2d5006c8ea275183c8c14bb9a4723272e9ef4
MISC metadata.xml 256 SHA256 6ca43960767ca28661abf97c85263db77fe7643902be2ce777c61aa688d8ea2d WHIRLPOOL cef8582829111be09e651eb819e6d1ea59c9c4386b842169ccd46a14c8e3ccb090486fecd61c5fd4aa47998cacc69cdc1fb5ca6bb6325a4da1ebfd0b6eebda7b
diff --git a/net-analyzer/nagios-check_varnish/files/1.1-Attempt-at-fixing-4.1-compat.patch b/net-analyzer/nagios-check_varnish/files/1.1-Attempt-at-fixing-4.1-compat.patch
new file mode 100644
index 00000000..16469d4c
--- /dev/null
+++ b/net-analyzer/nagios-check_varnish/files/1.1-Attempt-at-fixing-4.1-compat.patch
@@ -0,0 +1,96 @@
+From 63505e40df567ec3623986051fe7146f63ac04e0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Denis=20Br=C3=A6khus?= <denis@varnish-software.com>
+Date: Thu, 10 Dec 2015 11:15:15 +0100
+Subject: [PATCH] Attempt at fixing 4.1 compat
+
+---
+ check_varnish.c | 22 +++++++++++++++++-----
+ configure.ac | 14 +++++++++-----
+ 2 files changed, 26 insertions(+), 10 deletions(-)
+
+diff --git a/check_varnish.c b/check_varnish.c
+index 6125ae6..773a7bb 100644
+--- a/check_varnish.c
++++ b/check_varnish.c
+@@ -43,7 +43,7 @@
+ #include <locale.h>
+ #include <assert.h>
+
+-#if defined(HAVE_VARNISHAPI_4)
++#if defined(HAVE_VARNISHAPI_4) || defined(HAVE_VARNISHAPI_4_1)
+ #include <vapi/vsc.h>
+ #include <vapi/vsm.h>
+ #elif defined(HAVE_VARNISHAPI_3)
+@@ -185,7 +185,19 @@ check_stats_cb(void *priv, const struct VSC_point * const pt)
+ if (pt == NULL)
+ return(0);
+
+-#if defined(HAVE_VARNISHAPI_4)
++#if defined(HAVE_VARNISHAPI_4_1)
++ assert(sizeof(tmp) > (strlen(pt->section->fantom->type) + 1 +
++ strlen(pt->section->fantom->ident) + 1 +
++ strlen(pt->desc->name) + 1));
++ snprintf(tmp, sizeof(tmp), "%s%s%s%s%s",
++ (pt->section->fantom->type[0] == 0 ? "" : pt->section->fantom->type),
++ (pt->section->fantom->type[0] == 0 ? "" : "."),
++ (pt->section->fantom->ident[0] == 0 ? "" : pt->section->fantom->ident),
++ (pt->section->fantom->ident[0] == 0 ? "" : "."),
++ pt->desc->name);
++ p = priv;
++ assert(!strcmp(pt->desc->ctype, "uint64_t"));
++#elif defined(HAVE_VARNISHAPI_4)
+ assert(sizeof(tmp) > (strlen(pt->section->fantom->type) + 1 +
+ strlen(pt->section->fantom->ident) + 1 +
+ strlen(pt->desc->name) + 1));
+@@ -212,7 +224,7 @@ check_stats_cb(void *priv, const struct VSC_point * const pt)
+ #endif
+ if (strcmp(tmp, p->param) == 0) {
+ p->found = 1;
+-#if defined(HAVE_VARNISHAPI_4)
++#if defined(HAVE_VARNISHAPI_4) || defined(HAVE_VARNISHAPI_4_1)
+ p->info = pt->desc->sdesc;
+ #elif defined(HAVE_VARNISHAPI_3)
+ p->info = pt->desc;
+@@ -241,7 +253,7 @@ check_stats(struct VSM_data *vd, char *param)
+ priv.found = 0;
+ priv.param = param;
+
+-#if defined(HAVE_VARNISHAPI_4)
++#if defined(HAVE_VARNISHAPI_4) || defined(HAVE_VARNISHAPI_4_1)
+ (void)VSC_Iter(vd, NULL, check_stats_cb, &priv);
+ #elif defined(HAVE_VARNISHAPI_3)
+ (void)VSC_Iter(vd, check_stats_cb, &priv);
+@@ -351,7 +363,7 @@ main(int argc, char **argv)
+ }
+ }
+
+-#if defined(HAVE_VARNISHAPI_4)
++#if defined(HAVE_VARNISHAPI_4) || defined(HAVE_VARNISHAPI_4_1)
+ if (VSM_Open(vd))
+ exit(1);
+ #elif defined(HAVE_VARNISHAPI_3)
+diff --git a/configure.ac b/configure.ac
+index a3df21e..f7b0258 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -21,11 +21,15 @@ AC_PROG_LIBTOOL
+ AC_PROG_MAKE_SET
+
+ # Checks for libraries.
+-PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 4],
+- [AC_DEFINE([HAVE_VARNISHAPI_4], [1], [Use VARNISHAPI v4])],
+- [PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 3],
+- [AC_DEFINE([HAVE_VARNISHAPI_3], [1], [Use VARNISHAPI v3])],
+- [AC_MSG_ERROR([Could not find neither varnishapi v4 nor v3.])])
++PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 4.1],
++ [AC_DEFINE([HAVE_VARNISHAPI_4_1], [1], [Use VARNISHAPI v4.1])],
++ [PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 4],
++ [AC_DEFINE([HAVE_VARNISHAPI_4], [1], [Use VARNISHAPI v4])],
++ [PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 3],
++ [AC_DEFINE([HAVE_VARNISHAPI_3], [1], [Use VARNISHAPI v3])],
++ [AC_MSG_ERROR([Could not find neither varnishapi v4 nor v3.])])
++ ]
++ )
+ ]
+ )
+
diff --git a/net-analyzer/nagios-check_varnish/files/1.1-Improve-help-output-to-differentiate-between-v3-and-.patch b/net-analyzer/nagios-check_varnish/files/1.1-Improve-help-output-to-differentiate-between-v3-and-.patch
new file mode 100644
index 00000000..2d5ba8d5
--- /dev/null
+++ b/net-analyzer/nagios-check_varnish/files/1.1-Improve-help-output-to-differentiate-between-v3-and-.patch
@@ -0,0 +1,41 @@
+From 6600ae018dc6d5169b1ebbeb06f0f8b027566abb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Denis=20Br=C3=A6khus?= <denis@varnish-software.com>
+Date: Wed, 8 Jul 2015 15:41:40 +0200
+Subject: [PATCH] Improve help output to differentiate between v3 and v4.
+
+---
+ check_varnish.c | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/check_varnish.c b/check_varnish.c
+index 95156f3..6125ae6 100644
+--- a/check_varnish.c
++++ b/check_varnish.c
+@@ -279,13 +279,21 @@ help(void)
+ "-w [@][lo:]hi Set warning threshold\n"
+ "\n"
+ "All items reported by varnishstat(1) are available - use the\n"
+- "identifier listed in the left column by 'varnishstat -l'. In\n"
+- "addition, the following parameters are available:\n"
++ "identifier listed in the left column by 'varnishstat -l'.\n"
+ "\n"
+- "uptime How long the cache has been running (in seconds)\n"
+- "ratio The cache hit ratio expressed as a percentage of hits to\n"
+- " hits + misses. Default thresholds are 95 and 90.\n"
+- "usage Cache file usage as a percentage of the total cache space.\n"
++ "Examples for Varnish 3.x:\n"
++ "\n"
++ "uptime How long the cache has been running (in seconds)\n"
++ "ratio The cache hit ratio expressed as a percentage of hits to\n"
++ " hits + misses. Default thresholds are 95 and 90.\n"
++ "usage Cache file usage as a percentage of the total cache space.\n"
++ "\n"
++ "Examples for Varnish 4.x:\n"
++ "\n"
++ "ratio The cache hit ratio expressed as a percentage of hits to\n"
++ " hits + misses. Default thresholds are 95 and 90.\n"
++ "MAIN.uptime How long the cache has been running (in seconds).\n"
++ "MAIN.n_purges Number of purge operations executed.\n"
+ );
+ exit(0);
+ }
diff --git a/net-analyzer/nagios-check_varnish/files/1.1-Make-gcc-explicitly-link-libm.-Fix-10.patch b/net-analyzer/nagios-check_varnish/files/1.1-Make-gcc-explicitly-link-libm.-Fix-10.patch
new file mode 100644
index 00000000..2d4149e7
--- /dev/null
+++ b/net-analyzer/nagios-check_varnish/files/1.1-Make-gcc-explicitly-link-libm.-Fix-10.patch
@@ -0,0 +1,21 @@
+From 258c48615c632ad15d6f421072ae30b2128963ab Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Denis=20Br=C3=A6khus?= <denis@varnish-software.com>
+Date: Mon, 14 Dec 2015 14:24:22 +0100
+Subject: [PATCH] Make gcc explicitly link libm. Fix #10
+
+---
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/configure.ac b/configure.ac
+index f7b0258..c7946c2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -43,6 +43,7 @@ AC_C_CONST
+
+ # Checks for library functions.
+ AC_TYPE_SIZE_T
++AC_SEARCH_LIBS([pow],[m],[],[AC_MSG_ERROR([unable to find libm])])
+
+ # Now that we're done using the compiler to look for functions and
+ # libraries, set CFLAGS to what we want them to be for our own code
diff --git a/net-analyzer/nagios-check_varnish/files/1.1-add-support-for-varnish-4.patch b/net-analyzer/nagios-check_varnish/files/1.1-add-support-for-varnish-4.patch
new file mode 100644
index 00000000..d9d342a1
--- /dev/null
+++ b/net-analyzer/nagios-check_varnish/files/1.1-add-support-for-varnish-4.patch
@@ -0,0 +1,130 @@
+From 04555fb05cb5292b811f696cacd585435f6a9f3e Mon Sep 17 00:00:00 2001
+From: Evgeni Golov <evgeni.golov@credativ.de>
+Date: Sat, 26 Apr 2014 18:06:26 +0200
+Subject: [PATCH] add support for varnish 4
+
+closes #2
+---
+ check_varnish.c | 41 +++++++++++++++++++++++++++++++++++++++--
+ configure.ac | 8 +++++++-
+ 2 files changed, 46 insertions(+), 3 deletions(-)
+
+diff --git a/check_varnish.c b/check_varnish.c
+index 2ba36aa..95156f3 100644
+--- a/check_varnish.c
++++ b/check_varnish.c
+@@ -43,8 +43,13 @@
+ #include <locale.h>
+ #include <assert.h>
+
++#if defined(HAVE_VARNISHAPI_4)
++#include <vapi/vsc.h>
++#include <vapi/vsm.h>
++#elif defined(HAVE_VARNISHAPI_3)
+ #include "vsc.h"
+ #include "varnishapi.h"
++#endif
+
+ static int verbose = 0;
+
+@@ -177,6 +182,22 @@ check_stats_cb(void *priv, const struct VSC_point * const pt)
+ struct stat_priv *p;
+ char tmp[1024];
+
++ if (pt == NULL)
++ return(0);
++
++#if defined(HAVE_VARNISHAPI_4)
++ assert(sizeof(tmp) > (strlen(pt->section->fantom->type) + 1 +
++ strlen(pt->section->fantom->ident) + 1 +
++ strlen(pt->desc->name) + 1));
++ snprintf(tmp, sizeof(tmp), "%s%s%s%s%s",
++ (pt->section->fantom->type[0] == 0 ? "" : pt->section->fantom->type),
++ (pt->section->fantom->type[0] == 0 ? "" : "."),
++ (pt->section->fantom->ident[0] == 0 ? "" : pt->section->fantom->ident),
++ (pt->section->fantom->ident[0] == 0 ? "" : "."),
++ pt->desc->name);
++ p = priv;
++ assert(!strcmp(pt->desc->fmt, "uint64_t"));
++#elif defined(HAVE_VARNISHAPI_3)
+ assert(sizeof(tmp) > (strlen(pt->class) + 1 +
+ strlen(pt->ident) + 1 +
+ strlen(pt->name) + 1));
+@@ -188,15 +209,20 @@ check_stats_cb(void *priv, const struct VSC_point * const pt)
+ pt->name);
+ p = priv;
+ assert(!strcmp(pt->fmt, "uint64_t"));
++#endif
+ if (strcmp(tmp, p->param) == 0) {
+ p->found = 1;
++#if defined(HAVE_VARNISHAPI_4)
++ p->info = pt->desc->sdesc;
++#elif defined(HAVE_VARNISHAPI_3)
+ p->info = pt->desc;
++#endif
+ p->value = *(const volatile uint64_t*)pt->ptr;
+ } else if (strcmp(p->param, "ratio") == 0) {
+- if (strcmp(tmp, "cache_hit") == 0) {
++ if (strcmp(tmp, "cache_hit") == 0 || strcmp(tmp, "MAIN.cache_hit") == 0) {
+ p->found = 1;
+ p->cache_hit = *(const volatile uint64_t*)pt->ptr;
+- } else if (strcmp(tmp, "cache_miss") == 0) {
++ } else if (strcmp(tmp, "cache_miss") == 0 || strcmp(tmp, "MAIN.cache_miss") == 0) {
+ p->cache_miss = *(const volatile uint64_t*)pt->ptr;
+ }
+ }
+@@ -215,7 +241,11 @@ check_stats(struct VSM_data *vd, char *param)
+ priv.found = 0;
+ priv.param = param;
+
++#if defined(HAVE_VARNISHAPI_4)
++ (void)VSC_Iter(vd, NULL, check_stats_cb, &priv);
++#elif defined(HAVE_VARNISHAPI_3)
+ (void)VSC_Iter(vd, check_stats_cb, &priv);
++#endif
+ if (strcmp(param, "ratio") == 0) {
+ intmax_t total = priv.cache_hit + priv.cache_miss;
+ priv.value = total ? (100 * priv.cache_hit / total) : 0;
+@@ -280,7 +310,9 @@ main(int argc, char **argv)
+ setlocale(LC_ALL, "");
+
+ vd = VSM_New();
++#if defined(HAVE_VARNISHAPI_3)
+ VSC_Setup(vd);
++#endif
+
+ while ((opt = getopt(argc, argv, VSC_ARGS "c:hn:p:vw:")) != -1) {
+ switch (opt) {
+@@ -311,8 +343,13 @@ main(int argc, char **argv)
+ }
+ }
+
++#if defined(HAVE_VARNISHAPI_4)
++ if (VSM_Open(vd))
++ exit(1);
++#elif defined(HAVE_VARNISHAPI_3)
+ if (VSC_Open(vd, 1))
+ exit(1);
++#endif
+
+ /* Default: if no param specified, check hit ratio. If no warning
+ * and critical values are specified either, set these to default.
+diff --git a/configure.ac b/configure.ac
+index feac2bd..a3df21e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -21,7 +21,13 @@ AC_PROG_LIBTOOL
+ AC_PROG_MAKE_SET
+
+ # Checks for libraries.
+-PKG_CHECK_MODULES([VARNISHAPI], [varnishapi])
++PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 4],
++ [AC_DEFINE([HAVE_VARNISHAPI_4], [1], [Use VARNISHAPI v4])],
++ [PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 3],
++ [AC_DEFINE([HAVE_VARNISHAPI_3], [1], [Use VARNISHAPI v3])],
++ [AC_MSG_ERROR([Could not find neither varnishapi v4 nor v3.])])
++ ]
++)
+
+ # Checks for header files.
+ AC_HEADER_STDC
diff --git a/net-analyzer/nagios-check_varnish/nagios-check_varnish-1.1.ebuild b/net-analyzer/nagios-check_varnish/nagios-check_varnish-1.1.ebuild
index 5ae84e4e..d9873d3f 100644
--- a/net-analyzer/nagios-check_varnish/nagios-check_varnish-1.1.ebuild
+++ b/net-analyzer/nagios-check_varnish/nagios-check_varnish-1.1.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
-EAPI=5
-inherit multilib autotools
+EAPI=6
+inherit multilib autotools eutils
MY_PN="varnish-nagios"
@@ -16,12 +16,19 @@ SLOT="0"
KEYWORDS="~amd64"
IUSE=""
-DEPEND="=www-servers/varnish-3*"
+DEPEND="www-servers/varnish"
RDEPEND="${DEPEND}"
S="${WORKDIR}/${MY_PN}-${PV}"
src_prepare() {
+ default
+
+ epatch "${FILESDIR}/${PV}-add-support-for-varnish-4.patch"
+ epatch "${FILESDIR}/${PV}-Improve-help-output-to-differentiate-between-v3-and-.patch"
+ epatch "${FILESDIR}/${PV}-Attempt-at-fixing-4.1-compat.patch"
+ epatch "${FILESDIR}/${PV}-Make-gcc-explicitly-link-libm.-Fix-10.patch"
+
eautoreconf
}