From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1JcFxE-0000ap-4K for garchives@archives.gentoo.org; Thu, 20 Mar 2008 08:16:52 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 00CE0E0933; Thu, 20 Mar 2008 08:16:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CDCFDE0933 for ; Thu, 20 Mar 2008 08:16:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 6644564BFA for ; Thu, 20 Mar 2008 08:16:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -0.27 X-Spam-Level: X-Spam-Status: No, score=-0.27 required=5.5 tests=[AWL=0.262, BAYES_00=-2.599, RCVD_NUMERIC_HELO=2.067] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gMfMFaTaXdkb for ; Thu, 20 Mar 2008 08:16:43 +0000 (UTC) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id B48A9667CF for ; Thu, 20 Mar 2008 08:16:40 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JcFwr-0006zC-IZ for gentoo-dev@gentoo.org; Thu, 20 Mar 2008 08:16:29 +0000 Received: from 82.152.202.29 ([82.152.202.29]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Mar 2008 08:16:29 +0000 Received: from slong by 82.152.202.29 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Mar 2008 08:16:29 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-dev@lists.gentoo.org From: Steve Long Subject: [gentoo-dev] Re: [RFC] Major changes to the Gnome2 Eclasses Date: Thu, 20 Mar 2008 08:23:43 +0000 Message-ID: References: <47DA25CF.10205@gentoo.org> <47DE9D30.7060107@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 82.152.202.29 User-Agent: KNode/0.10.5 Sender: news Content-Transfer-Encoding: quoted-printable X-Archives-Salt: d9e8e7cd-8b07-41c2-a097-d9b2896c76c5 X-Archives-Hash: 57596355a0d0ad9bbbfba0907dda27c2 R=E9mi Cardona wrote: > Now, basically, if the portage metadata or QA people could tell me a wa= y > to figure *all* the ebuilds that inherit gnome2 *and* have a > pkg_preinst() function somewhere (either in the ebuild or in an eclass > somewhere) I'd really appreciate it, as I really don't want to read > through thousands of ebuilds to figure it out. >=20 PORTDIR=3D$(portageq envvar PORTDIR) # Get eclasses which export pkg_preinst() preEclass=3D($(qgrep -EeCl 'EXPORT_FUNCTIONS.*pkg_preinst')) # We don't want the eclass/ prefix preEclass=3D("${preEclass[@]/#eclass\/}") # or the .eclass suffix preEclass=3D("${preEclass[@]/%.eclass}") # make a regex for an ebuild with a pkg_preinst, or inheriting one # of the eclasses IFS=3D'|' search=3D"^[[:space:]]*(pkg_preinst\(\)|inherit .*(${preEclass[*]}))" unset IFS # find matching ebuilds while read ebuild; do grep -El "$search" "$PORTDIR/$ebuild" done< <(qgrep -Cel 'inherit .*gnome2') # just the packages (would need to count dirs in PORTDIR and amend awk # accordingly to use the env var) while read ebuild; do grep -El "$search" "/usr/portage/$ebuild" done< <(qgrep -Cel 'inherit .*gnome2') | \ awk -F/ '!s[$4"/"$5]++ { print $4"/"$5 }' If you wanted to do something with the files, you'd use: grep -Eq "$search" "$PORTDIR/$ebuild" && files+=3D("$PORTDIR/$ebuild") in the loop, and then access the "${files[@]}" array after. You can't do that with a pipe, see http://wooledge.org/mywiki/BashFAQ/024 --=20 gentoo-dev@lists.gentoo.org mailing list