Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jun 2000 07:45:11 -0500 (CDT)
From:      Mike Meyer <mwm@mired.org>
To:        freebsd-ports@freebsd.org
Subject:   localtest target for bsd.ports.mk
Message-ID:  <14679.20567.876221.287993@guru.mired.org>

next in thread | raw e-mail | index | archive | help
I'd like to be able to easily verify that a port didn't install any
files in /usr/local that it shouldn't have. The attached patch to
bsd.port.mk adds a "localtest" target that is a first pass at this.

Right now, it assumes that the port has been installed. This isn't
good, but having it depend on any of the cookies means that ports that
have been installed and cleaned will be built just to perform this
test. So instead, it just warns you if it doesn't have the PLIST
(because the port builds one); otherwise it lists files from the PLIST
that are in /usr/local.

Using "pkg_info -L" might make more sense, but I hate to depend on the
output format of pkg_info.

I'd be interested in hearing about other ways of getting a list of
files to check for.

The extension of this to x11test (for dependencies on X11BASE) is
obvious, and a "basetest" that does them both might be useful.  I've
also left the patches to bsd.port.subdir.mk to someone else.

	Thanx,
	<mike

--- bsd.port.mk-orig	Thu Jun 22 00:52:41 2000
+++ bsd.port.mk	Mon Jun 26 07:43:30 2000
@@ -994,6 +994,7 @@
 GZIP_CMD?=	/usr/bin/gzip -nf ${GZIP}
 LDCONFIG?=	/sbin/ldconfig
 LN?=		/bin/ln
+LS?=		/bin/ls
 MKDIR?=		/bin/mkdir -p
 MV?=		/bin/mv
 RM?=		/bin/rm
@@ -1004,6 +1005,7 @@
 TR?=		/usr/bin/tr
 TRUE?=		/usr/bin/true
 WHICH?=		/usr/bin/which
+XARGS?=		/usr/bin/xargs
 
 # Used to print all the '===>' style prompts - override this to turn them off.
 ECHO_MSG?=		${ECHO}
@@ -1924,6 +1926,16 @@
 
 .if !target(package)
 package: ${PACKAGE_COOKIE}
+.endif
+
+.if !target(localtest)
+localtest:
+.if !exists(${PLIST})
+	@${ECHO} "The port must be built before this test can be performed."
+.else
+	@${ECHO} "Any files listed may have been installed in /usr/local in error."
+	@-cat ${PKGDIR}/PLIST | ${SED} s:^:/usr/local/: | ${XARGS} ${LS} 2>/dev/null
+.endif
 .endif
 
 ${EXTRACT_COOKIE}:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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