[PATCH] lang/python: speed up upgrade-site-packages

Julien Laffaye kimelto at gmail.com
Sun Mar 27 13:46:12 UTC 2011


>Submitter-Id:	current-users
>Originator:	Julien Laffaye
>Organization:	
>Confidential:	no 
>Synopsis:	[PATCH] lang/python: speed up upgrade-site-packages
>Severity:	non-critical
>Priority:	low
>Category:	ports 
>Class:		change-request
>Release:	FreeBSD 8.2-RELEASE amd64
>Environment:
System: FreeBSD chulak.lan 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011
>Description:
Instead of asking each file in lib/python which package it comes from, ask each package if it has a file in lib/python.
This speed things up significantly on my system.

Port maintainer (python at FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- python-2.7,2.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/lang/python.orig/Makefile /usr/ports/lang/python/Makefile
--- /usr/ports/lang/python.orig/Makefile	2011-03-26 13:17:41.000000000 +0000
+++ /usr/ports/lang/python/Makefile	2011-03-27 14:09:30.000000000 +0100
@@ -25,15 +25,9 @@
 
 # Major upgrade support
 PORTUPGRADE_CMD=	${LOCALBASE}/sbin/portupgrade
-PKG_WHICH_CMD=	${LOCALBASE}/sbin/pkg_which
-XARGS_CMD=	${XARGS} -0
 
 .if defined(USE_PORTMASTER)
 PORTUPGRADE_CMD=	${LOCALBASE}/sbin/portmaster
-PORTUPGRADE_ARGS?=	""
-PKG_WHICH_CMD=	/usr/sbin/pkg_info -qW
-JOBS=	${SYSCTL} -n kern.smp.cpus
-XARGS_CMD=	${XARGS} -L 1 -0 -P $$(${JOBS})
 .endif
 
 upgrade-site-packages:
@@ -42,22 +36,21 @@
 		${FALSE}; \
 	 fi
 
-	@for ver in `echo ${_PYTHON_ALLBRANCHES}|${SED} 's/${PYTHON_VER}//'`; do \
-		if [ -d ${PREFIX}/lib/python$$ver ]; then \
-			UPD=`${FIND} ${PREFIX}/lib/python$$ver \
-					-type f -print0 | \
-				${XARGS_CMD} ${PKG_WHICH_CMD} | \
-				${GREP} -Fv '?' | \
-				${EGREP} -v '^python2?[0-5]?-2' | \
-				${SORT} -u`; \
-			if [ "$$UPD" ]; then \
-				if [ -n ${PORTUPGRADE_ARGS} ]; then \
-					${PORTUPGRADE_CMD} ${PORTUPGRADE_ARGS} -f $$UPD; \
-				else \
-					${PORTUPGRADE_CMD} -f $$UPD; \
-				fi; \
-			fi; \
+	@GREP_ARGS="-q"; \
+	for ver in `echo ${_PYTHON_ALLBRANCHES}|${SED} 's/${PYTHON_VER}//'`; do \
+		GREP_ARGS="$${GREP_ARGS} -e lib/python$$ver"; \
+	done; \
+	UPD=""; \
+	for pkg in `${PKG_INFO} -Ea`; do \
+		${PKG_INFO} -L $${pkg} | ${GREP} $${GREP_ARGS} && \
+			UPD="$${UPD} $${pkg}"; \
+	done; \
+	if [ "$${UPD}" ]; then \
+		if [ -n ${PORTUPGRADE_ARGS} ]; then \
+			${PORTUPGRADE_CMD} ${PORTUPGRADE_ARGS} -f $${UPD}; \
+		else \
+			${PORTUPGRADE_CMD} -f $${UPD}; \
 		fi; \
-	 done \
+	fi; \
 
 .include <bsd.port.mk>
--- python-2.7,2.patch ends here ---



More information about the freebsd-python mailing list