Bug 178532

Summary: [PATCH] sysutils/munin-node: add PORT_OPTIONS for SNMP and CIDR, remove interactive questions from pkg-install and pkg-deinstall, remove initscripts from pkg-install
Product: Ports & Packages Reporter: Claudius Herder <claudius_herder>
Component: Individual Port(s)Assignee: Florian Smeets <flo>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.txt none

Description Claudius Herder 2013-05-12 14:28:20 UTC
>Number:         178532
>Category:       ports
>Synopsis:       [PATCH] sysutils/munin-node: add PORT_OPTIONS for SNMP and CIDR, remove interactive questions from pkg-install and pkg-deinstall, remove initscripts from pkg-install
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 12 13:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Claudius Herder
>Release:        FreeBSD 9.1-STABLE FreeBSD 9.1-STABLE #1 r250556: Sun May 12 11:38:33 CEST
>Organization:
>Environment:
>Description:
Add PORT_OPTIONS for optional SNMP and CIDR dependencies.

I would like to see the interactive questions removed from munin-node. Answering the same questions with every update is quite annoying and forces commands like portmaster -af to wait for userinput everytime.

In my opinion running munin-node-configure --shell |sh -x with every update is also not optimal.
For example I only use postgres_*_ALL, with the current implementation I have to remove > 50 plugins after updating.

>How-To-Repeat:

>Fix:

===> Updating from SVN
Updating '.':
At revision 317951.
===> Generating patch
===> Viewing diff with more
Index: Makefile
===================================================================
--- Makefile	(revision 317951)
+++ Makefile	(working copy)
@@ -15,14 +15,11 @@
 		p5-DateTime-HiRes>=0:${PORTSDIR}/devel/p5-DateTime-HiRes \
 		munin-common>=0:${PORTSDIR}/sysutils/munin-common \
 		p5-Net-Server>=0:${PORTSDIR}/net/p5-Net-Server \
-		p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP \
 		bash:${PORTSDIR}/shells/bash
 RUN_DEPENDS=	p5-Cache-Cache>=0:${PORTSDIR}/devel/p5-Cache-Cache \
 		p5-DateTime-HiRes>=0:${PORTSDIR}/devel/p5-DateTime-HiRes \
 		munin-common>=0:${PORTSDIR}/sysutils/munin-common \
 		p5-Net-Server>=0:${PORTSDIR}/net/p5-Net-Server \
-		p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP \
-		p5-Net-CIDR>=0:${PORTSDIR}/net-mgmt/p5-Net-CIDR \
 		bash:${PORTSDIR}/shells/bash
 
 DISTINFO_FILE=	${MUNIN_DISTINFO}
@@ -39,6 +36,22 @@
 ALL_TARGET=	build-node build-plugins
 INSTALL_TARGET=	install-node-prime install-plugins-prime
 
+OPTIONS_DEFINE=	SNMP CIDR
+OPTIONS_DEFAULT=	SNMP CIDR
+SNMP_DESC=	Include support for SNMP plugins
+CIDR_DESC=	Enable support for CIDR notation in munin-node.conf
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MSNMP}
+BUILD_DEPENDS+= p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP
+RUN_DEPENDS+= p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP
+.endif
+
+.if ${PORT_OPTIONS:MCIDR}
+RUN_DEPENDS+= p5-Net-CIDR>=0:${PORTSDIR}/net-mgmt/p5-Net-CIDR
+.endif
+
 MAN1=		munin-node-configure.1 \
 		munin-node.1 \
 		munin-run.1 \
Index: files/pkg-message.in
===================================================================
--- files/pkg-message.in	(revision 317951)
+++ files/pkg-message.in	(working copy)
@@ -17,3 +17,8 @@
 
     %%PREFIX%%/etc/rc.d/munin-node start
 ********************************************************************
+
+For a list of plugins that will probably work run
+%%PREFIX%%/sbin/munin-node-configure --suggest
+or
+%%PREFIX%%/sbin/munin-node-configure --shell | sh -x to install them automatically
Index: pkg-deinstall
===================================================================
--- pkg-deinstall	(revision 317951)
+++ pkg-deinstall	(working copy)
@@ -1,34 +1,5 @@
 #! /bin/sh
 
