pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk/check



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Jan 21 02:12:20 UTC 2024

Modified Files:
        pkgsrc/mk/check: check-files.mk

Log Message:
mk/check-files: allow detection of packages that install outside PREFIX

An example package that does this is textproc/p5-Publican, many other
packages are fine.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 pkgsrc/mk/check/check-files.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/check/check-files.mk
diff -u pkgsrc/mk/check/check-files.mk:1.45 pkgsrc/mk/check/check-files.mk:1.46
--- pkgsrc/mk/check/check-files.mk:1.45 Sun Jan 21 00:34:26 2024
+++ pkgsrc/mk/check/check-files.mk      Sun Jan 21 02:12:20 2024
@@ -1,4 +1,4 @@
-# $NetBSD: check-files.mk,v 1.45 2024/01/21 00:34:26 rillig Exp $
+# $NetBSD: check-files.mk,v 1.46 2024/01/21 02:12:20 rillig Exp $
 #
 # This file checks that the list of installed files matches the PLIST.
 # For that purpose it records the file list of LOCALBASE before and
@@ -16,6 +16,10 @@
 #      When set to "yes", VARBASE and PKG_SYSCONFDIR are checked in
 #      addition to LOCALBASE.
 #
+# CHECK_FILES_ONLY_PREFIX
+#      When set to "yes", the only directory below DESTDIR that may be
+#      modified during installation is PREFIX itself.
+#
 # Package-settable variables:
 #
 # CHECK_FILES_SKIP
@@ -26,7 +30,8 @@
 #
 
 _VARGROUPS+=                   check-files
-_USER_VARS.check-files=                CHECK_FILES CHECK_FILES_STRICT
+_USER_VARS.check-files=                \
+       CHECK_FILES CHECK_FILES_STRICT CHECK_FILES_ONLY_PREFIX
 _PKG_VARS.check-files=         CHECK_FILES_SUPPORTED CHECK_FILES_SKIP
 _USE_VARS.check-files=         \
        DESTDIR PREFIX PKG_SYSCONFDIR VARBASE PKG_DBDIR DISTDIR PACKAGES \
@@ -40,8 +45,9 @@ _LISTED_VARS.check-files=     MAKE_DIRS MAKE
 _SORTED_VARS.check-files=      CHECK_FILES_SKIP
 
 
-CHECK_FILES?=          yes
-CHECK_FILES_STRICT?=   no
+CHECK_FILES?=                  yes
+CHECK_FILES_STRICT?=           no
+CHECK_FILES_ONLY_PREFIX?=      no
 
 # Info index files updated when a new info file is added.
 .if defined(INFO_FILES)
@@ -145,12 +151,17 @@ _CHECK_FILES_ERRMSG.varbase=      ${ERROR_DIR
 _CHECK_FILES_PRE.varbase=      ${WRKDIR}/.check-files.varbase.pre
 _CHECK_FILES_POST.varbase=     ${WRKDIR}/.check-files.varbase.post
 
+_CHECK_FILES_ERRMSG.only-prefix=       ${ERROR_DIR}/check-files-only-prefix
+
 _CHECK_FILES_ERRMSGS=          # empty
 _CHECK_FILES_ERRMSGS+=         ${_CHECK_FILES_ERRMSG.prefix}
 .if ${CHECK_FILES_STRICT:tl} != no
 _CHECK_FILES_ERRMSGS+=         ${_CHECK_FILES_ERRMSG.sysconfdir}
 _CHECK_FILES_ERRMSGS+=         ${_CHECK_FILES_ERRMSG.varbase}
 .endif
+.if ${CHECK_FILES_ONLY_PREFIX:tl} == yes
+_CHECK_FILES_ERRMSGS+=         ${_CHECK_FILES_ERRMSG.only-prefix}
+.endif
 
 ###########################################################################
 # _CHECK_FILES_PRE holds the list of targets that are built as part of
@@ -378,6 +389,17 @@ ${_CHECK_FILES_ERRMSG.varbase}:                                            \
                ${GREP} '^+[^+]' | ${SED} "s|^+|        |";             \
        fi > ${.TARGET}
 
+${_CHECK_FILES_ERRMSG.only-prefix}:
+       ${RUN}                                                          \
+       files=${WRKDIR}/.check-files-only-prefix;                       \
+       ${FIND} ${DESTDIR} \( -type f -o -type l \) -print              \
+       | ${GREP} -v '^${DESTDIR}${PREFIX}/' > "$$files" || :;          \
+       if [ -s "$$files" ]; then                                       \
+               ${ECHO} "************************************************************"; \
+               ${ECHO} "The package has installed files outside ${PREFIX}:"; \
+               ${SED} -e 's,^,        ,' "$$files";                    \
+       fi > ${.TARGET}
+
 ###########################################################################
 # check-files-clean removes the state files related to the "check-files"
 # target so that the check-files-{pre,post} targets may be re-run.



Home | Main Index | Thread Index | Old Index