2005-03-04 (é) ã 17:29 +0900 ã Chris White ãããæãããã: I've updated the script now, it has a better more functional layout than before (A large page script :).
Re-cap of the install is here: > > 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). the main update was the parsing of category, package, and versions from ebuilds. The code of interest comes from these lines of code: sub package_nvsplit { $i=0; while($_[$i] !~ /^\d/) { $i++; } $package_end=$i-1; $pn=join("-",@_[0..$package_end]); [EMAIL PROTECTED]; return $pn, $pv; } So for those interested in parsing out package versions and what not, this is basically how to go about it. First, you splitup the category and the package name+version (or $P). So... media-video/xine-lib-1.0 gets splitup into: media-video (category) and xine-lib-1.0 ($P). Now then, to get package and version seperation, one simply splits up $P with the - seperator. This gives us: xine lib 1.0 Which, a simple loop checks to see if we've hit a section that starts with a digit (the version number), and re-combines the values before it with -'s, giving us: $pv = 1.0 $pn = xine-lib So there you have it, the basis on seperation of package category, name, and version. Hopefully this will help those who wish to hack around a little get an idea of what's involved in the minute areas of portage. Note that while the code is perl, the concept is very language non-specific (I could do one in C.. but I'd rather save some of my sanity ;). Next stop will be getting USE flag descriptions in a more speedy manner than simple grep-ing. Please note that suggestions for improvement/comments/etc. are welcome, and I hope this turns into a nice informative developer's discussion. _big note_ I'd also like to thank Nick (carpaski) for his insight on the above code :). _big note_
signature.asc
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?=