1 |
Alle 19:03, mercoledì 23 novembre 2005, Marien Zwart el ga butta: |
2 |
> |Hi all, |
3 |
> | |
4 |
> |Since it's policy and especially since it's the first time I write |
5 |
> | one of these things I'm submitting an eclass I want to add to the |
6 |
> | tree for review. It will only be used by the twisted subpackages |
7 |
> | I'll be maintaining (see bug 80639). |
8 |
> | |
9 |
> |Subpackage ebuilds using this only have to set MY_PACKAGE, |
10 |
> |DESCRIPTION, KEYWORDS and DEPEND. I'd like to get rid of MY_PACKAGE |
11 |
> | but I haven't figured out how to convert lowercase to uppercase |
12 |
> | without using tr (MY_PACKAGE will be "Conch" if PN is |
13 |
> | "twisted-conch"). Also adds the ability to run the unit tests for |
14 |
> | the package and updates twisted's plugin cache. |
15 |
|
16 |
bash doable like this: |
17 |
|
18 |
--- code ---- |
19 |
word="abc" |
20 |
newword="" |
21 |
lcase=( a b c d e f g h i j k l m n o p q r s t u v w x y z ) |
22 |
ucase=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) |
23 |
|
24 |
for (( i=0 ; i<${#word} ; ++i )) ; do |
25 |
letter=${word:$i:1} |
26 |
for j in ${!lcase[*]} ; do |
27 |
letter=${letter/${lcase[${j}]}/${ucase[${j}]}} |
28 |
done |
29 |
newword="${newword}${letter}" |
30 |
done |
31 |
|
32 |
echo "${newword} == ucase( ${word} )" |
33 |
--- code ---- |
34 |
|
35 |
but why not |
36 |
|
37 |
`tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` |
38 |
|
39 |
^^^ this one is chosen from MySQL configure script so it should be |
40 |
portable (or as often I'm missing something ?) |
41 |
|
42 |
|
43 |
> | |
44 |
> |Would like to hear about any ideas on how to do that case conversion |
45 |
> |and any bugs spotted. If there are no objections I'd like to add |
46 |
> | this to the tree in about two days, so bug 80639 can finally be |
47 |
> | fixed. |
48 |
|
49 |
-- |
50 |
gentoo-dev@g.o mailing list |