aboutsummaryrefslogtreecommitdiff
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2017-04-19 18:32:50 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2017-04-19 18:32:50 +0000
commitd8a738baa63844323b3da09cbbee20a41334433d (patch)
tree52915bd8e58c6a67004906bb086a1814e94d677d /Mk/bsd.port.mk
parent271ca0bb04c6cca2d178727904549ce0cacbef51 (diff)
downloadports-d8a738baa63844323b3da09cbbee20a41334433d.tar.gz
ports-d8a738baa63844323b3da09cbbee20a41334433d.zip
Refactor do-package aka subpackages step 2
Now each files generated are explicit targets depending on the files This would allow to simply loop over a list of packages for subpackages to create them. Remove the code for transition from pkg_install to pkg packages The latest symlink is now a specific target only defined when needed Reviewed by: swills Approved by: portmgr (swills) Differential Revision: https://reviews.freebsd.org/D10323
Notes
Notes: svn path=/head/; revision=438901
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r--Mk/bsd.port.mk61
1 files changed, 30 insertions, 31 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 50135f7ffadf..1f3c93fd096e 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1057,7 +1057,7 @@ NOTPHONY?=
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 @@ do-test:
# 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: