From: Ian Leitch <port001@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Parsing emerge
Date: Fri, 04 Mar 2005 11:08:56 +0000 [thread overview]
Message-ID: <422841C8.10407@gentoo.org> (raw)
In-Reply-To: <1109924970.11103.19.camel@secures>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chris White wrote:
| 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=true 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.
Sorry to spoil your post Chris, but I think this is just another
testimonial to how badly we all need that portage API (plus the portage
daemon for tools such as Porthole who currently also have to parse
emerge output). This is by no means the first attempt at parsing I've seen.
But hey, nice work in the absence of the API, it does look like the
script has uses.
Regards,
Ian Leitch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCKEHIefZ4eWAXRGIRAtzxAJ0WzeL5erEZZISc2RtHN7fmUiAKlgCgj7nv
GdAhWXwT+BUrhrgkFJIU8eI=
=pqYj
-----END PGP SIGNATURE-----
--
gentoo-dev@gentoo.org mailing list
next prev parent reply other threads:[~2005-03-04 11:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-04 8:29 [gentoo-dev] Parsing emerge Chris White
2005-03-04 11:08 ` Ian Leitch [this message]
2005-03-04 15:05 ` Chris White
2005-03-04 15:05 ` Chris White
2005-03-04 16:19 ` Chris Gianelloni
2005-03-04 17:52 ` Ian Leitch
2005-03-05 3:03 ` Jason Stubbs
2005-03-05 5:11 ` Chris White
2005-03-06 22:49 ` Aron Griffis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=422841C8.10407@gentoo.org \
--to=port001@gentoo.org \
--cc=gentoo-dev@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox