Subject: pkg/18994: Make print/apsfilter honor PKG_SYSCONFDIR
To: None <gnats-bugs@gnats.netbsd.org>
From: Julio Merino <jmmv@menta.net>
List: netbsd-bugs
Date: 11/09/2002 13:25:50
>Number:         18994
>Category:       pkg
>Synopsis:       Make print/apsfilter honor PKG_SYSCONFDIR
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 09 04:21:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Julio Merino
>Release:        NetBSD 1.6K
>Organization:
HispaBSD
>Environment:
	
	
System: NetBSD darkstar.local 1.6K NetBSD 1.6K (DARKSTAR) #130: Thu Nov 7 23:22:44 CET 2002 jmmv@darkstar.local:/var/build/kernel/DARKSTAR i386
Architecture: i386
Machine: i386
>Description:
	print/apsfilter does some weird hacks to install configuration files
	in ${PREFIX}/etc/apsfilter. The package should use PKG_SYSCONFDIR
	stuff to do this (including PKG_SYSCONFSUBDIR).

	Note that the package installs a symlink inside the configuration
	directory, so this needs to be managed with an INSTALL script.

>How-To-Repeat:
	
>Fix:
	Apply this patch:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/apsfilter/Makefile,v
retrieving revision 1.7
diff -u -u -r1.7 Makefile
--- Makefile	2002/09/13 06:53:35	1.7
+++ Makefile	2002/11/09 12:15:42
@@ -2,7 +2,7 @@
 #
 
 DISTNAME=	apsfilter-7.2.2
-PKGREVISION=	1
+PKGREVISION=	2
 CATEGORIES=	print
 MASTER_SITES=	http://www.apsfilter.org/download/
 
@@ -18,8 +18,6 @@
 DEPENDS+=	a2ps-[0-9]*:../../print/a2ps
 DEPENDS+=	psutils-[0-9]*:../../print/psutils
 
-DEINSTALL_FILE=	${WRKDIR}/.DEINSTALL
-
 WRKSRC=		${WRKDIR}/apsfilter
 
 HAS_CONFIGURE=	YES
@@ -27,6 +25,16 @@
 
 CONFIGURE_ARGS+=--prefix=${LOCALBASE}
 CONFIGURE_ARGS+=--with-shell=${SH}
+CONFIGURE_ARGS+=--sysconfdir=${PKG_SYSCONFDIR}
+
+PKG_SYSCONFSUBDIR?=	apsfilter
+CONF_FILES=	${PREFIX}/share/apsfilter/template/apsfilterrc \
+		${PKG_SYSCONFDIR}/apsfilterrc
+
+DEINSTALL_EXTRA_TMPL=	${.CURDIR}/INSTALL
+INSTALL_EXTRA_TMPL=	${.CURDIR}/INSTALL
+
+FILES_SUBST+=	PREFIX="${PREFIX}"
 
 post-patch:
 	for i in bin/apsfilter.in SETUP.in tools/prtmgmt; do		\
@@ -35,8 +43,9 @@
 		${MV} ${WRKSRC}/$$i.done ${WRKSRC}/$$i;			\
 	done
 
-	${SED} "s,@LOCALBASE@,${LOCALBASE},g" ${PKGDIR}/DEINSTALL	\
-		> ${DEINSTALL_FILE}
+#	${SED} "s,@LOCALBASE@,${LOCALBASE},g" ${PKGDIR}/DEINSTALL	\
+#		> ${DEINSTALL_FILE}
 
 .include "../../mk/ghostscript.mk"
+.include "../../mk/bsd.pkg.install.mk"
 .include "../../mk/bsd.pkg.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/print/apsfilter/PLIST,v
retrieving revision 1.4
diff -u -u -r1.4 PLIST
--- PLIST	2002/03/09 13:58:03	1.4
+++ PLIST	2002/11/09 12:15:42
@@ -2,7 +2,6 @@
 bin/aps2file
 bin/apsfilter-bug
 bin/apspreview
-etc/apsfilter/basedir
 man/man1/aps2file.1
 man/man1/apsfilter-bug.1
 man/man1/apsfilter.1
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/print/apsfilter/distinfo,v
retrieving revision 1.4
diff -u -u -r1.4 distinfo
--- distinfo	2002/05/14 17:27:26	1.4
+++ distinfo	2002/11/09 12:15:42
@@ -2,5 +2,7 @@
 
 SHA1 (apsfilter-7.2.2.tar.gz) = be43c7651cbec09cef09d6855c8e9b0fb59fb3c6
 Size (apsfilter-7.2.2.tar.gz) = 352011 bytes
