Sanity-check CT_TARGET_VENDOR, CT_TARGET_ALIAS and CT_TARGET_ALIAS_SED_EXPR:
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Dec 09 22:02:20 2008 +0000 (2008-12-09)
changeset 1094c6a08b4c488c
parent 1093 de1b8818d39b
child 1095 a18b17c1ddc5
Sanity-check CT_TARGET_VENDOR, CT_TARGET_ALIAS and CT_TARGET_ALIAS_SED_EXPR:
- vendor and alias must not contain spaces
- vendor must not contain dashes '-'
- sed_expr must not generate an alias with a space in it

/trunk/scripts/functions | 17 16 1 0 ++++++++++++++++-
/trunk/config/toolchain.in | 1 1 0 0 +
2 files changed, 17 insertions(+), 1 deletion(-)
config/toolchain.in
scripts/functions
     1.1 --- a/config/toolchain.in	Tue Dec 09 21:25:29 2008 +0000
     1.2 +++ b/config/toolchain.in	Tue Dec 09 22:02:20 2008 +0000
     1.3 @@ -33,6 +33,7 @@
     1.4        A tuple is of the form arch-vendor-kernel-system.
     1.5        You can set the second part, vendor, to whatever you see fit.
     1.6        Use a single word, or use underscores "_" to separate words.
     1.7 +      Use neither dash nor space, as it breaks things.
     1.8        
     1.9        Keep the default (unkown) if you don't know better.
    1.10  
     2.1 --- a/scripts/functions	Tue Dec 09 21:25:29 2008 +0000
     2.2 +++ b/scripts/functions	Tue Dec 09 22:02:20 2008 +0000
     2.3 @@ -697,7 +697,22 @@
     2.4      CT_DoKernelTupleValues
     2.5  
     2.6      # Finish the target tuple construction
     2.7 -    CT_TARGET=$(CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}${CT_TARGET_KERNEL:+-}${CT_TARGET_SYS}")
     2.8 +    CT_TARGET="${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}${CT_TARGET_KERNEL:+-}${CT_TARGET_SYS}"
     2.9 +
    2.10 +    # Sanity checks
    2.11 +    __sed_alias=""
    2.12 +    if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
    2.13 +        __sed_alias=$(echo "${CT_TARGET}" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
    2.14 +    fi
    2.15 +    case ":${CT_TARGET_VENDOR}:${CT_TARGET_ALIAS}:${__sed_alias}:" in
    2.16 +      :*" "*:*:*:) CT_Abort "Don't use spaces in the vendor string, it breaks things.";;
    2.17 +      :*"-"*:*:*:) CT_Abort "Don't use dashes in the vendor string, it breaks things.";;
    2.18 +      :*:*" "*:*:) CT_Abort "Don't use spaces in the target alias, it breaks things.";;
    2.19 +      :*:*:*" "*:) CT_Abort "Don't use spaces in the target sed transform, it breaks things.";;
    2.20 +    esac
    2.21 +
    2.22 +    # Canonicalise it
    2.23 +    CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}")
    2.24  
    2.25      # Prepare the target CFLAGS
    2.26      CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ENDIAN_CFLAG}"