From owner-freebsd-ports@FreeBSD.ORG Wed Jun 11 14:15:10 2008 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 051EB106566B for ; Wed, 11 Jun 2008 14:15:10 +0000 (UTC) (envelope-from kozlov@ravenloft.kiev.ua) Received: from istc.kiev.ua (wolf.istc.kiev.ua [193.108.236.1]) by mx1.freebsd.org (Postfix) with ESMTP id 6BBAE8FC1A for ; Wed, 11 Jun 2008 14:15:09 +0000 (UTC) (envelope-from kozlov@ravenloft.kiev.ua) Received: from [91.123.146.100] (helo=ravenloft.kiev.ua) by istc.kiev.ua with esmtp (Exim 4.52) id 1K6R6G-0003QH-Ci; Wed, 11 Jun 2008 17:15:01 +0300 Received: from kozlov by ravenloft.kiev.ua with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1K6R68-000D85-Uk; Wed, 11 Jun 2008 17:14:48 +0300 Date: Wed, 11 Jun 2008 17:14:48 +0300 From: Alex Kozlov To: Doug Barton , freebsd-ports@freebsd.org, spam@rm-rf.kiev.ua Message-ID: <20080611141448.GA50370@ravenloft.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: Alex Kozlov X-Spam-Score: 0.0 (/) X-Spam-Report: Content analysis detailz: (0.0 points, 10.0 required) * 0.0 UPPERCASE_25_50 message body is 25-50% uppercase Cc: Subject: Re: INDEX build optimizations - please review X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jun 2008 14:15:10 -0000 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