Bug 184503 - [patch] mail/policyd2 port assumes MySQL for web UI, requires web UI
Summary: [patch] mail/policyd2 port assumes MySQL for web UI, requires web UI
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: John Marino
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-04 21:30 UTC by Christopher K Davis
Modified: 2014-01-26 14:40 UTC (History)
0 users

See Also:


Attachments
file.diff (1.91 KB, patch)
2013-12-04 21:30 UTC, Christopher K Davis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher K Davis 2013-12-04 21:30:00 UTC
	The mail/policyd2 port unconditionally sets USE_PHP to use pdo_mysql
	even if PORT_OPTIONS doesn't include MYSQL.  This will make the PHP
	web UI nonfunctional if an alternate database is used.

	In addition, it always installs the PHP-based web UI rather than
	making doing so a configuration option.

Fix: Attached patch makes two changes:
	1. Adds a WEBUI configuration option to bsd.options.desc.mk for
	   use by this port as well as by any future ports that include
	   an optional web-based user interface component.
	2. Uses the WEBUI configuration option as well as the chosen
	   database(s) to install the appropriate PHP database module(s)
	   if the web UI is desired.
How-To-Repeat: 	Install mail/policyd2 with MYSQL unset in the port config.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-12-04 21:30:08 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-12-04 21:30:08 UTC
Maintainer of mail/policyd2,

Please note that PR ports/184503 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/184503

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 chifeng 2013-12-05 06:32:47 UTC
Please commit it, thanks so much.


On Thu, Dec 5, 2013 at 5:30 AM, Edwin Groothuis <edwin@freebsd.org> wrote:

> Maintainer of mail/policyd2,
>
> Please note that PR ports/184503 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/184503
>
> --
> Edwin Groothuis via the GNATS Auto Assign Tool
> edwin@FreeBSD.org
>



-- 
*Regards.*
- Chifeng
Comment 4 Christopher K Davis 2013-12-31 03:45:29 UTC
Here's a cleaner (newer) version of the diff that matches the current ports tree.

--- Mk/bsd.options.desc.mk.orig	2013-11-23 13:18:33.000000000 -0500
+++ Mk/bsd.options.desc.mk	2013-12-30 13:55:25.774746490 -0500
@@ -457,6 +457,7 @@
 WEBKIT_DESC?=		WebKit support
 WEBP_DESC?=		WebP image format support
 WEBSERVER_DESC?=	Build and/or install internal web server
+WEBUI_DESC?=		Build and/or install web user interface
 WMA_DESC?=		Windows Media Audio support
 WMF_DESC?=		Windows Metafile support
 WXGTK_DESC?=		wxGTK GUI toolkit support
--- mail/policyd2/Makefile.orig	2013-09-20 15:59:12.000000000 -0400
+++ mail/policyd2/Makefile	2013-12-30 13:58:13.094747414 -0500
@@ -16,7 +16,6 @@
 		p5-Cache-FastMmap>=0:${PORTSDIR}/devel/p5-Cache-FastMmap
 
 USES=		perl5
-USE_PHP=	yes
 NO_BUILD=	yes
 USE_RC_SUBR=	policyd2
 BINMODE=	0755
@@ -26,21 +25,29 @@
 PORTDOCS=	AUTHORS ChangeLog INSTALL TODO WISHLIST
 PORTDATA=	*
 
-OPTIONS_DEFINE=	MYSQL PGSQL SQLITE
-OPTIONS_DEFAULT=	MYSQL
+OPTIONS_DEFINE=	MYSQL PGSQL SQLITE WEBUI
+OPTIONS_DEFAULT=	MYSQL WEBUI
 
 NO_STAGE=	yes
 .include <bsd.port.pre.mk>
-USE_PHP=	pdo_mysql
 .if ${PORT_OPTIONS:MMYSQL}
 RUN_DEPENDS+=	p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql
-.endif
+.if ${PORT_OPTIONS:MWEBUI}
+USE_PHP=	pdo_mysql
+.endif # MYSQL && WEBUI
+.endif # MYSQL
 .if ${PORT_OPTIONS:MSQLITE}
 RUN_DEPENDS+=	p5-DBD-SQLite>=0:${PORTSDIR}/databases/p5-DBD-SQLite
-.endif
+.if ${PORT_OPTIONS:MWEBUI}
+USE_PHP=	pdo_sqlite
+.endif # SQLITE && WEBUI
+.endif # SQLITE
 .if ${PORT_OPTIONS:MPGSQL}
 RUN_DEPENDS+=	p5-DBD-Pg>=0:${PORTSDIR}/databases/p5-DBD-Pg
-.endif
+.if ${PORT_OPTIONS:MWEBUI}
+USE_PHP=	pdo_pgsql
+.endif # PGSQL && WEBUI
+.endif # PGSQL
 
 post-patch:
 	@${REINPLACE_CMD} 's|/etc|${PREFIX}/etc|' ${WRKSRC}/cbpadmin \
Comment 5 John Marino freebsd_committer freebsd_triage 2014-01-19 15:33:26 UTC
State Changed
From-To: feedback->open

