Use pkg_info -r if present and fall back to pkg_delete for pkg_install

before 20090225. Intermediate versions get an explicit error.
The building of the recursive dependency was broken as the new
pkg_delete would stop without recursing and the target dependend on that
behavior. Reported by David Holland.
This commit is contained in:
joerg 2009-03-05 23:07:15 +00:00
parent 60adce083b
commit 5f28d6bebf

View file

@ -1,4 +1,4 @@
# $NetBSD: bsd.pkg.update.mk,v 1.15 2008/04/07 13:31:15 joerg Exp $
# $NetBSD: bsd.pkg.update.mk,v 1.16 2009/03/05 23:07:15 joerg Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and contains the targets
# and variables for "make update".
@ -126,11 +126,18 @@ ${_DDIR}: ${_DLIST}
${RUN} pkgs=`${CAT} ${_DLIST}`; \
if [ "$$pkgs" ]; then ${PKG_INFO} -Q PKGPATH $$pkgs; fi > ${_DDIR}
# Note that "pkg_info -qR" wouldn't work here, since it lists only the
# packages that require this package directly.
.if ${PKGTOOLS_VERSION} >= 20090302
${_DLIST}: ${WRKDIR}
${PKG_INFO} -qr "${PKGWILDCARD}" > ${_DLIST}
.elif ${PKGTOOLS_VERSION} >= 20090225
${_DLIST}: ${WRKDIR}
${RUN}echo "Please update to pkg_install-20090302 or later" 2>&1
${RUN}exit 1
.else
${_DLIST}: ${WRKDIR}
${RUN} \
${PKG_DELETE} -n "${PKGWILDCARD}" 2>&1 \
| ${GREP} '^ ' \
| ${AWK} '{ l[NR]=$$0 } END { for (i=NR;i>0;--i) print l[i] }' \
> ${_DLIST}
.endif