From owner-svn-ports-all@freebsd.org Sat Apr 8 18:17:46 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76029D34031; Sat, 8 Apr 2017 18:17:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 531EEA49; Sat, 8 Apr 2017 18:17:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v38IHjpu085933; Sat, 8 Apr 2017 18:17:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v38IHjnh085932; Sat, 8 Apr 2017 18:17:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201704081817.v38IHjnh085932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 8 Apr 2017 18:17:45 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r438058 - head/Mk X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Apr 2017 18:17:46 -0000 Author: bapt Date: Sat Apr 8 18:17:45 2017 New Revision: 438058 URL: https://svnweb.freebsd.org/changeset/ports/438058 Log: Use native make(1) mechanism to create the package repository directory In order to have subpackages we need in the end do-package to depend on a target per package that would be created per subpackages For this we need to decouple the content of do-package so it becomes a target that only creates the packages. As a first step use natural make(1) mechanism for a target: if checks first for the existence of a file and it it does not exists that execute the content of the target, in that case it creates the PKGREPOSITORY Bonus it simplifies a bit the code. While here to avoid testing multiple time for the PACKAGES directory set a variable after we tested it the first time PR: 216877 Approved by: portmgr (mat) Reviewed by: mat exp-run by: antoine Differential Revision: https://reviews.freebsd.org/D9466 Modified: head/Mk/bsd.port.mk Modified: head/Mk/bsd.port.mk ============================================================================== --- head/Mk/bsd.port.mk Sat Apr 8 18:00:04 2017 (r438057) +++ head/Mk/bsd.port.mk Sat Apr 8 18:17:45 2017 (r438058) @@ -1056,6 +1056,9 @@ STAGEDIR?= ${WRKDIR}/stage NOTPHONY?= MINIMAL_PKG_VERSION= 1.6.0 +_PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \ + ${STAGEDIR}${PREFIX} + # make sure bmake treats -V as expected .MAKE.EXPAND_VARIABLES= yes @@ -2502,6 +2505,7 @@ check-categories: PKGREPOSITORYSUBDIR?= All PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR} .if exists(${PACKAGES}) +_HAVE_PACKAGES= yes PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX} .else PKGFILE?= ${.CURDIR}/${PKGNAME}${PKG_SUFX} @@ -2936,9 +2940,6 @@ options-message: @${ECHO_MSG} "===> Found saved configuration for ${_OPTIONS_READ}" .endif -${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR}: - @${MKDIR} ${.TARGET} - # Warn user about deprecated packages. Advisory only. .if !target(check-deprecated) @@ -3090,7 +3091,7 @@ clean-wrkdir: @${RM} -r ${WRKDIR} .if !target(do-extract) -do-extract: +do-extract: ${EXTRACT_WRKDIR} @for file in ${EXTRACT_ONLY}; do \ if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ then \ @@ -3333,21 +3334,17 @@ do-test: # Package +.if defined(_HAVE_PACKAGES) +_EXTRA_PACKAGE_TARGET_DEP= ${PKGREPOSITORY} +_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 .endif -do-package: create-manifest -do-package: ${TMPPLIST} - @if [ -d ${PACKAGES} ]; then \ - if [ ! -d ${PKGREPOSITORY} ]; then \ - if ! ${MKDIR} ${PKGREPOSITORY}; then \ - ${ECHO_MSG} "=> Can't create directory ${PKGREPOSITORY}."; \ - exit 1; \ - fi; \ - fi; \ - fi +do-package: create-manifest ${_EXTRA_PACKAGE_TARGET_DEP} ${TMPPLIST} @for cat in ${CATEGORIES}; do \ ${RM} ${PACKAGES}/$$cat/${PKGNAMEPREFIX}${PORTNAME}*${PKG_SUFX} ; \ done @@ -4531,8 +4528,7 @@ compress-man: .endif .if !target(stage-dir) -stage-dir: - @${MKDIR} ${STAGEDIR}${PREFIX} +stage-dir: ${STAGEDIR}${PREFIX} .if !defined(NO_MTREE) @${MTREE_CMD} ${MTREE_ARGS} ${STAGEDIR}${PREFIX} > /dev/null .endif @@ -5186,6 +5182,9 @@ show-dev-errors: .endif .endif #DEVELOPER +${_PORTS_DIRECTORIES}: + @${MKDIR} ${.TARGET} + # Please note that the order of the following targets is important, and # should not be modified.