On Wednesday 10 June 2009 12:52:36 Wesley Shields wrote:
> On Wed, Jun 10, 2009 at 12:44:42PM -0800, Mel Flynn wrote:
> > On Wednesday 10 June 2009 05:26:47 Wesley Shields wrote:
> > > It will be quite slow compared to using pkg_which (the normal method)
> > > so be patient.
> >
> > Does pkg_which use the pkgdb? If so, maybe we could have pkg_info grow a
> > cache for future encounters, or we can create one:
>
> My guess is that pkg_which is using pkgdb, which is why it is
> significantly faster.
>
> > % grep -v '^@' /var/db/pkg/*/+CONTENTS >/tmp/pkg_info.cache
> > % FOUND=`sed -ne 's,^/var/db/pkg/\(.*\)/+CONTENTS:lib/python2.6/site-
> > packages/xcbgen/error.py$,\1,p' /tmp/pkg_info.cache`; echo $FOUND
> > xcb-proto-1.4
> >
> > So:
> > 's,^${PKG_DBDIR}/\(.*\)/+CONTENTS:$$f$$,\1,p'
>
> I think there is a SoC project in the works to make our pkg utilities
> much better. I don't know any of the details but I can only hope that
> speed is one of the things being improved.

True, however the above can be done now, though it's a bit tricky to squeeze 
into the find command, one could put this as shell script in files/pkg_which.
And patch Makefile as attached.

I haven't got a system to run this on, since I switched to 2.6 everywhere a 
long time ago, but the find command on the shell produced the desired output.

> > > [1]: http://people.freebsd.org/~wxs/python26-portmaster.diff
> >
> > What's this for?
> > +JOBS=      sysctl -n kern.smp.cpus
> >
> > Should be != if it's gonna be used, but it's not referenced anywhere else
> > that I can see.
>
> It's used in XARGS_CMD to provide a bit of parallelism in an effort to
> be a bit faster. 

That was pretty blind of me.

-- 
Mel
Index: python/Makefile
===================================================================
RCS file: /home/ncvs/ports/lang/python/Makefile,v
retrieving revision 1.161
diff -u -r1.161 Makefile
--- python/Makefile	31 Jul 2007 16:28:32 -0000	1.161
+++ python/Makefile	10 Jun 2009 23:03:32 -0000
@@ -24,8 +24,19 @@
 	@${DO_NADA}
 
 # Major upgrade support
-PORTUPGRADE_CMD?=	${LOCALBASE}/sbin/portupgrade
-PKG_WHICH_CMD?=	${LOCALBASE}/sbin/pkg_which
+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=	${SETENV} LOCALBASE=${LOCALBASE} PKG_DBDIR=${PKG_DBDIR} \
+		${SH} ${FILESDIR}/pkg_which
+JOBS=	sysctl -n kern.smp.cpus
+XARGS_CMD=	${XARGS} -L 1 -0 -P $$(${JOBS})
+.endif
+
 upgrade-site-packages:
 	@if [ ! -x ${PORTUPGRADE_CMD} ]; then \
 		${ECHO_MSG} "Please install ports-mgmt/portupgrade."; \
@@ -36,14 +47,21 @@
 		if [ -d ${PREFIX}/lib/python$$ver ]; then \
 			UPD=`${FIND} ${PREFIX}/lib/python$$ver \
 					-type f -print0 | \
-				${XARGS} -0 ${PKG_WHICH_CMD} | \
+				${XARGS_CMD} ${PKG_WHICH_CMD} | \
 				${GREP} -Fv '?' | \
 				${EGREP} -v '^python2?[0-5]?-2' | \
 				${SORT} -u`; \
 			if [ "$$UPD" ]; then \
-				${PORTUPGRADE_CMD} -f $$UPD; \
+				if [ -n ${PORTUPGRADE_ARGS} ]; then \
+					${PORTUPGRADE_CMD} ${PORTUPGRADE_ARGS} -f $$UPD; \
+				else \
+					${PORTUPGRADE_CMD} -f $$UPD; \
+				fi; \
 			fi; \
 		fi; \
-	 done \
+	 done
+.if defined(USE_PORTMASTER)
+	${PKG_WHICH_CMD} -r
+.endif
 
 .include <bsd.port.mk>
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to