scripts/functions: force extract folder to archive basename
author"Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Fri Jul 29 13:04:49 2011 +0200 (2011-07-29)
changeset 25746e1412ba8da9
parent 2573 424fa2092ace
child 2575 b0cc1bf3e851
scripts/functions: force extract folder to archive basename

Some archives like those of the 2011.07 revisions of Linaro GCC contain a folder
name different from the archive basename, which leads to errors afterwards, e.g.
when patching. E.g.:
gcc-linaro-4.5-2011.07.tar.bz2 extracts to gcc-linaro-4.5-2011.07-0/

This patch changes CT_Extract() to force the extraction of all archives to a
folder named like the archive basename. E.g.:
gcc-linaro-4.5-2011.07.tar.bz2 now extracts to gcc-linaro-4.5-2011.07/

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
scripts/functions
     1.1 --- a/scripts/functions	Thu Jul 28 22:09:31 2011 +0200
     1.2 +++ b/scripts/functions	Fri Jul 29 13:04:49 2011 +0200
     1.3 @@ -728,10 +728,11 @@
     1.4      CT_Pushd "${nochdir}"
     1.5  
     1.6      CT_DoLog EXTRA "Extracting '${basename}'"
     1.7 +    CT_DoExecLog FILE mkdir -p "${basename}"
     1.8      case "${ext}" in
     1.9 -        .tar.bz2)     CT_DoExecLog FILE tar xvjf "${full_file}";;
    1.10 -        .tar.gz|.tgz) CT_DoExecLog FILE tar xvzf "${full_file}";;
    1.11 -        .tar)         CT_DoExecLog FILE tar xvf  "${full_file}";;
    1.12 +        .tar.bz2)     CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvjf "${full_file}";;
    1.13 +        .tar.gz|.tgz) CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvzf "${full_file}";;
    1.14 +        .tar)         CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvf "${full_file}";;
    1.15          /.git)        CT_ExtractGit "${basename}" "${@}";;
    1.16          *)            CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
    1.17                        return 1