From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.3/8.13.3) with ESMTP id j2494JhC002404 for ; Fri, 4 Mar 2005 09:04:19 GMT Received: from ns1.hostitnow.com ([209.152.181.224] helo=sls-ce5p311.hostitnow.com) by smtp.gentoo.org with esmtp (Exim 4.42) id 1D78jK-0001yH-Eg for gentoo-dev@robin.gentoo.org; Fri, 04 Mar 2005 09:04:18 +0000 Received: from c-67-181-38-200.client.comcast.net ([67.181.38.200] helo=192.168.0.106) by sls-ce5p311.hostitnow.com with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.44) id 1D78jI-0005O3-95 for gentoo-dev@gentoo.org; Fri, 04 Mar 2005 04:04:18 -0500 Subject: [gentoo-dev] Parsing emerge From: Chris White To: gentoo-dev@robin.gentoo.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-RfsdjyilnhxoK0NztNH8" Organization: Gentoo Linux Date: Fri, 04 Mar 2005 17:29:29 +0900 Message-Id: <1109924970.11103.19.camel@secures> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-To: gentoo-dev@gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sls-ce5p311.hostitnow.com X-AntiAbuse: Original Domain - gentoo.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - gentoo.org X-Source: X-Source-Args: X-Source-Dir: X-Archives-Salt: 6355eea2-25ed-4136-a5ed-5e161eae7b65 X-Archives-Hash: feab442e5783da4977c87038e7228724 --=-RfsdjyilnhxoK0NztNH8 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I'm putting this here for informative purposes as to achieving proper parsing of portage for use in extending the already present behaviour to better suit one's needs. A few things I'll bring into the table from my experience: 1) NOCOLOR=3Dtrue is a good idea. It's rather hard to account for both color and no color in regex parsing (unless someone has a spectacularly fun regex for that...) and I find it easiest to parse. 2) stdout is home to all the portage output, !!! type stuff goes to stderr. 3) Portage is actually fairly parseable if you try. Lucky I also found that the compile itself goes to stdout, giving you even more flexibility for reporting type situations. 4) Parsing can, in some cases, help you add extra functionality to portage without even having to hack the portage code. I've already worked on a system that can buffer 20 lines or so backlog, catch an error in the compile, and give you the next few lines. By doing this, it makes it easier to give bug reports by narrowing down what's failing in a compile, expecially if you're getting spewed 100 compile messages and your backlog can't keep up. I've already talked with ferringb regarding that and have looked at some added functionality to make such a system more realiable. I wrote a small perl script to exemplify what I'm trying to go at: http://dev.gentoo.org/~chriswhite/emerge_parse.pl In order to install this, you'll need to `g-cpan.pl Expect` in order to get the Expect module (which interestingly enough also installs the dep of IO::Tty). I'm hoping that this information will be somewhat helpful to people here in realizing the full potentional of parsing. Basically, you run the script with -pv arguments (for now.. more to come) like so: `emerge_parse.pl -pv xine-lib` and you'll get a nice translation of the emerge -pv layout: root@secures chris # emerge_parse.pl -pv xine-lib [Pretend] emerge would do a(n) re-install of media-libs/xine-lib-1_rc8-r1 root@secures chris # emerge_parse.pl -pv java-sdk-docs [Pretend] emerge would do a(n) fetchonly re-install of dev-java/java-sdk-docs-1.4.2 root@secures dev-util # emerge_parse.pl -pv flawfinder [Pretend] emerge would do a(n) new install of dev-util/flawfinder-1.24 .. etc.. etc.. As you can see, extra functionality has been added, and now you get the translation of emerge's abbreviated install method format to something more human readable. I'll hope to have more to come with regards to emerge parsing. --=-RfsdjyilnhxoK0NztNH8 Content-Type: application/pgp-signature; name=signature.asc Content-Description: =?UTF-8?Q?=E3=81=93=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?Q?=E3=82=B8=E3=81=AB=E3=81=AF=E3=83=87=E3=82=B8=E3=82=BF?= =?UTF-8?Q?=E3=83=AB=E7=BD=B2=E5=90=8D=E3=81=95=E3=82=8C=E3=81=9F?= =?UTF-8?Q?=E9=83=A8=E5=88=86=E3=81=8C=E3=81=82=E3=82=8A=E3=81=BE?= =?UTF-8?Q?=E3=81=99?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBCKBxpFdQwWVoAgN4RAhGsAKCPd0XgWTnCwtu0gO+UHK+RYOcw9QCgyWKm L+iRHRkozppGqEpLpTAGEk4= =N58Q -----END PGP SIGNATURE----- --=-RfsdjyilnhxoK0NztNH8-- -- gentoo-dev@gentoo.org mailing list