Bug 74691

Summary: Fix pkg-plist handling for ports that set PREFIX
Product: Ports & Packages Reporter: Kris Kennaway <kris>
Component: Individual Port(s)Assignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Kris Kennaway freebsd_committer freebsd_triage 2004-12-04 23:20:29 UTC
If a ports sets a non-standard PREFIX, the directories it creates are
not properly removed at deinstallation time.

Fix: This bsd.port.mk patch attempts to fix the plist handling for
non-standard prefixes.  The code that removes info/dir was conditional
on !NO_MTREE; according to r1.342 this was intended to deal with ports
that install with PREFIX=/usr, so make the code actually work that
way.

This fixes the first part of the problem, and /usr/local/krb4/info/dir
will be removed at deinstall time, but /usr/local/krb4/info and
/usr/local/krb4 remain, so change add-plist-info to silently try to
remove the former if we're installing with a non-standard prefix, and
add a new add-plist-post target that tries to silently remove the
latter after all the other plist munging has completed.
How-To-Repeat: 
See e.g. the krb4 port, which leaves behind a lot of files in
/usr/local/krb4.  The following patch is the best we can do with the
current bsd.port.mk, but the info/dir file and /usr/local/krb4 are
left behind.  The add-plist-info target appends to the pkg-plist file,
so there is no way we can completely remove /usr/local/krb4 ourselves
without bsd.port.mk help.

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/security/krb4/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile	23 Feb 2004 14:03:37 -0000	1.2
+++ Makefile	4 Dec 2004 22:58:15 -0000
@@ -18,6 +18,7 @@
 # which have the same name as some in the base system (e.g.
 # ftp, telnet, su).
 PREFIX?=	${LOCALBASE}/krb4
+NO_MTREE=	yes	# Otherwise we end up with dozens of extra directories in ${PREFIX}
 
 PKGMESSAGE=	${WRKDIR}/pkg-message
 GNU_CONFIGURE=	yes
@@ -31,6 +32,8 @@
 	"CPPFLAGS=-DOPENSSL_DES_LIBDES_COMPATIBILITY" \
 	"LDFLAGS=-Wl,-rpath,${PREFIX}/lib"
 
+INFO=	kth-krb
+
 post-install:
 	install-info ${PREFIX}/info/kth-krb.info ${PREFIX}/info/dir
 	${SED} -e "s~%%PREFIX%%~${PREFIX}~g" \
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/security/krb4/pkg-plist,v
retrieving revision 1.2
diff -u -r1.2 pkg-plist
--- pkg-plist	5 Apr 2003 17:00:44 -0000	1.2
+++ pkg-plist	4 Dec 2004 23:06:22 -0000
@@ -48,9 +48,6 @@
 include/sl.h
 include/ss/ss.h
 include/xdbm.h
-@unexec install-info --delete %D/info/kth-krb.info %D/info/dir
-info/kth-krb.info
-@exec install-info %D/info/kth-krb.info %D/info/dir
 lib/libacl.a
 lib/libacl.so
 lib/libacl.so.1
@@ -100,4 +97,18 @@
 sbin/kdb_util
 sbin/ksrvutil
 sbin/kstash
+@dirrm bin
 @dirrm include/ss
+@dirrm include
+@dirrm lib
+@dirrm libexec
+@dirrm man/cat1
+@dirrm man/cat3
+@dirrm man/cat5
+@dirrm man/cat8
+@dirrm man/man1
+@dirrm man/man3
+@dirrm man/man5
+@dirrm man/man8
+@dirrm man
+@dirrm sbin
Comment 1 Kris Kennaway freebsd_committer freebsd_triage 2004-12-04 23:23:22 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Assign to bsd.port.mk janitors
Comment 2 Kirill Ponomarev freebsd_committer freebsd_triage 2004-12-09 22:12:42 UTC
State Changed
From-To: open->closed

Committed, thanks!