Bug 176334

Summary: Fix port: sysutils/boxbackup rc script and OPTIONSng
Product: Ports & Packages Reporter: Chris Rees <crees>
Component: Individual Port(s)Assignee: Chris Rees <crees>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Chris Rees freebsd_committer freebsd_triage 2013-02-21 20:10:01 UTC
	- Update to OPTIONSng
	- Use standard framework for pkg-message substitution

	I see that you register CONFLICTS on client and server ports, but are you aware that it's impossible to install two different ports from the same origin (ports directory)?

	I might suggest that you create slave ports instead, perhaps boxbackup-client and boxbackup-server for this use, and that way both can be installed separately (a la database ports, for example).  Would you be interested in code for this?

Fix: 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.--SLCNxNIWWBkspTRaT4KZOHAQa37yk0Rb0qUGYS1ZHbNrbBys
Content-Type: text/plain; name="boxbackup-fixes.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="boxbackup-fixes.diff"

Index: Makefile
===================================================================
--- Makefile	(revision 312734)
+++ Makefile	(working copy)
@@ -26,27 +26,29 @@
 
 CONFIGURE_ARGS+=--sysconfdir=${PREFIX}/etc
 
-PKGMESSAGE=	${WRKDIR}/pkg-message
+SUB_FILES=	pkg-message
 
-OPTIONS=	CLIENT "Install the bbackupd client" On \
-		SERVER "Install the bbstored server" On \
-		GNUREADLINE "Enable the use of GNU readline" Off
+OPTIONS_DEFINE=	READLINE
 
-.include <bsd.port.pre.mk>
+OPTIONS_MULTI=	FLAVOUR
+OPTIONS_MULTI_FLAVOUR=	CLIENT SERVER
 
-.if defined(WITH_GNUREADLINE)
+CLIENT_DESC=	Install the bbackupd client
+SERVER_DESC=	Install the bbstored server
+
+OPTIONS_DEFAULT=CLIENT SERVER
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MREADLINE}
 CONFIGURE_ARGS+=--enable-gnu-readline
 .endif
 
-.if defined(WITHOUT_CLIENT) && defined(WITHOUT_SERVER)
-IGNORE=		requires at least CLIENT or SERVER to be defined.\
-		Please 'make config' again
-.endif
-
 MANCOMPRESSED=	yes
-.if defined(WITH_CLIENT)
+.if ${PORT_OPTIONS:MCLIENT}
 USE_RC_SUBR+=	bbackupd
 PLIST_SUB+=	CLIENT=""
+SUB_LIST+=	CLIENT=""
 ALL_TARGET+=	build-backup-client
 INSTALL_TARGET+=install-backup-client
 MAN5+=		bbackupd.conf.5
@@ -54,26 +56,29 @@
 SUB_FILES+=	999.boxbackup
 .else
 PLIST_SUB+=	CLIENT="@comment "
+SUB_LIST+=	CLIENT="@comment "
 .endif
 
-.if defined(WITH_SERVER)
+.if ${PORT_OPTIONS:MSERVER}
 USE_RC_SUBR+=	bbstored
 USERS+=		_bbstored
 GROUPS+=	_bbstored
 PLIST_SUB+=	SERVER=""
+SUB_LIST+=	SERVER=""
 ALL_TARGET+=	build-backup-server
 INSTALL_TARGET+=install-backup-server
 MAN5+=		bbstored.conf.5 raidfile.conf.5
 MAN8+=		bbstored.8 bbstoreaccounts.8 bbstored-certs.8 bbstored-config.8 raidfile-config.8
 .else
 PLIST_SUB+=	SERVER="@comment "
+SUB_LIST+=	SERVER="@comment "
 .endif
 
-.if defined(WITHOUT_CLIENT)
+.if ! ${PORT_OPTIONS:MCLIENT}
 # if this is a server-only install, CONFLICT with an install of the CLIENT or both
 CONFLICTS=	boxbackup-client-[0-9]* boxbackup-[0-9]*
 CLIENT_OR_SERVER=-server
