Date: Mon, 16 Aug 2010 04:22:29 +0000 (UTC) From: Doug Barton <dougb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r211389 - user/dougb/portmaster Message-ID: <201008160422.o7G4MT8l084793@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dougb Date: Mon Aug 16 04:22:29 2010 New Revision: 211389 URL: http://svn.freebsd.org/changeset/base/211389 Log: Dramatic (9-10 times) speedup in iport_from_origin() by making an intelligent guess about what director{y|ies] to search in based on the origin directory name. This algorithm only misses on 2 out of my 489 currently installed ports which means we're almost always looking in either exactly the right directory the first time, or at worst (such as the py-* ports) a dramatically smaller subset. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sun Aug 15 23:58:21 2010 (r211388) +++ user/dougb/portmaster/portmaster Mon Aug 16 04:22:29 2010 (r211389) @@ -625,10 +625,14 @@ unset var newopts #=============== Begin functions relevant to --features and main =============== iport_from_origin () { - local dir + local sn dir + + sn=${1#*/} ; sn=${sn%-*} ; sn=${sn%%[0-9]*} - if ! dir=`grep -l "@comment ORIGIN:${1}$" $pdb/*/+CONTENTS 2>/dev/null`; then - dir=`pkg_info -q -O $1` || return 1 + if ! dir=`grep -l "@comment ORIGIN:${1}$" $pdb/${sn}*/+CONTENTS 2>/dev/null`; then + if ! dir=`grep -l "@comment ORIGIN:${1}$" $pdb/*/+CONTENTS 2>/dev/null`; then + dir=`pkg_info -q -O $1` || return 1 + fi fi # It should not happen that more than one port meets this
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008160422.o7G4MT8l084793>