Gentoo Archives: gentoo-dev

From: Georgi Georgiev <chutz@×××.net>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] ekeyword and ordering
Date: Sat, 11 Jun 2005 00:03:24
Message-Id: 20050611000425.GA8461@lion.gg3.net
In Reply to: Re: [gentoo-dev] ekeyword and ordering by Aron Griffis
1 maillog: 10/06/2005-13:19:30(-0400): Aron Griffis types
2 > Btw, here's an interesting statistic which really doesn't add to (or
3 > detract from, I hope) this discussion...
4 >
5 > grep -hr --include=\*.ebuild '^KEYWORDS=' /usr/portage | perl -ne '
6 > s/[^[:lower:]\s]//; @F = split; @S = sort @F; $sorted++ if "@F" eq "@S";
7 > END { printf "%d%% of ebuilds are sorted (%d/%d)\n", 100*$sorted/$., $sorted, $. }'
8 >
9 > 49% of ebuilds are sorted (9435/19174)
10
11 Your statistic seems to be flawed on a number of occasions. Assume
12 KEYWORDS="x86 ppc"
13
14 s/[^[:lower:]\s]//;
15
16 The above would only remove the "K" from "KEYWORDS" so you're left with
17 "EYWORDS="x86 ppc";
18
19 @F = split;
20
21 and you get an array of elements like:
22
23 $F[0] = 'EYWORDS="x86';
24 $F[1] = 'ppc"';
25
26 The sorted @S, would always have the capital "E" (and the first keyword)
27 as first element, because it's a capital letter.
28
29 Keywords that start with "~" will be grouped together after the stable
30 keywords, and I am guessing the idea is to have "~ppc" before "x86".
31
32 The above three statements do not depend on your locale, as perl does
33 not use locales by default:
34
35 $ echo 'a b A B ~a ~b ~A ~B' | LC_ALL=en_US perl -ne '@s = sort split; print "@s\n"'
36 A B a b ~A ~B ~a ~b
37
38 $ echo 'a b A B ~a ~b ~A ~B' | LC_ALL=en_US perl -ne 'use locale; @s = sort split; print "@s\n"'
39 a ~a A ~A b ~b B ~B
40
41 --
42 | Georgi Georgiev | NT 5.0 so vaporous it's in danger of being |
43 | chutz@×××.net | added to the periodic table as a noble |
44 | +81(90)2877-8845 | gas. -- From Slashdot.org |

Replies

Subject Author
Re: [gentoo-dev] ekeyword and ordering Aron Griffis <agriffis@g.o>