libc/glibc: commonalise assembling the list of addons
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jan 22 22:35:18 2011 +0100 (2011-01-22)
changeset 22742f0e9d2cfce5
parent 2273 c6d2311442ad
child 2275 9ab4392430ad
libc/glibc: commonalise assembling the list of addons

glibc and eglibc each have two very similar ways of building this list.
This can, and should definitetly, be shared.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/libc/glibc-eglibc.sh-common
scripts/build/libc/glibc.sh
     1.1 --- a/scripts/build/libc/glibc-eglibc.sh-common	Sat Jan 22 22:35:02 2011 +0100
     1.2 +++ b/scripts/build/libc/glibc-eglibc.sh-common	Sat Jan 22 22:35:18 2011 +0100
     1.3 @@ -243,14 +243,16 @@
     1.4  # Build up the addons list, separated with $1
     1.5  do_libc_add_ons_list() {
     1.6      local sep="$1"
     1.7 -    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
     1.8 +    local addons_list="$( echo "${CT_LIBC_ADDONS_LIST}"         \
     1.9 +                          |sed -r -e "s/[[:space:],]/${sep}/g;" \
    1.10 +                        )"
    1.11      case "${CT_THREADS}" in
    1.12          none)   ;;
    1.13          *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
    1.14      esac
    1.15      [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
    1.16 -    addons_list="${addons_list%%${sep}}"
    1.17 -    echo "${addons_list##${sep}}"
    1.18 +    # Remove duplicate, leading and trailing separators
    1.19 +    echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
    1.20  }
    1.21  
    1.22  # Compute up the minimum supported Linux kernel version
     2.1 --- a/scripts/build/libc/glibc.sh	Sat Jan 22 22:35:02 2011 +0100
     2.2 +++ b/scripts/build/libc/glibc.sh	Sat Jan 22 22:35:18 2011 +0100
     2.3 @@ -263,16 +263,3 @@
     2.4  
     2.5      CT_EndStep
     2.6  }
     2.7 -
     2.8 -# Build up the addons list, separated with $1
     2.9 -do_libc_add_ons_list() {
    2.10 -    local sep="$1"
    2.11 -    local addons_list=$(echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e "s/[ ,]/${sep}/g;")
    2.12 -    case "${CT_THREADS}" in
    2.13 -        none)   ;;
    2.14 -        *)      addons_list="${addons_list}${sep}${CT_THREADS}";;
    2.15 -    esac
    2.16 -    [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
    2.17 -    # Remove duplicate, leading and trailing separators
    2.18 -    echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
    2.19 -}