1 |
On Friday 03 September 2004 14:35, Robert Moss wrote: |
2 |
> > The current output of emerge -p is difficult to machine parse because |
3 |
> > its difficult to split the package name and package version. However, |
4 |
> |
5 |
> Really? All you have to do is strip off the stuff between the [ and ] |
6 |
> plus the space, strip off anything after the now remaining first space, |
7 |
> and then you have something like app-text/ghostscript-7.07.1-r5. Then |
8 |
> anything before hyphen-digit is the package name, and anything after |
9 |
> the hyphen in hyphen-digit is the package version. So, you just want to |
10 |
> (for example) regexp away "-[[:digit:]]*.*" for the package name, and |
11 |
> match that and strip the hyphen for the version. Why is this difficult |
12 |
> all of a sudden? |
13 |
|
14 |
The only correct parsing is the way portage does it itself. There are |
15 |
names allowed that would invalidate your parsing logic. |
16 |
|
17 |
Paul |
18 |
|
19 |
-- |
20 |
Paul de Vrieze |
21 |
Gentoo Developer |
22 |
Mail: pauldv@g.o |
23 |
Homepage: http://www.devrieze.net |
24 |
|
25 |
-- |
26 |
gentoo-dev@g.o mailing list |