-ask() {
-    local question default answer
-
-    question=$1
-    default=$2
-    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
-	read -p "${question} [${default}]? " answer
-    fi
-    if [ x${answer} = x ]; then
-	answer=${default}
-    fi
-    echo ${answer}
-}
-
-yesno() {
-    local dflt question answer
-
-    question=$1
-    dflt=$2
-    while :; do
-	answer=$(ask "${question}" "${dflt}")
-	case "${answer}" in
-	[Yy]*)		return 0;;
-	[Nn]*)		return 1;;
-	esac
-	echo "Please answer yes or no."
-    done
-}
-
 stop_process() {
     STARTSTOP=${PKG_PREFIX}/etc/rc.d/munin-node
 
@@ -51,10 +22,9 @@
 	exit 0
     elif [ "$ENTRY" = "$DEFAULT" ]; then
 	delnewsyslog
-    elif yesno "You have changed the default munin-node entry in \"/etc/newsyslog.conf\".
-Do you want me to delete it?" y; then
-	delnewsyslog
-	echo "Done."
+    else
+    echo "You have changed the default munin-node entry in \"/etc/newsyslog.conf\"".
+    echo "If you deinstall munin-node permanently, you have to manually remove it"
     fi
 }
 
Index: pkg-install
===================================================================
--- pkg-install	(revision 317951)
+++ pkg-install	(working copy)
@@ -29,21 +29,6 @@
     done
 }
 
-init_plugins() {
-    if [ -f /tmp/.munin-node.version ]; then
-	prevver=$(cat /tmp/.munin-node.version)
-    fi
-
-    if [ -n "$prevver" ]; then
-	echo -n "Initializing new plugins.."
-	${PKG_PREFIX}/sbin/munin-node-configure --shell --newer "${prevver%-*}" | sh -x
-    else
-	echo -n "Initializing plugins.."
-	${PKG_PREFIX}/sbin/munin-node-configure --shell | sh -x
-    fi
-    echo "done."
-}
-
 create_crontab_entries() {
     local sched prog
     sched=$1
@@ -65,7 +50,6 @@
 }
 
 newsyslog() {
-    if yesno "Would you like me to set up log rotation" y; then
 	if grep -q /var/log/munin/munin-node.log /etc/newsyslog.conf; then
 	    :
 	else
@@ -73,9 +57,6 @@
 /var/log/munin/munin-node.log			644  7	   *	@T00  Z	/var/run/munin/munin-node.pid
 EOT
 	fi
-    else
-	echo "/var/log/munin-node.log will grow without bounds."
-    fi
 }
 
 
@@ -86,7 +67,6 @@
 	;;      
     POST-INSTALL)
 	if [ -z "${PACKAGE_BUILDING}" ]; then
-		init_plugins
 		${PKG_PREFIX}/etc/rc.d/munin-node start
 		newsyslog
 	fi
===> Done


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-ports-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports-bugs
To unsubscribe, send any mail to "freebsd-ports-bugs-unsubscribe@freebsd.org"
Comment 1 Claudius Herder 2013-05-12 14:30:00 UTC
Add PORT_OPTIONS for optional SNMP and CIDR dependencies.

I would like to see the interactive questions removed from munin-node. Answering the same questions with every update is quite annoying and forces commands like portmaster -af to wait for userinput everytime.

In my opinion running munin-node-configure --shell |sh -x with every update is also not optimal.
For example I only use postgres_*_ALL, with the current implementation I have to remove > 50 plugins after updating.

Fix: Patch attached with submission follows:
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-05-12 14:30:07 UTC
Responsible Changed
From-To: freebsd-ports-bugs->flo

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-05-30 00:36:25 UTC
Author: flo
Date: Wed May 29 23:36:16 2013
New Revision: 319396
URL: http://svnweb.freebsd.org/changeset/ports/319396

Log:
  - update to 2.0.14
  - make port non-interactive [1]
  - add PORTSCOUT hints, 2.1.X is a development version
  
  PR:		ports/178532 [1]
  Submitted by:	Claudius Herder <claudius_herder@ambtec.de> [1]