-.elif defined(WITHOUT_SERVER)
+.elif ! ${PORT_OPTIONS:MSERVER}
 # if this is a client-only install, CONFLICT with an install of the SERVER or both
 CONFLICTS=	boxbackup-server-[0-9]* boxbackup-[0-9]*
 CLIENT_OR_SERVER=-client
@@ -85,24 +90,18 @@
 
 post-patch:
 	@${REINPLACE_CMD} -e '/html/d' ${WRKSRC}/parcels.txt
-.if !defined(WITHOUT_CLIENT)
-	@${CAT} ${FILESDIR}/pkg-message.client >> ${PKGMESSAGE}
-.endif
-.if !defined(WITHOUT_SERVER)
-	@${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
-	  ${FILESDIR}/pkg-message.server.in >> ${PKGMESSAGE}
-.endif
 
 post-configure:
-	@${REINPLACE_CMD} -e '/share.doc.boxbackup/d' ${WRKSRC}/parcels/scripts/install-backup-*
+	@${REINPLACE_CMD} -e '/share.doc.boxbackup/d' \
+		${WRKSRC}/parcels/scripts/install-backup-*
 
 post-install:
-.if !defined(WITHOUT_CLIENT)
+.if ${PORT_OPTIONS:MCLIENT}
 	@${MKDIR} -m 0700 ${PREFIX}/etc/boxbackup/bbackupd
 	@${MKDIR} ${PREFIX}/etc/periodic/monthly
 	${INSTALL_SCRIPT} ${WRKDIR}/999.boxbackup ${PREFIX}/etc/periodic/monthly
 .endif
-.if !defined(WITHOUT_SERVER)
+.if ${PORT_OPTIONS:MSERVER}
 	@${MKDIR} -m 0700 ${PREFIX}/etc/boxbackup/bbstored
 .endif
 	@${CAT} ${PKGMESSAGE}
@@ -111,4 +110,4 @@
 	 @${ECHO_CMD} "===> Running tests"
 	 @${MAKE} -C ${WRKSRC} test
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
Index: files/bbstored.in
===================================================================
--- files/bbstored.in	(revision 312734)
+++ files/bbstored.in	(working copy)
@@ -18,7 +18,7 @@
 load_rc_config $name
 
 : ${bbstored_enable:="NO"}
-: ${bbstored_flags:="%%PREFIX%%/etc/boxbackup/bbstored.conf"}
+: ${bbstored_flags:="%%ETCDIR%%/bbstored.conf"}
 
 pidfile=${bbstored_pidfile:-"/var/run/bbstored.pid"}
 
Index: files/pkg-message.client
===================================================================
--- files/pkg-message.client	(revision 312734)
+++ files/pkg-message.client	(working copy)
@@ -1,4 +0,0 @@
-
-To run bbackupd at startup, add bbackupd_enable="YES" to /etc/rc.conf
-Please see http://www.boxbackup.org/client.html for client configuration
-options
Index: files/pkg-message.in
===================================================================
--- files/pkg-message.in	(working copy)
+++ files/pkg-message.in	(working copy)
@@ -1,8 +1,13 @@
+%%SERVER%%
+%%SERVER%%To run bbstored at startup, add bbstored_enable="YES" to /etc/rc.conf
+%%SERVER%%Please see http://www.boxbackup.org/server.html for server
+%%SERVER%%configuration options
+%%SERVER%%
+%%SERVER%%The default location of configuration files changed from
+%%SERVER%%%%PREFIX%%/etc/box to %%ETCDIR%%, if you are upgrading then run 
+%%SERVER%%  mv %%PREFIX%%/etc/box %%ETCDIR%%
+%%CLIENT%%
+%%CLIENT%%To run bbackupd at startup, add bbackupd_enable="YES" to /etc/rc.conf
+%%CLIENT%%Please see http://www.boxbackup.org/client.html for client
+%%CLIENT%%configuration options
 
-To run bbstored at startup, add bbstored_enable="YES" to /etc/rc.conf
-Please see http://www.boxbackup.org/server.html for server configuration
-options
-
-The default location of configuration files changed from %%PREFIX%%/etc/box to
-%%PREFIX%%/etc/boxbackup, if you are upgrading then run 
-  mv %%PREFIX%%/etc/box %%PREFIX%%/etc/boxbackup
Index: files/pkg-message.server.in
===================================================================
--- files/pkg-message.server.in	(revision 312734)
+++ files/pkg-message.server.in	(working copy)
@@ -1,8 +0,0 @@
-
-To run bbstored at startup, add bbstored_enable="YES" to /etc/rc.conf
-Please see http://www.boxbackup.org/server.html for server configuration
-options
-
-The default location of configuration files changed from %%PREFIX%%/etc/box to
-%%PREFIX%%/etc/boxbackup, if you are upgrading then run 
-  mv %%PREFIX%%/etc/box %%PREFIX%%/etc/boxbackup
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-02-21 20:10:13 UTC
Maintainer of sysutils/boxbackup,

Please note that PR ports/176334 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/176334

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-02-21 20:10:14 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Chris Rees freebsd_committer freebsd_triage 2013-02-21 20:11:18 UTC
Responsible Changed
From-To: freebsd-ports-bugs->crees

I probably shouldn't just abandon this PR
Comment 4 dfilter service freebsd_committer freebsd_triage 2013-02-23 12:30:16 UTC
Author: crees
Date: Sat Feb 23 12:30:08 2013
New Revision: 312808
URL: http://svnweb.freebsd.org/changeset/ports/312808

Log:
  Convert to OPTIONSng
  
  Use SUB_FILES for pkg-message processing
  
  Use ETCDIR where appropriate
  
  PR:		ports/176334
  Approved by:	James O'Gorman <james@netinertia.co.uk> (maintainer)

Added:
  head/sysutils/boxbackup/files/pkg-message.in
     - copied, changed from r312734, head/sysutils/boxbackup/files/pkg-message.server.in
Deleted:
  head/sysutils/boxbackup/files/pkg-message.client
  head/sysutils/boxbackup/files/pkg-message.server.in
Modified:
  head/sysutils/boxbackup/Makefile
  head/sysutils/boxbackup/files/bbstored.in

Modified: head/sysutils/boxbackup/Makefile
==============================================================================
--- head/sysutils/boxbackup/Makefile	Sat Feb 23 11:45:35 2013	(r312807)
+++ head/sysutils/boxbackup/Makefile	Sat Feb 23 12:30:08 2013	(r312808)
@@ -26,27 +26,29 @@ MAKE_JOBS_UNSAFE=yes
 
 CONFIGURE_ARGS+=--sysconfdir=${PREFIX}/etc
 
-PKGMESSAGE=	${WRKDIR}/pkg-message
+SUB_FILES=	pkg-message
 
-OPTIONS=	CLIENT "Install the bbackupd client" On \
-		SERVER "Install the bbstored server" On \
-		GNUREADLINE "Enable the use of GNU readline" Off
+OPTIONS_DEFINE=	READLINE
 
-.include <bsd.port.pre.mk>
+OPTIONS_MULTI=	FLAVOUR
+OPTIONS_MULTI_FLAVOUR=	CLIENT SERVER
 
-.if defined(WITH_GNUREADLINE)
-CONFIGURE_ARGS+=--enable-gnu-readline
-.endif
+CLIENT_DESC=	Install the bbackupd client
+SERVER_DESC=	Install the bbstored server
+
+OPTIONS_DEFAULT=CLIENT SERVER
+
+.include <bsd.port.options.mk>
 
-.if defined(WITHOUT_CLIENT) && defined(WITHOUT_SERVER)
-IGNORE=		requires at least CLIENT or SERVER to be defined.\
-		Please 'make config' again
+.if ${PORT_OPTIONS:MREADLINE}
+CONFIGURE_ARGS+=--enable-gnu-readline
 .endif
 
 MANCOMPRESSED=	yes
-.if defined(WITH_CLIENT)
+.if ${PORT_OPTIONS:MCLIENT}
 USE_RC_SUBR+=	bbackupd
 PLIST_SUB+=	CLIENT=""
+SUB_LIST+=	CLIENT=""
 ALL_TARGET+=	build-backup-client
 INSTALL_TARGET+=install-backup-client
 MAN5+=		bbackupd.conf.5
@@ -54,26 +56,29 @@ MAN8+=		bbackupd.8 bbackupctl.8 bbackupd
 SUB_FILES+=	999.boxbackup
 .else
 PLIST_SUB+=	CLIENT="@comment "
+SUB_LIST+=	CLIENT="@comment "
 .endif
 
-.if defined(WITH_SERVER)
+.if ${PORT_OPTIONS:MSERVER}
 USE_RC_SUBR+=	bbstored
 USERS+=		_bbstored
 GROUPS+=	_bbstored
 PLIST_SUB+=	SERVER=""
+SUB_LIST+=	SERVER=""
 ALL_TARGET+=	build-backup-server
 INSTALL_TARGET+=install-backup-server
 MAN5+=		bbstored.conf.5 raidfile.conf.5
 MAN8+=		bbstored.8 bbstoreaccounts.8 bbstored-certs.8 bbstored-config.8 raidfile-config.8
 .else
 PLIST_SUB+=	SERVER="@comment "
+SUB_LIST+=	SERVER="@comment "
 .endif
 
-.if defined(WITHOUT_CLIENT)
+.if ! ${PORT_OPTIONS:MCLIENT}
 # if this is a server-only install, CONFLICT with an install of the CLIENT or both
 CONFLICTS=	boxbackup-client-[0-9]* boxbackup-[0-9]*
 CLIENT_OR_SERVER=-server
-.elif defined(WITHOUT_SERVER)
+.elif ! ${PORT_OPTIONS:MSERVER}
 # if this is a client-only install, CONFLICT with an install of the SERVER or both
 CONFLICTS=	boxbackup-server-[0-9]* boxbackup-[0-9]*
 CLIENT_OR_SERVER=-client
@@ -85,24 +90,18 @@ CONFLICTS=	boxbackup-server-[0-9]* boxba
 
 post-patch:
 	@${REINPLACE_CMD} -e '/html/d' ${WRKSRC}/parcels.txt
-.if !defined(WITHOUT_CLIENT)
-	@${CAT} ${FILESDIR}/pkg-message.client >> ${PKGMESSAGE}
-.endif
-.if !defined(WITHOUT_SERVER)
-	@${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
-	  ${FILESDIR}/pkg-message.server.in >> ${PKGMESSAGE}
-.endif
 
 post-configure:
-	@${REINPLACE_CMD} -e '/share.doc.boxbackup/d' ${WRKSRC}/parcels/scripts/install-backup-*
+	@${REINPLACE_CMD} -e '/share.doc.boxbackup/d' \
+		${WRKSRC}/parcels/scripts/install-backup-*
 
 post-install:
-.if !defined(WITHOUT_CLIENT)
+.if ${PORT_OPTIONS:MCLIENT}
 	@${MKDIR} -m 0700 ${PREFIX}/etc/boxbackup/bbackupd
 	@${MKDIR} ${PREFIX}/etc/periodic/monthly
 	${INSTALL_SCRIPT} ${WRKDIR}/999.boxbackup ${PREFIX}/etc/periodic/monthly
 .endif
-.if !defined(WITHOUT_SERVER)
+.if ${PORT_OPTIONS:MSERVER}
 	@${MKDIR} -m 0700 ${PREFIX}/etc/boxbackup/bbstored
 .endif
 	@${CAT} ${PKGMESSAGE}
@@ -111,4 +110,4 @@ test:
 	 @${ECHO_CMD} "===> Running tests"
 	 @${MAKE} -C ${WRKSRC} test
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Modified: head/sysutils/boxbackup/files/bbstored.in
==============================================================================
--- head/sysutils/boxbackup/files/bbstored.in	Sat Feb 23 11:45:35 2013	(r312807)
+++ head/sysutils/boxbackup/files/bbstored.in	Sat Feb 23 12:30:08 2013	(r312808)
@@ -18,7 +18,7 @@ rcvar=bbstored_enable
 load_rc_config $name
 
 : ${bbstored_enable:="NO"}
-: ${bbstored_flags:="%%PREFIX%%/etc/boxbackup/bbstored.conf"}
+: ${bbstored_flags:="%%ETCDIR%%/bbstored.conf"}
 
 pidfile=${bbstored_pidfile:-"/var/run/bbstored.pid"}
 

Copied and modified: head/sysutils/boxbackup/files/pkg-message.in (from r312734, head/sysutils/boxbackup/files/pkg-message.server.in)
==============================================================================
--- head/sysutils/boxbackup/files/pkg-message.server.in	Thu Feb 21 19:27:34 2013	(r312734, copy source)
+++ head/sysutils/boxbackup/files/pkg-message.in	Sat Feb 23 12:30:08 2013	(r312808)
@@ -1,8 +1,13 @@
+%%SERVER%%
+%%SERVER%%To run bbstored at startup, add bbstored_enable="YES" to /etc/rc.conf
+%%SERVER%%Please see http://www.boxbackup.org/server.html for server
+%%SERVER%%configuration options
 
-To run bbstored at startup, add bbstored_enable="YES" to /etc/rc.conf
-Please see http://www.boxbackup.org/server.html for server configuration
-options
+The default location of configuration files changed from
+%%PREFIX%%/etc/box to %%ETCDIR%%, if you are upgrading then run 
+  mv %%PREFIX%%/etc/box %%ETCDIR%%
 
-The default location of configuration files changed from %%PREFIX%%/etc/box to
-%%PREFIX%%/etc/boxbackup, if you are upgrading then run 
-  mv %%PREFIX%%/etc/box %%PREFIX%%/etc/boxbackup
+%%CLIENT%%To run bbackupd at startup, add bbackupd_enable="YES" to /etc/rc.conf
+%%CLIENT%%Please see http://www.boxbackup.org/client.html for client
+%%CLIENT%%configuration options
+%%CLIENT%%
_______________________________________________
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 5 Chris Rees freebsd_committer freebsd_triage 2013-02-23 12:30:47 UTC
Migrate conversation from freebsd-ports-bugs.

---------- Forwarded message ----------
From: Chris Rees <crees@freebsd.org>
Date: 23 February 2013 12:03
Subject: Re: ports/176334: Fix port: sysutils/boxbackup rc script and OPTIONSng
To: James O'Gorman <james@netinertia.co.uk>
Cc: "freebsd-ports-bugs@freebsd.org" <freebsd-ports-bugs@freebsd.org>


On 23 February 2013 12:01, James O'Gorman <james@netinertia.co.uk> wrote:
> On Sat, Feb 23, 2013 at 11:44:52AM +0000, Chris Rees wrote:
>> On 23 February 2013 11:16, James O'Gorman <james@netinertia.co.uk> wrote:
>> > The patch looks fine to me in general. Only thing I noticed is that with
>> > the pkg-message the notice about the config files moving seems to have
>> > been dropped from the client component.
>> >
>> > If the patch is updated for this I'll be happy for it to be commented.
>>
>> Ah-- from my reading of the current pkg-message.client the config
>> files movement isn't mentioned?
>
> Hmm, yes, good point, that is how it reads at the moment, but it should
> probably be applied to both. I hadn't noticed that at the last commit.
>
>> Is it the client or the server that uses the config files?
>
> Both. Under ETCDIR there's a subdir for bbackupd and bbstored. The
> configs are autogenerated when you first install, but the rc script now
> looks in the new location so the configs for both client and server need
> to be modified.
>

OK, cool, the new patch keeps the config file message in regardless.

http://www.bayofrum.net/~crees/patches/boxbackup-fixes2.diff

Chris

---------------------------

On 23 February James O'Gorman wrote:

Perfect - happy for this to be committed.

Cheers!


James
Comment 6 Chris Rees freebsd_committer freebsd_triage 2013-02-23 12:31:26 UTC
State Changed
From-To: feedback->closed

Committed.  Thanks very much for your quick review and approval!