Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 2013 23:49:22 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r329130 - head/Mk
Message-ID:  <201310022349.r92NnMsI090750@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Wed Oct  2 23:49:21 2013
New Revision: 329130
URL: http://svnweb.freebsd.org/changeset/ports/329130

Log:
  - Fix 'package' with staging+pkg_install when ports are read-only by creating
    the package in STAGEDIR and then linking/copying it over to PACKAGES if
    possible
  
  With hat:	portmgr
  Reviewed by:	bapt (earlier version)
  Tested by:	Stefan Bethke <stb@lassitu.de>
  Reported by:	many

Modified:
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Wed Oct  2 23:38:51 2013	(r329129)
+++ head/Mk/bsd.port.mk	Wed Oct  2 23:49:21 2013	(r329130)
@@ -3876,8 +3876,10 @@ do-package: ${TMPPLIST}
 	if [ -f ${PKGMESSAGE} ]; then \
 		_LATE_PKG_ARGS="$${_LATE_PKG_ARGS} -D ${PKGMESSAGE}"; \
 	fi; \
-	if ${PKG_CMD} -S ${STAGEDIR} ${PKG_ARGS} ${PKGFILE}; then \
-		if [ -d ${PACKAGES} ]; then \
+	if ${PKG_CMD} -S ${STAGEDIR} ${PKG_ARGS} ${WRKDIR}/${PKGNAME}${PKG_SUFX}; then \
+		if [ -d ${PACKAGES} -a -w ${PACKAGES} ]; then \
+			${LN} -f ${WRKDIR}/${PKGNAME}${PKG_SUFX} ${PKGFILE} 2>/dev/null || \
+			    ${CP} -af ${WRKDIR}/${PKGNAME}${PKG_SUFX} ${PKGFILE}; \
 			cd ${.CURDIR} && eval ${MAKE} package-links; \
 		fi; \
 	else \
@@ -3923,7 +3925,12 @@ delete-package-links:
 
 .if !target(delete-package)
 delete-package: delete-package-links
+.	if defined(NO_STAGE)
 	@${RM} -f ${PKGFILE}
+.	else
+# When staging, the package may only be in the workdir if not root
+	@${RM} -f ${PKGFILE} ${WRKDIR}/${PKGNAME}${PKG_SUFX} 2>/dev/null || :
+.	endif
 .endif
 
 .if !target(delete-package-links-list)
@@ -3941,12 +3948,13 @@ delete-package-list: delete-package-link
 	@${ECHO_CMD} "[ -f ${PKGFILE} ] && (${ECHO_CMD} deleting ${PKGFILE}; ${RM} -f ${PKGFILE})"
 .endif
 
+# Only used if !defined(NO_STAGE)
 .if !target(install-package)
 install-package:
 .if defined(FORCE_PKG_REGISTER)
-	@${PKG_ADD} -f ${PKGFILE}
+	@${PKG_ADD} -f ${WRKDIR}/${PKGNAME}${PKG_SUFX}
 .else
-	@${PKG_ADD} ${PKGFILE}
+	@${PKG_ADD} ${WRKDIR}/${PKGNAME}${PKG_SUFX}
 .endif
 .endif
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310022349.r92NnMsI090750>