Modified:
  head/sysutils/munin-common/distinfo
  head/sysutils/munin-common/munin.mk
  head/sysutils/munin-node/Makefile
  head/sysutils/munin-node/files/pkg-message.in   (contents, props changed)
  head/sysutils/munin-node/pkg-deinstall
  head/sysutils/munin-node/pkg-install

Modified: head/sysutils/munin-common/distinfo
==============================================================================
--- head/sysutils/munin-common/distinfo	Wed May 29 23:09:25 2013	(r319395)
+++ head/sysutils/munin-common/distinfo	Wed May 29 23:36:16 2013	(r319396)
@@ -1,2 +1,2 @@
-SHA256 (munin-2.0.13.tar.gz) = 9a0b74c55a2d846371ad911f9e1102d21a6d39160771e7734981640fd75668db
-SIZE (munin-2.0.13.tar.gz) = 1333690
+SHA256 (munin-2.0.14.tar.gz) = 7526c7a582dd1ede3c7e78e2b0d9fc19240b289b402feeabe495df1ee70b0dbe
+SIZE (munin-2.0.14.tar.gz) = 1333774

Modified: head/sysutils/munin-common/munin.mk
==============================================================================
--- head/sysutils/munin-common/munin.mk	Wed May 29 23:09:25 2013	(r319395)
+++ head/sysutils/munin-common/munin.mk	Wed May 29 23:36:16 2013	(r319396)
@@ -1,9 +1,11 @@
-MUNIN_VERSION=	2.0.13
+MUNIN_VERSION=	2.0.14
 MUNIN_SITES=	SF/${PORTNAME}/stable/${MUNIN_VERSION}
 MUNIN_DISTINFO=	${PORTSDIR}/sysutils/munin-common/distinfo
 MUNIN_PATCHES=	${PORTSDIR}/sysutils/munin-common/files/patch-Makefile \
 		${PORTSDIR}/sysutils/munin-common/files/patch-Makefile.config
 
+PORTSCOUT=	limit:^2\.0\.
+
 DBDIR?=		/var/${PORTNAME}
 DBDIRNODE?=	/var/${PORTNAME}
 LOGDIR?=	/var/log/${PORTNAME}

Modified: head/sysutils/munin-node/Makefile
==============================================================================
--- head/sysutils/munin-node/Makefile	Wed May 29 23:09:25 2013	(r319395)
+++ head/sysutils/munin-node/Makefile	Wed May 29 23:36:16 2013	(r319396)
@@ -3,7 +3,6 @@
 
 PORTNAME=	munin
 PORTVERSION=	${MUNIN_VERSION}
-PORTREVISION=	2
 CATEGORIES=	sysutils perl5
 MASTER_SITES=	${MUNIN_SITES}
 PKGNAMESUFFIX=	-node
@@ -15,13 +14,11 @@ BUILD_DEPENDS=	p5-Module-Build>=0:${PORT
 		p5-DateTime-HiRes>=0:${PORTSDIR}/devel/p5-DateTime-HiRes \
 		munin-common>=0:${PORTSDIR}/sysutils/munin-common \
 		p5-Net-Server>=0:${PORTSDIR}/net/p5-Net-Server \
-		p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP \
 		bash:${PORTSDIR}/shells/bash
 RUN_DEPENDS=	p5-Cache-Cache>=0:${PORTSDIR}/devel/p5-Cache-Cache \
 		p5-DateTime-HiRes>=0:${PORTSDIR}/devel/p5-DateTime-HiRes \
 		munin-common>=0:${PORTSDIR}/sysutils/munin-common \
 		p5-Net-Server>=0:${PORTSDIR}/net/p5-Net-Server \
-		p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP \
 		p5-Net-CIDR>=0:${PORTSDIR}/net-mgmt/p5-Net-CIDR \
 		bash:${PORTSDIR}/shells/bash
 
@@ -39,6 +36,17 @@ SHEBANG_FILES=	node/sbin/munin-node
 ALL_TARGET=	build-node build-plugins
 INSTALL_TARGET=	install-node-prime install-plugins-prime
 
+OPTIONS_DEFINE=	SNMP
+OPTIONS_DEFAULT=	SNMP
+SNMP_DESC=	Include support for SNMP plugins
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MSNMP}
+BUILD_DEPENDS+= p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP
+RUN_DEPENDS+= p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP
+.endif
+
 MAN1=		munin-node-configure.1 \
 		munin-node.1 \
 		munin-run.1 \

