functions: allow using sub-dir of a module
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Oct 26 19:49:50 2009 +0100 (2009-10-26)
changeset 1592c08132a93049
parent 1591 11460fc587e6
child 1593 66b2463743af
functions: allow using sub-dir of a module

Some projects' module (eg. newlib) are checked-out into a sudirectory
rather than into their own directory. Handle this case in the CT_GetCVS
function.
scripts/functions
     1.1 --- a/scripts/functions	Wed Oct 21 22:51:39 2009 +0200
     1.2 +++ b/scripts/functions	Mon Oct 26 19:49:50 2009 +0100
     1.3 @@ -477,7 +477,8 @@
     1.4  # 'tag' is the tag to retrieve. Must be specified, but can be empty.
     1.5  # If dirname is specified, then module will be renamed to dirname
     1.6  # prior to building the tarball.
     1.7 -# Usage: CT_GetCVS <basename> <url> <module> <tag> [dirname]
     1.8 +# Usage: CT_GetCVS <basename> <url> <module> <tag> [dirname[=subdir]]
     1.9 +# Note: if '=subdir' is given, then it is used instead of 'module'.
    1.10  CT_GetCVS() {
    1.11      local basename="$1"
    1.12      local uri="$2"
    1.13 @@ -499,8 +500,18 @@
    1.14      CT_Pushd "${tmp_dir}"
    1.15  
    1.16      CT_DoExecLog ALL cvs -z 9 -d "${uri}" co -P ${tag} "${module}"
    1.17 -    [ -n "${dirname}" ] && CT_DoExecLog ALL mv "${module}" "${dirname}"
    1.18 -    CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${dirname:-${module}}"
    1.19 +    if [ -n "${dirname}" ]; then
    1.20 +        case "${dirname}" in
    1.21 +            *=*)
    1.22 +                CT_DoExecLog DEBUG mv "${dirname%%=*}" "${dirname#*=}"
    1.23 +                CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${dirname#*=}"
    1.24 +                ;;
    1.25 +            *)
    1.26 +                CT_DoExecLog ALL mv "${module}" "${dirname}"
    1.27 +                CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${basename}.tar.bz2" "${dirname:-${module}}"
    1.28 +                ;;
    1.29 +        esac
    1.30 +    fi
    1.31      CT_SaveLocal "${CT_TARBALLS_DIR}/${basename}.tar.bz2"
    1.32  
    1.33      CT_Popd