On Wed, 16 Jul 2008 00:43:28 +0200
Marius Mauch <[EMAIL PROTECTED]> wrote:
> Interesting idea. Unfortunately our depstring parser doesn't like
> empty parentheses (as they are usually problem indicators), so it
> doesn't work out.

Bleh. You can hack around that using a second (looping) pass then. I
think this is right, assuming extglob:

for p in $SRC_URI ; do
    if [[ "${p}" == "(" ]] || [[ "${p}" == ")" ]] || \
        [[ "${p%\?}" != "${p}" ]] ; then
        UNPACK_DEPENDS="${UNPACK_DEPENDS} $p "
    elif [[ "${p%.zip}" != "${p}" ]] ; then
        UNPACK_DEPENDS="${UNPACK_DEPENDS} app-arch/unzip "
    elif [[ "${p%.bz2}" != "${p}" ]] ; then
        UNPACK_DEPENDS="${UNPACK_DEPENDS} app-arch/bzip2 "
    fi
done

while true ; do
    UNPACK_DEPENDS=" ${UNPACK_DEPENDS} "
    u="${UNPACK_DEPENDS}"
    UNPACK_DEPENDS="${UNPACK_DEPENDS//?(+( )+([^ ])\?)+( )(+( ))+( )/ }"
    [[ "$u" == "${UNPACK_DEPENDS}" ]] && break
done

Although... Allowing ( ) makes much more sense...

-- 
Ciaran McCreesh

Attachment: signature.asc
Description: PGP signature

Reply via email to