Modified: head/sysutils/munin-node/files/pkg-message.in
==============================================================================
--- head/sysutils/munin-node/files/pkg-message.in	Wed May 29 23:09:25 2013	(r319395)
+++ head/sysutils/munin-node/files/pkg-message.in	Wed May 29 23:36:16 2013	(r319396)
@@ -17,3 +17,10 @@ present, the client will be started now.
 
     %%PREFIX%%/etc/rc.d/munin-node start
 ********************************************************************
+
+For a list of plugins that will probably work run
+%%PREFIX%%/sbin/munin-node-configure --suggest
+
+If this is a fresh install run
+%%PREFIX%%/sbin/munin-node-configure --shell | sh -x
+to install the plugins automatically

Modified: head/sysutils/munin-node/pkg-deinstall
==============================================================================
--- head/sysutils/munin-node/pkg-deinstall	Wed May 29 23:09:25 2013	(r319395)
+++ head/sysutils/munin-node/pkg-deinstall	Wed May 29 23:36:16 2013	(r319396)
@@ -1,34 +1,5 @@
 #! /bin/sh
 
-ask() {
-    local question default answer
-
-    question=$1
-    default=$2
-    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
-	read -p "${question} [${default}]? " answer
-    fi
-    if [ x${answer} = x ]; then
-	answer=${default}
-    fi
-    echo ${answer}
-}
-
-yesno() {
-    local dflt question answer
-
-    question=$1
-    dflt=$2
-    while :; do
-	answer=$(ask "${question}" "${dflt}")
-	case "${answer}" in
-	[Yy]*)		return 0;;
-	[Nn]*)		return 1;;
-	esac
-	echo "Please answer yes or no."
-    done
-}
-
 stop_process() {
     STARTSTOP=${PKG_PREFIX}/etc/rc.d/munin-node
 
@@ -51,10 +22,9 @@ newsyslog() {
 	exit 0
     elif [ "$ENTRY" = "$DEFAULT" ]; then
 	delnewsyslog
-    elif yesno "You have changed the default munin-node entry in \"/etc/newsyslog.conf\".
-Do you want me to delete it?" y; then
-	delnewsyslog
-	echo "Done."
+    else
+    echo "You have changed the default munin-node entry in \"/etc/newsyslog.conf\"".
+    echo "If you deinstall munin-node permanently, you have to manually remove it"
     fi
 }
 

Modified: head/sysutils/munin-node/pkg-install
==============================================================================
--- head/sysutils/munin-node/pkg-install	Wed May 29 23:09:25 2013	(r319395)
+++ head/sysutils/munin-node/pkg-install	Wed May 29 23:36:16 2013	(r319396)
@@ -37,9 +37,6 @@ init_plugins() {
     if [ -n "$prevver" ]; then
 	echo -n "Initializing new plugins.."
 	${PKG_PREFIX}/sbin/munin-node-configure --shell --newer "${prevver%-*}" | sh -x
-    else
-	echo -n "Initializing plugins.."
-	${PKG_PREFIX}/sbin/munin-node-configure --shell | sh -x
     fi
     echo "done."
 }
@@ -65,7 +62,6 @@ EOT
 }
 
 newsyslog() {
-    if yesno "Would you like me to set up log rotation" y; then
 	if grep -q /var/log/munin/munin-node.log /etc/newsyslog.conf; then
 	    :
 	else
@@ -73,9 +69,6 @@ newsyslog() {
 /var/log/munin/munin-node.log			644  7	   *	@T00  Z	/var/run/munin/munin-node.pid
 EOT
 	fi
-    else
-	echo "/var/log/munin-node.log will grow without bounds."
-    fi
 }
 
 
@@ -90,5 +83,5 @@ case $2 in
 		${PKG_PREFIX}/etc/rc.d/munin-node start
 		newsyslog
 	fi
-	;;      
+	;;
 esac
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Florian Smeets freebsd_committer freebsd_triage 2013-05-30 00:36:57 UTC
State Changed
From-To: open->closed

Committed. Thanks!