Alle 19:03, mercoledì 23 novembre 2005, Marien Zwart el ga butta:
> |Hi all,
> |
> |Since it's policy and especially since it's the first time I write
> | one of these things I'm submitting an eclass I want to add to the
> | tree for review. It will only be used by the twisted subpackages
> | I'll be maintaining (see bug 80639).
> |
> |Subpackage ebuilds using this only have to set MY_PACKAGE,
> |DESCRIPTION, KEYWORDS and DEPEND. I'd like to get rid of MY_PACKAGE
> | but I haven't figured out how to convert lowercase to uppercase
> | without using tr (MY_PACKAGE will be "Conch" if PN is
> | "twisted-conch"). Also adds the ability to run the unit tests for
> | the package and updates twisted's plugin cache.

bash doable like this:

--- code ----
word="abc"
newword=""
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 )
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 )

for (( i=0 ; i<${#word} ; ++i )) ; do
        letter=${word:$i:1}
        for j in ${!lcase[*]} ; do
                letter=${letter/${lcase[${j}]}/${ucase[${j}]}}
        done
        newword="${newword}${letter}"
done

echo "${newword} == ucase( ${word} )"
--- code ----

but why not 

`tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`

^^^ this one is chosen from MySQL configure script so it should be 
portable (or as often I'm missing something ?)


> |
> |Would like to hear about any ideas on how to do that case conversion
> |and any bugs spotted. If there are no objections I'd like to add
> | this to the tree in about two days, so bug 80639 can finally be
> | fixed.

-- 
gentoo-dev@gentoo.org mailing list

Reply via email to