INDEX build optimizations - please review

Alex Kozlov spam at rm-rf.kiev.ua
Wed Jun 11 14:15:10 UTC 2008


On Tue, Jun 10, 2008 at 04:49:18PM -0700, Doug Barton wrote:
> Kris Kennaway wrote:
> 
> > The new 'make describe' target runs entirely using shell 
> > builtins apart from the need to sed pkg-descr to extract the WWW [2] 
> 
> > [2] Actually I am not happy with this but couldn't think of a way to do 
> > it better.  Having to fork the subshell costs about 60 seconds of system 
> > time and 10 of wall time.
> 
> Here's one way to do it. This is quick and dirty and I haven't 
> benchmarked it, but I imagine it would be faster.
> 
> while read one two discard; do
> 	case "$one" in
> 	WWW:)	echo one: $one two: $two
> 		case "$two" in
> 		http://*) echo WWW= $two ;;
> 		*) echo WWW=  http://$two ;;
> 		esac
> 		break
> 		;;
> 	esac
> done < pkg-descr
> 
> I did test this briefly and it pulls out the right values for
> variables with and without http://.
Good idea. I also do something like that [1]. But before we can use this
method, we have to fix ports with bad pkg-descr:

Don't have \n in WWW: line
 databases/powerarchitect
 graphics/picturebook

Have CRLF line terminators:
 devel/p5-Tie-Restore
 www/knowledgekit
 www/squishdot
 www/znavigator
 www/zope-cmfforum

Have http:/ instead of http://
 security/shimmer

Don't have protocol prefix(optional):
 net/pdb
 sysutils/iograph


[1] (Incremental to kris@ patch.):

Index: Mk/bsd.port.mk
@@ -5290,16 +5290,18 @@
 _RUN_DEPENDS=${RUN_DEPENDS:C/^[^ :]+:([^ :]+)(:[^ :]+)?/\1/:O:u} ${_LIB_DEPENDS}
 .if exists(${DESCR})
 _DESCR=${DESCR}
+_WWW=while read line; do set -- $${line}; case $$1 in WWW:) case $$2 \
+in http://*|https://*|ftp://*) ${ECHO_CMD} $$2 ;; *) \
+${ECHO_CMD} "http://$$2" ;; esac; break ;; esac; done < ${DESCR}
 .else
 _DESCR=/dev/null
+_WWW=
 .endif
 
 describe:
-	@${ECHO_CMD} -n "${PKGNAME}|${.CURDIR}|${PREFIX}|"; \
-	${ECHO_CMD} -n ${COMMENT:Q}; \
-	${ECHO_CMD} -n "|${_DESCR}|${MAINTAINER}|${CATEGORIES}|${_EXTRACT_DEPENDS}|${_PATCH_DEPENDS}|${_FETCH_DEPENDS}|${_BUILD_DEPENDS:O:u}|${_RUN_DEPENDS:O:u}|"; \
-	set "" $$(sed -E -e '/^WWW:[[:blank:]]+/!d' -e 's,^WWW:[[:blank:]]+([[:print:]]+).*$$,\1,' ${_DESCR}); \
-	echo $$2
+	@${ECHO_CMD} "${PKGNAME}|${.CURDIR}|${PREFIX}|"${COMMENT:Q}"|${_DESCR}|${MAINTAINER}"\
+		"|${CATEGORIES}|${_EXTRACT_DEPENDS}|${_PATCH_DEPENDS}|${_FETCH_DEPENDS}"\
+		"|${_BUILD_DEPENDS:O:u}|${_RUN_DEPENDS:O:u}|"$$( ${_WWW})
 .endif
 # | (read site && ${ECHO_CMD} $${site}) || ${ECHO_CMD}
 #	sed -E -e '/^WWW:/!d' -e 's,^WWW:.*(http[:print:]*),\1,' ${_DESCR} | (read site && ${ECHO_CMD} $${site})


--
Adios


More information about the freebsd-ports mailing list