Index: head/Mk/bsd.port.mk =================================================================== --- head/Mk/bsd.port.mk +++ head/Mk/bsd.port.mk @@ -1057,7 +1057,7 @@ MINIMAL_PKG_VERSION= 1.6.0 _PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \ - ${STAGEDIR}${PREFIX} + ${STAGEDIR}${PREFIX} ${WRKDIR}/pkg # make sure bmake treats -V as expected .MAKE.EXPAND_VARIABLES= yes @@ -3286,43 +3286,42 @@ # Package .if defined(_HAVE_PACKAGES) -_EXTRA_PACKAGE_TARGET_DEP= ${PKGREPOSITORY} +_EXTRA_PACKAGE_TARGET_DEP+= ${PKGFILE} _PORTS_DIRECTORIES+= ${PKGREPOSITORY} -.endif -.if !target(do-package) -PKG_CREATE_ARGS= -r ${STAGEDIR} -m ${METADIR} -p ${TMPPLIST} -.if defined(PKG_CREATE_VERBOSE) -PKG_CREATE_ARGS+= -v +${PKGFILE}: ${WRKDIR_PKGFILE} ${PKGREPOSITORY} + @${LN} -f ${WRKDIR_PKGFILE} ${PKGFILE} 2>/dev/null \ + || ${CP} -f ${WRKDIR_PKGFILE} ${PKGFILE} + +. if ${PKGORIGIN} == "ports-mgmt/pkg" || ${PKGORIGIN} == "ports-mgmt/pkg-devel" +_EXTRA_PACKAGE_TARGET_DEP+= ${PKGLATESTREPOSITORY} +_PORTS_DIRECTORIES+= ${PKGLATESTREPOSITORY} +_EXTRA_PACKAGE_TARGET_DEP+= ${PKGLATESTFILE} + +${PKGLATESTFILE}: ${PKGFILE} ${PKGLATESTREPOSITORY} + ${INSTALL} -l rs ${PKGFILE} ${PKGLATESTFILE} +. endif + .endif -do-package: create-manifest ${_EXTRA_PACKAGE_TARGET_DEP} ${TMPPLIST} - @for cat in ${CATEGORIES}; do \ - ${RM} ${PACKAGES}/$$cat/${PKGNAMEPREFIX}${PORTNAME}*${PKG_SUFX} ; \ - done - @${MKDIR} ${WRKDIR}/pkg - @if ${SETENV} ${PKG_ENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_CREATE} ${PKG_CREATE_ARGS} -f ${PKG_SUFX:S/.//} -o ${WRKDIR}/pkg ${PKGNAME}; then \ - if [ -d ${PKGREPOSITORY} -a -w ${PKGREPOSITORY} ]; then \ - ${LN} -f ${WRKDIR_PKGFILE} ${PKGFILE} 2>/dev/null \ - || ${CP} -f ${WRKDIR_PKGFILE} ${PKGFILE}; \ - if [ "${PKGORIGIN}" = "ports-mgmt/pkg" -o "${PKGORIGIN}" = "ports-mgmt/pkg-devel" ]; then \ - if [ ! -d ${PKGLATESTREPOSITORY} ]; then \ - if ! ${MKDIR} ${PKGLATESTREPOSITORY}; then \ - ${ECHO_MSG} "=> Can't create directory ${PKGLATESTREPOSITORY}."; \ - exit 1; \ - fi; \ - fi ; \ - ${LN} -sf ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PKGLATESTFILE} ; \ - fi; \ - elif [ ! -d ${PACKAGES} ]; then \ - ${LN} -f ${WRKDIR_PKGFILE} ${PKGFILE} 2>/dev/null \ - || ${CP} -f ${WRKDIR_PKGFILE} ${PKGFILE}; \ - fi; \ - else \ + +# from here this will become a loop for subpackages +${WRKDIR_PKGFILE}: ${TMPPLIST} create-manifest ${WRKDIR}/pkg + @if ! ${SETENV} ${PKG_ENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_CREATE} ${PKG_CREATE_ARGS} -m ${METADIR} -p ${TMPPLIST} -f ${PKG_SUFX:S/.//} -o ${WRKDIR}/pkg ${PKGNAME}; then \ cd ${.CURDIR} && eval ${MAKE} delete-package >/dev/null; \ exit 1; \ fi + # +# Temporary will be later dynamically added per subpackages +_EXTRA_PACKAGE_TARGET_DEP+= ${WRKDIR_PKGFILE} +# This will be the end of the loop + +.if !target(do-package) +PKG_CREATE_ARGS= -r ${STAGEDIR} +. if defined(PKG_CREATE_VERBOSE) +PKG_CREATE_ARGS+= -v +. endif +do-package: ${_EXTRA_PACKAGE_TARGET_DEP} ${WRKDIR}/pkg .endif -# Some support rules for do-package .if !target(delete-package) delete-package: