svn commit: r384436 - head/Mk
Bryan Drewery
bdrewery at FreeBSD.org
Tue Apr 21 18:16:32 UTC 2015
Author: bdrewery
Date: Tue Apr 21 18:16:31 2015
New Revision: 384436
URL: https://svnweb.freebsd.org/changeset/ports/384436
Log:
Add a STRICT_DEPENDS feature which validates dependencies are installed, does
not install missing ones, and considers any missing ones as fatal.
This will be used by Poudriere to validate dependency lines are correct.
An example case is:
RUN_DEPENDS= foo:${PORTSDIR}/ports-mgmt/bar where the port does not provide
anything named 'foo'. In every phase it will attempt to install the bar port
to satisfy the depdendency and continue to fail to satisfy it. This can
eventually lead to unexpected errors such as trying to install a port
in the 'stage' phase when running as non-root and will encounter a pkg(8)
permissions issue.
This sort of issue occurred in http://lists.freebsd.org/pipermail/freebsd-ports/2015-April/098892.html
Discussed with: bapt
With hat: portmgr
Modified:
head/Mk/bsd.port.mk
Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk Tue Apr 21 18:03:22 2015 (r384435)
+++ head/Mk/bsd.port.mk Tue Apr 21 18:16:31 2015 (r384436)
@@ -1018,6 +1018,9 @@ FreeBSD_MAINTAINER= portmgr at FreeBSD.org
# - If set, it will overwrite any existing package
# registration information in ${PKG_DBDIR}/${PKGNAME}.
# NO_DEPENDS - Don't verify build of dependencies.
+# STRICT_DEPENDS
+# - Verify dependencies but consider missing dependencies as
+# fatal.
# CHECKSUM_ALGORITHMS
# - Different checksum algorithms to check for verifying the
# integrity of the distfiles. The absence of the algorithm
@@ -4350,7 +4353,7 @@ _INSTALL_DEPENDS= \
else \
(cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \
fi; \
- else \
+ elif [ -z "${STRICT_DEPENDS}" ]; then \
(cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \
fi; \
${ECHO_MSG} "===> Returning to build of ${PKGNAME}";
@@ -4359,7 +4362,7 @@ _INSTALL_DEPENDS= \
${deptype:tl}-depends:
.if defined(${deptype}_DEPENDS)
.if !defined(NO_DEPENDS)
- @set -e ; for i in `${ECHO_CMD} "${${deptype}_DEPENDS}"`; do \
+ @set -e ; anynotfound=0; for i in `${ECHO_CMD} "${${deptype}_DEPENDS}"`; do \
prog=$${i%%:*}; \
if [ -z "$$prog" ]; then \
${ECHO_MSG} "Error: there is an empty port dependency in ${deptype}_DEPENDS."; \
@@ -4441,6 +4444,7 @@ ${deptype:tl}-depends:
fi; \
fi; \
if [ $$notfound != 0 ]; then \
+ anynotfound=1; \
${ECHO_MSG} "===> Verifying $$target for $$prog in $$dir"; \
if [ ! -d "$$dir" ]; then \
${ECHO_MSG} " => No directory for $$prog. Skipping.."; \
@@ -4448,7 +4452,12 @@ ${deptype:tl}-depends:
${_INSTALL_DEPENDS} \
fi; \
fi; \
- done
+ done; \
+ if [ -n "${STRICT_DEPENDS}" -a $${anynotfound} -eq 1 ]; then \
+ ${ECHO_MSG} "===> STRICT_DEPENDS set - Not installing missing dependencies."; \
+ ${ECHO_MSG} " This means a dependency is wrong since it was not satisfied in the ${deptype:tl}-depends phase."; \
+ exit 1; \
+ fi
.endif
.else
@${DO_NADA}
@@ -4458,7 +4467,7 @@ ${deptype:tl}-depends:
lib-depends:
.if defined(LIB_DEPENDS) && !defined(NO_DEPENDS)
@set -e ; \
- for i in ${LIB_DEPENDS}; do \
+ anynotfound=0; for i in ${LIB_DEPENDS}; do \
lib=$${i%%:*} ; \
dir=$${i#*:} ; \
target="${DEPENDS_TARGET}"; \
@@ -4466,6 +4475,7 @@ lib-depends:
${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $${lib}" ; \
libfile=`${SETENV} LIB_DIRS="${LIB_DIRS}" LOCALBASE="${LOCALBASE}" ${SH} ${SCRIPTSDIR}/find-lib.sh $${lib}` ; \
if [ -z "$${libfile}" ]; then \
+ anynotfound=1; \
${ECHO_MSG} " - not found"; \
${ECHO_MSG} "===> Verifying for $$lib in $$dir"; \
if [ ! -d "$$dir" ] ; then \
@@ -4476,7 +4486,12 @@ lib-depends:
else \
${ECHO_MSG} " - found ($${libfile})"; \
fi ; \
- done
+ done; \
+ if [ -n "${STRICT_DEPENDS}" -a $${anynotfound} -eq 1 ]; then \
+ ${ECHO_MSG} "===> STRICT_DEPENDS set - Not installing missing dependencies."; \
+ ${ECHO_MSG} " This means a dependency is wrong since it was not satisfied in the lib-depends phase."; \
+ exit 1; \
+ fi
.endif
.endif
More information about the svn-ports-all
mailing list