Mon Nov 28 23:15:34 2022 UTC ()
check-files.mk: fix execution when CHECK_FILES_STRICT=yes

Commit r. 1.2044 "mk: Don't define DO_NADA to true." of bsd.pkg.mk
caused the checks executed when CHECK_FILES_STRICT=yes is set to fail
(e.g., "/bin/sh: -c: line 1: syntax error near unexpected token `;'").

(The pre-existing coding style that uses "true;" rather than a bare ":"
instead has been retained, in case there is an obscure (?) reason for
that approach.)


(gutteridge)
diff -r1.38 -r1.39 pkgsrc/mk/check/check-files.mk

cvs diff -r1.38 -r1.39 pkgsrc/mk/check/check-files.mk (expand / switch to unified diff)

--- pkgsrc/mk/check/check-files.mk 2022/11/23 11:55:43 1.38
+++ pkgsrc/mk/check/check-files.mk 2022/11/28 23:15:34 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: check-files.mk,v 1.38 2022/11/23 11:55:43 jperkin Exp $ 1# $NetBSD: check-files.mk,v 1.39 2022/11/28 23:15:34 gutteridge Exp $
2# 2#
3# This file checks that the list of installed files matches the PLIST. 3# This file checks that the list of installed files matches the PLIST.
4# For that purpose it records the file list of LOCALBASE before and 4# For that purpose it records the file list of LOCALBASE before and
5# after the installation of the package and compares these lists with 5# after the installation of the package and compares these lists with
6# the PLIST. 6# the PLIST.
7# 7#
8# User-settable variables: 8# User-settable variables:
9# 9#
10# CHECK_FILES 10# CHECK_FILES
11# "yes" to enable the check, "no" to disable it. 11# "yes" to enable the check, "no" to disable it.
12# 12#
13# Default value: "yes" 13# Default value: "yes"
14# 14#
@@ -330,47 +330,47 @@ ${_CHECK_FILES_ERRMSG.prefix}: \ @@ -330,47 +330,47 @@ ${_CHECK_FILES_ERRMSG.prefix}: \
330 "PLIST and CHECK_FILES_SKIP:"; \ 330 "PLIST and CHECK_FILES_SKIP:"; \
331 ${SED} "s|^| |" ${_CHECK_FILES_MISSING_SKIP}; \ 331 ${SED} "s|^| |" ${_CHECK_FILES_MISSING_SKIP}; \
332 fi >> ${.TARGET} 332 fi >> ${.TARGET}
333 333
334# Check ${PKG_SYSCONFDIR} for files which are not in the PLIST and are 334# Check ${PKG_SYSCONFDIR} for files which are not in the PLIST and are
335# also not copied into place by the INSTALL scripts.  335# also not copied into place by the INSTALL scripts.
336# 336#
337${_CHECK_FILES_ERRMSG.sysconfdir}: \ 337${_CHECK_FILES_ERRMSG.sysconfdir}: \
338 ${_CHECK_FILES_PRE.sysconfdir} \ 338 ${_CHECK_FILES_PRE.sysconfdir} \
339 ${_CHECK_FILES_POST.sysconfdir} 339 ${_CHECK_FILES_POST.sysconfdir}
340 ${RUN} \ 340 ${RUN} \
341 if ${CMP} -s ${_CHECK_FILES_PRE.sysconfdir} \ 341 if ${CMP} -s ${_CHECK_FILES_PRE.sysconfdir} \
342 ${_CHECK_FILES_POST.sysconfdir}; then \ 342 ${_CHECK_FILES_POST.sysconfdir}; then \
343 ${DO_NADA}; \ 343 ${TRUE}; \
344 else \ 344 else \
345 ${ECHO} "************************************************************"; \ 345 ${ECHO} "************************************************************"; \
346 ${ECHO} "The package has modified ${PKG_SYSCONFDIR}" \ 346 ${ECHO} "The package has modified ${PKG_SYSCONFDIR}" \
347 "contents directly!"; \ 347 "contents directly!"; \
348 ${ECHO} " The offending files/directories are:"; \ 348 ${ECHO} " The offending files/directories are:"; \
349 ${DIFF} -u ${_CHECK_FILES_PRE.sysconfdir} \ 349 ${DIFF} -u ${_CHECK_FILES_PRE.sysconfdir} \
350 ${_CHECK_FILES_POST.sysconfdir} | \ 350 ${_CHECK_FILES_POST.sysconfdir} | \
351 ${GREP} '^+[^+]' | ${SED} "s|^+| |"; \ 351 ${GREP} '^+[^+]' | ${SED} "s|^+| |"; \
352 fi > ${.TARGET} 352 fi > ${.TARGET}
353 353
354# Check ${VARBASE} for files which are not in the PLIST and are also 354# Check ${VARBASE} for files which are not in the PLIST and are also
355# not created by the INSTALL scripts. 355# not created by the INSTALL scripts.
356# 356#
357${_CHECK_FILES_ERRMSG.varbase}: \ 357${_CHECK_FILES_ERRMSG.varbase}: \
358 ${_CHECK_FILES_PRE.varbase} \ 358 ${_CHECK_FILES_PRE.varbase} \
359 ${_CHECK_FILES_POST.varbase} 359 ${_CHECK_FILES_POST.varbase}
360 ${RUN} \ 360 ${RUN} \
361 if ${CMP} -s ${_CHECK_FILES_PRE.varbase} \ 361 if ${CMP} -s ${_CHECK_FILES_PRE.varbase} \
362 ${_CHECK_FILES_POST.varbase}; then \ 362 ${_CHECK_FILES_POST.varbase}; then \
363 ${DO_NADA}; \ 363 ${TRUE}; \
364 else \ 364 else \
365 ${ECHO} "************************************************************"; \ 365 ${ECHO} "************************************************************"; \
366 ${ECHO} "The package has modified ${VARBASE}" \ 366 ${ECHO} "The package has modified ${VARBASE}" \
367 "contents directly!"; \ 367 "contents directly!"; \
368 ${ECHO} " The offending files/directories are:"; \ 368 ${ECHO} " The offending files/directories are:"; \
369 ${DIFF} -u ${_CHECK_FILES_PRE.varbase} \ 369 ${DIFF} -u ${_CHECK_FILES_PRE.varbase} \
370 ${_CHECK_FILES_POST.varbase} | \ 370 ${_CHECK_FILES_POST.varbase} | \
371 ${GREP} '^+[^+]' | ${SED} "s|^+| |"; \ 371 ${GREP} '^+[^+]' | ${SED} "s|^+| |"; \
372 fi > ${.TARGET} 372 fi > ${.TARGET}
373 373
374########################################################################### 374###########################################################################
375# check-files-clean removes the state files related to the "check-files" 375# check-files-clean removes the state files related to the "check-files"
376# target so that the check-files-{pre,post} targets may be re-run. 376# target so that the check-files-{pre,post} targets may be re-run.