Maintainer has approved.
Comment 6 John Marino freebsd_committer freebsd_triage 2014-01-26 13:59:55 UTC
Responsible Changed
From-To: freebsd-ports-bugs->marino

I'll take it.
Comment 7 dfilter service freebsd_committer freebsd_triage 2014-01-26 14:34:32 UTC
Author: marino
Date: Sun Jan 26 14:34:24 2014
New Revision: 341189
URL: http://svnweb.freebsd.org/changeset/ports/341189
QAT: https://qat.redports.org/buildarchive/r341189/

Log:
  mail/policyd2: Fix WebUI, add it as an option
  
  * Add WEBUI to the standard option descriptions
  * Use PHP only if WebUI option selected
  * Specify proper php database driver depending on database selected
    between mysql, pgsql, or sqlite
  * Port revision bumped because it fixes bug depending on options selected
  
  Due to bitrot caused by staging work, this patch had to be rewritten
  from scratch.  I believe the intent has been maintained.
  
  PR:		ports/184503
  Submitted by:	Christopher Davis
  Approved by:	maintainer (Chifeng)
  Rewritten b:	marino@

Modified:
  head/Mk/bsd.options.desc.mk
  head/mail/policyd2/Makefile

Modified: head/Mk/bsd.options.desc.mk
==============================================================================
--- head/Mk/bsd.options.desc.mk	Sun Jan 26 14:33:08 2014	(r341188)
+++ head/Mk/bsd.options.desc.mk	Sun Jan 26 14:34:24 2014	(r341189)
@@ -457,6 +457,7 @@ WAVPACK_DESC?=		WavPack lossless audio f
 WEBKIT_DESC?=		WebKit support
 WEBP_DESC?=		WebP image format support
 WEBSERVER_DESC?=	Build and/or install internal web server
+WEBUI_DESC?=		Build and/or install web user interface
 WMA_DESC?=		Windows Media Audio support
 WMF_DESC?=		Windows Metafile support
 WXGTK_DESC?=		wxGTK GUI toolkit support

Modified: head/mail/policyd2/Makefile
==============================================================================
--- head/mail/policyd2/Makefile	Sun Jan 26 14:33:08 2014	(r341188)
+++ head/mail/policyd2/Makefile	Sun Jan 26 14:34:24 2014	(r341189)
@@ -3,7 +3,7 @@
 
 PORTNAME=	policyd2
 PORTVERSION=	2.0.12
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	mail
 MASTER_SITES=	http://devlabs.linuxassist.net/attachments/download/${DOWNLOAD_FOLDER}/
 DISTNAME=	cluebringer-${PORTVERSION}
@@ -11,15 +11,12 @@ DISTNAME=	cluebringer-${PORTVERSION}
 MAINTAINER=	chifeng@gmail.com
 COMMENT=	Policyd v2 is a multi-platform policy server for popular MTAs
 
-OPTIONS_DEFINE=	DOCS
-
 RUN_DEPENDS=	p5-Net-Server>=0:${PORTSDIR}/net/p5-Net-Server \
 		p5-Net-CIDR>=0:${PORTSDIR}/net-mgmt/p5-Net-CIDR \
 		p5-Config-IniFiles>=0:${PORTSDIR}/devel/p5-Config-IniFiles \
 		p5-Cache-FastMmap>=0:${PORTSDIR}/devel/p5-Cache-FastMmap
 
 USES=		perl5 shebangfix
-USE_PHP=	yes
 NO_BUILD=	yes
 BINMODE=	0755
 USE_RC_SUBR=	policyd2
@@ -34,14 +31,27 @@ WEBUIDIR=	${PREFIX}/www/policyd
 PORTDOCS=	AUTHORS ChangeLog INSTALL TODO WISHLIST
 PORTDATA=	*
 
-OPTIONS_DEFINE=	MYSQL PGSQL SQLITE
-OPTIONS_DEFAULT=	MYSQL
+OPTIONS_DEFINE=	MYSQL PGSQL SQLITE WEBUI
+OPTIONS_DEFAULT=MYSQL WEBUI
 
-USE_PHP=	pdo_mysql
 MYSQL_RUN_DEPENDS=	p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql
 SQLITE_RUN_DEPENDS=	p5-DBD-SQLite>=0:${PORTSDIR}/databases/p5-DBD-SQLite
 PGSQL_RUN_DEPENDS=	p5-DBD-Pg>=0:${PORTSDIR}/databases/p5-DBD-Pg
 
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MWEBUI}
+. if ${PORT_OPTIONS:MMYSQL}
+USE_PHP=	pdo_mysql
+. endif
+. if ${PORT_OPTIONS:MSQLITE}
+USE_PHP=	pdo_sqlite
+. endif
+. if ${PORT_OPTIONS:MPGSQL}
+USE_PHP=	pdo_pgsql
+. endif
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} 's|/etc|${PREFIX}/etc|' ${WRKSRC}/cbpadmin \
 		${WRKSRC}/cbpolicyd
_______________________________________________
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 8 John Marino freebsd_committer freebsd_triage 2014-01-26 14:37:21 UTC
State Changed
From-To: open->closed

Committed, reworked.  Thanks!