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>
This commit is contained in:
Benoît THÉBAUDEAU" 2011-07-29 13:04:49 +02:00
parent 2ea05ecaa7
commit 6c7f5488ee

View File

@ -728,10 +728,11 @@ CT_Extract() {
CT_Pushd "${nochdir}"
CT_DoLog EXTRA "Extracting '${basename}'"
CT_DoExecLog FILE mkdir -p "${basename}"
case "${ext}" in
.tar.bz2) CT_DoExecLog FILE tar xvjf "${full_file}";;
.tar.gz|.tgz) CT_DoExecLog FILE tar xvzf "${full_file}";;
.tar) CT_DoExecLog FILE tar xvf "${full_file}";;
.tar.bz2) CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvjf "${full_file}";;
.tar.gz|.tgz) CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvzf "${full_file}";;
.tar) CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvf "${full_file}";;
/.git) CT_ExtractGit "${basename}" "${@}";;
*) CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
return 1