ports/74691: Fix pkg-plist handling for ports that set PREFIX
Kris Kennaway
kris at FreeBSD.org
Sat Dec 4 23:20:30 UTC 2004
>Number: 74691
>Category: ports
>Synopsis: Fix pkg-plist handling for ports that set PREFIX
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Dec 04 23:20:29 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Kris Kennaway
>Release: FreeBSD 4.10-STABLE i386
>Organization:
FreeBSD
>Environment:
System: FreeBSD xor.obsecurity.org 4.10-STABLE FreeBSD 4.10-STABLE #22: Sun Oct 17 18:01:25 PDT 2004 kkenn at xor.obsecurity.org:/usr/src-4.x/sys/compile/XOR i386
>Description:
If a ports sets a non-standard PREFIX, the directories it creates are
not properly removed at deinstallation time.
>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
- at unexec install-info --delete %D/info/kth-krb.info %D/info/dir
-info/kth-krb.info
- at 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
+ at dirrm bin
@dirrm include/ss
+ at dirrm include
+ at dirrm lib
+ at dirrm libexec
+ at dirrm man/cat1
+ at dirrm man/cat3
+ at dirrm man/cat5
+ at dirrm man/cat8
+ at dirrm man/man1
+ at dirrm man/man3
+ at dirrm man/man5
+ at dirrm man/man8
+ at dirrm man
+ at dirrm sbin
>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.
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.500
diff -u -r1.500 bsd.port.mk
--- bsd.port.mk 19 Nov 2004 13:45:07 -0000 1.500
+++ bsd.port.mk 4 Dec 2004 23:23:41 -0000
@@ -3576,7 +3576,7 @@
_INSTALL_SUSEQ= check-umask install-mtree pre-su-install \
pre-su-install-script do-install post-install \
post-install-script add-plist-info add-plist-docs \
- compress-man run-ldconfig fake-pkg security-check
+ add-plist-post compress-man run-ldconfig fake-pkg security-check
_PACKAGE_DEP= install
_PACKAGE_SEQ= package-message pre-package pre-package-script \
do-package post-package-script
@@ -4677,8 +4677,20 @@
@${ECHO_CMD} "@exec install-info %D/${INFO_PATH}/$i.info %D/${INFO_PATH}/dir" \
>> ${TMPPLIST}
.endfor
-.if !defined(NO_MTREE)
+.if (${PREFIX} != "/usr")
@${ECHO_CMD} "@unexec if [ -f %D/${INFO_PATH}/dir ]; then if sed -e '1,/Menu:/d' %D/${INFO_PATH}/dir | grep -q '^[*] '; then true; else rm %D/${INFO_PATH}/dir; fi; fi" >> ${TMPPLIST}
+.if (${PREFIX} != ${LOCALBASE} && ${PREFIX} != ${X11BASE} && ${PREFIX} != ${LINUXBASE})
+ @${ECHO_CMD} "@unexec rmdir %D/info 2> /dev/null || true" >> ${TMPPLIST}
+.endif
+.endif
+
+# If we're installing into a non-standard PREFIX, we need to remove that directory at
+# deinstall-time
+add-plist-post:
+.if (${PREFIX} != ${LOCALBASE} && ${PREFIX} != ${X11BASE} && ${PREFIX} != ${LINUXBASE} && ${PREFIX} != "/usr")
+ @${ECHO_CMD} "@unexec rmdir %D 2> /dev/null || true" >> ${TMPPLIST}
+.else
+ @${DO_NADA}
.endif
# Compress (or uncompress) and symlink manpages.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list