Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Sep 2012 13:13:05 +0200
From:      Sofian Brabez <sbz@FreeBSD.org>
To:        Julien Laffaye <kimelto@gmail.com>
Cc:        FreeBSD-gnats-submit@freebsd.org, python@FreeBSD.org
Subject:   Re: [PATCH] lang/python: speed up upgrade-site-packages
Message-ID:  <20120904111305.GA10660@ogoshi.int.nbs-system.com>
In-Reply-To: <4d8f38c1.581ce30a.1df5.63c3@mx.google.com>
References:  <4d8f38c1.581ce30a.1df5.63c3@mx.google.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--eJnRUKwClWJh1Khz
Content-Type: multipart/mixed; boundary="opJtzjQTFsWo+cga"
Content-Disposition: inline


--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Mar 27, 2011 at 06:16:49AM -0700, Julien Laffaye wrote:
>=20
> >Submitter-Id:	current-users
> >Originator:	Julien Laffaye
> >Organization:=09
> >Confidential:	no=20
> >Synopsis:	[PATCH] lang/python: speed up upgrade-site-packages
> >Severity:	non-critical
> >Priority:	low
> >Category:	ports=20
> >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, as=
k each package if it has a file in lib/python.
> This speed things up significantly on my system.
>=20
> Port maintainer (python@FreeBSD.org) is cc'd.
>=20
> Generated with FreeBSD Port Tools 0.99
> >How-To-Repeat:
> >Fix:
>=20
> --- python-2.7,2.patch begins here ---
> diff -ruN --exclude=3DCVS /usr/ports/lang/python.orig/Makefile /usr/ports=
/lang/python/Makefile
> --- /usr/ports/lang/python.orig/Makefile	2011-03-26 13:17:41.000000000 +0=
000
> +++ /usr/ports/lang/python/Makefile	2011-03-27 14:09:30.000000000 +0100
> @@ -25,15 +25,9 @@
> =20
>  # Major upgrade support
>  PORTUPGRADE_CMD=3D	${LOCALBASE}/sbin/portupgrade
> -PKG_WHICH_CMD=3D	${LOCALBASE}/sbin/pkg_which
> -XARGS_CMD=3D	${XARGS} -0
> =20
>  .if defined(USE_PORTMASTER)
>  PORTUPGRADE_CMD=3D	${LOCALBASE}/sbin/portmaster
> -PORTUPGRADE_ARGS?=3D	""
> -PKG_WHICH_CMD=3D	/usr/sbin/pkg_info -qW
> -JOBS=3D	${SYSCTL} -n kern.smp.cpus
> -XARGS_CMD=3D	${XARGS} -L 1 -0 -P $$(${JOBS})
>  .endif
> =20
>  upgrade-site-packages:
> @@ -42,22 +36,21 @@
>  		${FALSE}; \
>  	 fi
> =20
> -	@for ver in `echo ${_PYTHON_ALLBRANCHES}|${SED} 's/${PYTHON_VER}//'`; d=
o \
> -		if [ -d ${PREFIX}/lib/python$$ver ]; then \
> -			UPD=3D`${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=3D"-q"; \
> +	for ver in `echo ${_PYTHON_ALLBRANCHES}|${SED} 's/${PYTHON_VER}//'`; do=
 \
> +		GREP_ARGS=3D"$${GREP_ARGS} -e lib/python$$ver"; \
> +	done; \
> +	UPD=3D""; \
> +	for pkg in `${PKG_INFO} -Ea`; do \
> +		${PKG_INFO} -L $${pkg} | ${GREP} $${GREP_ARGS} && \
> +			UPD=3D"$${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; \
> =20
>  .include <bsd.port.mk>
> --- python-2.7,2.patch ends here ---
>=20
> _______________________________________________
> freebsd-python@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-python
> To unsubscribe, send any mail to "freebsd-python-unsubscribe@freebsd.org"

Hi,

I rework on this patch to avoid the use of ${SED} and I'll ask for a exp-ru=
n. My
new patch is attached.

Regards

--
Sofian Brabez

--opJtzjQTFsWo+cga--

--eJnRUKwClWJh1Khz
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlBF4kEACgkQc2NR9CSH5X5IuQCgiq6QfESbyCBN+3uwuyWTYBXX
gYgAoIpVUgsylCYzPEx3WyT6n2dN7KtU
=LCni
-----END PGP SIGNATURE-----

--eJnRUKwClWJh1Khz--



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