Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jun 2008 17:14:48 +0300
From:      Alex Kozlov <spam@rm-rf.kiev.ua>
To:        Doug Barton <dougb@FreeBSD.org>, freebsd-ports@freebsd.org, spam@rm-rf.kiev.ua
Subject:   Re: INDEX build optimizations - please review
Message-ID:  <20080611141448.GA50370@ravenloft.kiev.ua>

next in thread | raw e-mail | index | archive | help
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



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