From owner-freebsd-ports Tue Jul 27 14:29:20 1999 Delivered-To: freebsd-ports@freebsd.org Received: from smtp11.bellglobal.com (smtp11.bellglobal.com [204.101.251.53]) by hub.freebsd.org (Postfix) with ESMTP id 20E21153AD for ; Tue, 27 Jul 1999 14:29:13 -0700 (PDT) (envelope-from vanderh@ecf.toronto.edu) Received: from localhost.nowhere (ppp18348.on.bellglobal.com [206.172.130.28]) by smtp11.bellglobal.com (8.8.5/8.8.5) with ESMTP id RAA09438; Tue, 27 Jul 1999 17:31:36 -0400 (EDT) Received: (from tim@localhost) by localhost.nowhere (8.9.3/8.9.1) id RAA38919; Tue, 27 Jul 1999 17:28:46 -0400 (EDT) (envelope-from tim) Date: Tue, 27 Jul 1999 17:28:46 -0400 From: Tim Vanderhoek To: Nik Clayton Cc: ports@freebsd.org Subject: Re: Move "search" from /usr/ports/Makefile to bsd.port.mk Message-ID: <19990727172846.C37558@mad> References: <19990727163124.A33168@kilt.nothing-going-on.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: <19990727163124.A33168@kilt.nothing-going-on.org>; from Nik Clayton on Tue, Jul 27, 1999 at 04:31:24PM +0100 Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, Jul 27, 1999 at 04:31:24PM +0100, Nik Clayton wrote: > > Agreed. Along similar lines I'd *love* to see the search target of > /usr/ports/Makefile moved into bsd.port.mk in such a way so that one > could change to a subdirectory such as /usr/ports/print and run a > `make search' for just that part of the tree. This more or less equates to rewriting the search target. Currently search works by doing a simple grep through the ports/INDEX file. Probably easy enough to make it grep for both a key and a category. To make it work in an arbitrary subdir would be different. The INDEX is mostly constructed from the output of make describe. The describe target will work in an arbitrary subdir. It wouldn't be hard to do cd /usr/ports/subdir ; make describe | grep -i "${key}" | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $1, $2, $4, $6, $7, $8, $9); }' And that will work and give the desired effect (tested), but it will be slow. There isn't any ACCEPTABLE way to do it "right". Cheating by grepping INDEX first for the category and then for the key is easy enough. Adding this to each subdirectory Makefile will work. I suggest this solution rather than a bsd.port.mk solution, although changed to look more nicer and more sexier. PORTSDIR?= /usr/ports search: ${PORTSDIR}/INDEX @grep ${.CURDIR} ${PORTSDIR}/INDEX | grep -i "${key}" | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps :\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }' [Also tested]. You may want to file my message with the bugreport. -- This is my .signature which gets appended to the end of my messages. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message