Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2012 19:51:30 +0000 (UTC)
From:      Beat Gaetzi <beat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r304594 - head/Mk
Message-ID:  <201209201951.q8KJpUNr085151@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: beat
Date: Thu Sep 20 19:51:30 2012
New Revision: 304594
URL: http://svn.freebsd.org/changeset/ports/304594

Log:
  - Remove ftp fallback as all supported FreeBSD versions provide fetch [1]
  - Don't call 'pre-config' twice in the 'config-conditional' target [2]
  - Clean up pkgng metadir so that the 'clean' target can be executed without
    root permissions if the build was done with a non-root user. [3]
  - Make 'do-package' atomic while creating the pkg file [4]
  
  PR:		ports/171161 [2], ports/171329 [3], ports/171672 [4]
  Submitted by:	bapt [1], A.J. Kehoe IV (Nanoman) <m7k60pkr@nanoman.ca> [2],
  Submitted by:	bdrewery [3, 4]
  Reported by:	Kimmo Paasiala <kpaasial@gmail.com> [3]
  Tested by:	Exp-run on pointyhat, bapt (pkgng changes)

Modified:
  head/Mk/bsd.pkgng.mk
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.pkgng.mk
==============================================================================
--- head/Mk/bsd.pkgng.mk	Thu Sep 20 19:34:53 2012	(r304593)
+++ head/Mk/bsd.pkgng.mk	Thu Sep 20 19:51:30 2012	(r304594)
@@ -123,6 +123,7 @@ fake-pkg:
 .else
 	@${PKG_CMD} -l -m ${METADIR} -f ${TMPPLIST}
 .endif
+	@${RM} -rf ${METADIR}
 .else
 	@${DO_NADA}
 .endif
@@ -230,11 +231,16 @@ do-package: ${TMPPLIST}
 			fi; \
 		fi; \
 	fi;
-	@if ${PKG_CREATE} -o ${PKGREPOSITORY} ${PKGNAME}; then \
+	@TMPPKGREPOSITORY=$$(mktemp -dt pkg); \
+	trap "${RM} -rf $${TMPPKGREPOSITORY}; exit 1" 1 2 3 5 10 13 15; \
+	if ${PKG_CREATE} -o $${TMPPKGREPOSITORY} ${PKGNAME}; then \
+		${MV} -f $${TMPPKGREPOSITORY}/${PKGNAME}${PKG_SUFX} ${PKGREPOSITORY}; \
+		${RM} -rf $${TMPPKGREPOSITORY}; \
 		if [ -d ${PACKAGES} ]; then \
 			cd ${.CURDIR} && eval ${MAKE} package-links; \
 		fi; \
 	else \
+		${RM} -rf $${TMPPKGREPOSITORY}; \
 		cd ${.CURDIR} && eval ${MAKE} delete-package; \
 		exit 1; \
 	fi

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Thu Sep 20 19:34:53 2012	(r304593)
+++ head/Mk/bsd.port.mk	Thu Sep 20 19:51:30 2012	(r304594)
@@ -2246,18 +2246,12 @@ MAKE_ENV+=	PATH=${LOCALBASE}/libexec/cca
 PTHREAD_CFLAGS?=
 PTHREAD_LIBS?=		-pthread
 
-.if exists(/usr/bin/fetch)
 FETCH_BINARY?=	/usr/bin/fetch
 FETCH_ARGS?=	-AFpr
 FETCH_REGET?=	1
 .if !defined(DISABLE_SIZE)
 FETCH_BEFORE_ARGS+=	$${CKSIZE:+-S $$CKSIZE}
 .endif
-.else
-FETCH_BINARY?=	/usr/bin/ftp
-FETCH_ARGS?=	-R
-FETCH_REGET?=	0
-.endif
 FETCH_CMD?=		${FETCH_BINARY} ${FETCH_ARGS}
 
 .if defined(RANDOMIZE_MASTER_SITES)
@@ -3911,11 +3905,15 @@ do-package: ${TMPPLIST}
 			fi; \
 		fi; \
 	fi
-	@if ${PKG_CMD} -b ${PKGNAME} ${PKGFILE}; then \
+	@TMPPKGFILE=$$(mktemp -t pkg); \
+	trap "${RM} -f $${TMPPKGFILE} $${TMPPKGFILE}${PKG_SUFX}; exit 1" 1 2 3 5 10 13 15; \
+	if ${PKG_CMD} -b ${PKGNAME} $${TMPPKGFILE}; then \
+		${MV} -f $${TMPPKGFILE}${PKG_SUFX} ${PKGFILE}; \
 		if [ -d ${PACKAGES} ]; then \
 			cd ${.CURDIR} && eval ${MAKE} package-links; \
 		fi; \
 	else \
+		${RM} -f $${TMPPKGFILE}; \
 		cd ${.CURDIR} && eval ${MAKE} delete-package; \
 		exit 1; \
 	fi
@@ -6089,8 +6087,8 @@ DEFOPTIONS+=	${opt} "S(${single}): "${${
 .undef opt
 .endif # pre-config
 
-.if !target(config)
-config: pre-config
+.if !target(do-config)
+do-config:
 .if empty(ALL_OPTIONS) && empty(OPTIONS_SINGLE) && empty(OPTIONS_MULTI)
 	@${ECHO_MSG} "===> No options to configure"
 .else
@@ -6141,6 +6139,10 @@ config: pre-config
 	${RM} -f $${TMPOPTIONSFILE}
 	@cd ${.CURDIR} && ${MAKE} sanity-config
 .endif
+.endif # do-config
+
+.if !target(config)
+config: pre-config do-config
 .endif # config
 
 .if !target(config-recursive)
@@ -6155,7 +6157,7 @@ config-recursive:
 config-conditional: pre-config
 .if defined(COMPLETE_OPTIONS_LIST) && !defined(NO_DIALOG)
 .  if !defined(_FILE_COMPLETE_OPTIONS_LIST) || ${COMPLETE_OPTIONS_LIST:O} != ${_FILE_COMPLETE_OPTIONS_LIST:O}
-	@cd ${.CURDIR} && ${MAKE} config;
+	@cd ${.CURDIR} && ${MAKE} do-config;
 .  endif
 .endif
 .endif # config-conditional



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