Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jan 2009 12:14:20 +0100 (CET)
From:      Angelo Turetta <aturetta@bestunion.it>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/130869: www/rt38 [patch] fix configuration handling on upgrade
Message-ID:  <200901221114.n0MBEK20004180@snape.lan.bestunion.it>
Resent-Message-ID: <200901221120.n0MBK2CM079002@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         130869
>Category:       ports
>Synopsis:       www/rt38 [patch] fix configuration handling on upgrade
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 22 11:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Angelo Turetta
>Release:        FreeBSD 7.1-STABLE i386
>Organization:
Best Union Company S.p.A.
>Environment:
System: FreeBSD snape.lan.bestunion.it 7.1-STABLE FreeBSD 7.1-STABLE #7: Thu Jan 8 13:41:46 CET 2009 aturetta@snape.lan.bestunion.it:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:
	The installation of a default RT_SiteConfig.pm is broken.
	Currently the install copies RT_SiteConfig.pm if it's not present, then the
	port's Makefile unconditionally copies RT_SiteConfig.pm to RT_SiteConfig.pm-dist.

	All is OK after first installation. After the first upgrade, the user's
	RT_SiteConfig.pm overwrites RT_SiteConfig.pm-dist. On the next upgrade,
	if no changes has been made to RT_SiteConfig.pm, the check included in pkg-plist
	will delete RT_SiteConfig.pm because it's identical to RT_SiteConfig.pm-dist.
>How-To-Repeat:
	
>Fix:

	The port should install a file called RT_SiteConfig.pm-dist, and only then copy
	it to RT_SiteConfig.pm if the latter doesn't exist.
	While fixing this, I also attended a couple of TODO items, deleting them from
	Makefile

	Suggested commit message:

	=======================================================
	- Fix erroneous removal of user's RT_SiteConfig.pm after second upgrade
	- Fix path of RT_SiteConfig.pm in various files
	- Fix creation of default RT_SiteConfig.pm in pkg-plist
	- Bump portrevision (pkg-plist changed)
	=======================================================

	Please beware: portrevision bump is not included in my patch
	NOTE: the first point may be worth a heads-up in UPDATING

--- rt38-fix-siteconfig.diff begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/www/rt38/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile	22 Jan 2009 00:31:15 -0000	1.7
+++ Makefile	22 Jan 2009 10:51:01 -0000
@@ -6,8 +6,6 @@
 
 # TODO:
 # o etc/rt38 files permissions
-# o install etc/rt38/RT_SiteConfig.pm in pkg-plist for packages, fix make install
-# o patch etc/rt38/RT_SiteConfig.pm and -dist perl -c path
 # o GRANTS
 # o Schema
 # - Vhost Config
@@ -173,6 +171,7 @@
 
 PKGMESSAGE=	${WRKDIR}/pkg-message
 SUB_FILES=	pkg-message
+SUB_LIST=	RT_ETC_PATH=${RT_ETC_PATH}
 
 run-autotools::	run-autotools-autoconf
 
@@ -195,14 +194,15 @@
 post-patch:
 	@${RM} -f ${WRKSRC}/lib/RT.pm.in.orig
 	@${REINPLACE_CMD} -e 's!%%SITE_PERL%%!${SITE_PERL}!g' ${WRKSRC}/config.layout
+	@${REINPLACE_CMD} -e 's!/path/to/your/etc!${RT_ETC_PATH}!g' ${WRKSRC}/etc/RT_SiteConfig.pm
 
 pre-install:
 	@${RM} -f ${WRKSRC}/lib/RT.pm.in
 	@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
 
 post-install:
-	@[ -f ${RT_ETC_PATH}/RT_SiteConfig.pm-dist ] || \
-		${CP} -p ${RT_ETC_PATH}/RT_SiteConfig.pm ${RT_ETC_PATH}/RT_SiteConfig.pm-dist
+	@[ -f ${RT_ETC_PATH}/RT_SiteConfig.pm ] || \
+		${CP} -p ${RT_ETC_PATH}/RT_SiteConfig.pm-dist ${RT_ETC_PATH}/RT_SiteConfig.pm
 	${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/www/rt38/pkg-plist,v
retrieving revision 1.3
diff -u -r1.3 pkg-plist
--- pkg-plist	22 Jan 2009 00:31:15 -0000	1.3
+++ pkg-plist	22 Jan 2009 10:42:05 -0000
@@ -1,4 +1,6 @@
+@comment $FreeBSD$
 @unexec if cmp -s %D/etc/rt38/RT_SiteConfig.pm %D/etc/rt38/RT_SiteConfig.pm-dist; then rm -f %D/etc/rt38/RT_SiteConfig.pm; fi
+@exec [ -f %D/etc/rt38/RT_SiteConfig.pm ] || cp %D/rt38/RT_SiteConfig.pm-dist %D/etc/rt38/RT_SiteConfig.pm
 bin/mason_handler.fcgi
 bin/mason_handler.scgi
 bin/mason_handler.svc
Index: files/patch-Makefile.in
===================================================================
RCS file: /home/ncvs/ports/www/rt38/files/patch-Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 patch-Makefile.in
--- files/patch-Makefile.in	22 Jan 2009 00:31:16 -0000	1.3
+++ files/patch-Makefile.in	22 Jan 2009 10:42:05 -0000
@@ -1,5 +1,14 @@
 --- ./Makefile.in.orig	2008-08-18 11:13:58.000000000 -0400
 +++ ./Makefile.in	2008-12-28 23:12:31.000000000 -0500
+@@ -58,7 +58,7 @@
+ 
+ CONFIG_FILE_PATH	=	@CONFIG_FILE_PATH_R@
+ CONFIG_FILE		= 	$(CONFIG_FILE_PATH)/RT_Config.pm
+-SITE_CONFIG_FILE		= 	$(CONFIG_FILE_PATH)/RT_SiteConfig.pm
++SITE_CONFIG_FILE		= 	$(CONFIG_FILE_PATH)/RT_SiteConfig.pm-dist
+ 
+ 
+ RT_VERSION_MAJOR	=	@RT_VERSION_MAJOR@
 @@ -107,7 +107,7 @@
  RT_VAR_PATH		=	@RT_VAR_PATH_R@
  RT_DOC_PATH		=	@RT_DOC_PATH_R@
Index: files/pkg-message.in
===================================================================
RCS file: /home/ncvs/ports/www/rt38/files/pkg-message.in,v
retrieving revision 1.4
diff -u -r1.4 pkg-message.in
--- files/pkg-message.in	2 Jan 2009 13:27:12 -0000	1.4
+++ files/pkg-message.in	22 Jan 2009 10:46:07 -0000
@@ -2,8 +2,8 @@
 
 To complete the installation of this port, please follow these steps:
 
-1. Edit %%LOCALBASE%%/etc/rt38/RT_SiteConfig.pm, by referring to
-   the default config file (%%LOCALBASE%%/etc/rt38/RT_Config.pm).
+1. Edit %%RT_ETC_PATH%%/RT_SiteConfig.pm, by referring to
+   the default config file (%%RT_ETC_PATH%%/RT_Config.pm).
 2. Configure the email and web gateways.  Please refer to
    'SETTING UP THE MAIL GATEWAY' in %%DOCSDIR%%/README
 3. Restart Apache.
--- rt38-fix-siteconfig.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901221114.n0MBEK20004180>