-SHA1 (patch-aa) = 144c2cfeb15d00d036dc468a9be7579d39c4581d
+SHA1 (patch-aa) = 200031f114ae994843c1961eba49b09a20fdb970
 SHA1 (patch-ab) = 0da86a8669845a62ea356a61ad97bc961e2d01b8
+SHA1 (patch-ac) = a8ace4d2f9fcdf049981bb8f2c3f48b28e4f4cf9
+SHA1 (patch-ad) = 4a692324f2452aee9c588bd4ba8b15e3529de710
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/print/apsfilter/patches/patch-aa,v
retrieving revision 1.2
diff -u -u -r1.2 patch-aa
--- patch-aa	2002/03/09 13:58:04	1.2
+++ patch-aa	2002/11/09 12:15:42
@@ -1,8 +1,15 @@
 $NetBSD: patch-aa,v 1.2 2002/03/09 13:58:04 martti Exp $
 
 --- Makefile.in.orig	Sun Feb 24 21:47:45 2002
-+++ Makefile.in	Wed Feb 27 10:41:18 2002
-@@ -18,9 +18,9 @@
++++ Makefile.in
+@@ -12,15 +12,15 @@ docdir=${DESTDIR}@docdir@
+ 
+ APSSHARE=${datadir}/apsfilter
+ APSDOC=${docdir}/apsfilter
+-APSCONF=${sysconfdir}/apsfilter
++APSCONF=${sysconfdir}
+ 
+ MKDIR=mkdir -p
  RM=rm -f
  LN=ln -sfn
  
@@ -15,3 +22,19 @@
  
  .PHONY: all install update clean distclean
  
+@@ -33,7 +33,6 @@ update:
+ 	${MKDIR} ${mandir}/man1
+ 	${MKDIR} ${mandir}/man5
+ 	${MKDIR} ${APSDOC}
+-	${MKDIR} ${APSCONF}
+ 	${MKDIR} ${APSSHARE}
+ 	${MKDIR} ${APSSHARE}/bin
+ 	${MKDIR} ${APSSHARE}/setup
+@@ -79,7 +78,6 @@ update:
+ 	${INSTALL_DATA}   man/apsfilter-bug.1	${mandir}/man1/apsfilter-bug.1
+ 	${INSTALL_DATA}   man/apsfilterrc.5	${mandir}/man5/apsfilterrc.5
+ 	tar cf - driver | ( cd ${APSSHARE} && tar xf -)
+-	${LN} ${APSSHARE} ${APSCONF}/basedir
+ 
+ clean:
+ 	(cd doc; make clean)


	Now remove the DEINSTALL script and add this one, named INSTALL,
	which will handle both (de)installation steps.

#!/bin/sh
#
# $NetBSD$

PREFIX="@PREFIX@"

case ${STAGE} in
POST-INSTALL)
	${LN} -s ${PREFIX}/share/apsfilter ${PKG_SYSCONFDIR}/basedir
	;;
DEINSTALL)
	${RM} ${PKG_SYSCONFDIR}/basedir

	cat << EOF
===========================================================================
If you will not be using apsfilter any longer, you may want to remove
apsfilter's configuration directory (${PKG_SYSCONFDIR}) and the
SETUP.cfg configuration file from apsfilter's directory
(${PREFIX}/share/apsfilter/SETUP.cfg).
===========================================================================
EOF
	;;
esac


	Add this patch as patch-ac (this is not really needed, but will avoid
	confusion if somebody looks at configure's output):

$NetBSD$

--- configure.orig	Thu Jan 10 21:44:48 2002
+++ configure
@@ -237,7 +237,6 @@ Using following values as defaults:
     datadir		$datadir
 			(will become $datadir/apsfilter)
     sysconfdir		$sysconfdir
-			(will become $sysconfdir/apsfilter)
     mandir		$mandir
     docdir		$docdir
 			(will become $docdir/apsfilter)


	And this other, as patch-ad (this is required because we are using
	PKG_SYSCONFSUBDIR, so a user could change it):

$NetBSD$

--- SETUP.in.orig	Sun Feb 24 21:47:45 2002
+++ SETUP.in
@@ -1816,7 +1816,7 @@ fail()
 
 export APS_BASEDIR="@datadir@/apsfilter"
 cd "$APS_BASEDIR"
-CONF_DIR="@sysconfdir@/apsfilter"
+CONF_DIR="@sysconfdir@"
 SPOOL="@spooldir@"
 
 # check read/write permissions


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