[PATCH 5 of 5] scripts/functions: force extract folder to archive basename
Benoît THÉBAUDEAU
benoit.thebaudeau@advansee.com
Thu Jul 28 19:10:00 GMT 2011
# HG changeset patch
# User "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
# Date 1311867232 -7200
# Node ID 50c28edc0a0ebe6bf285b6656233365e2ed88df0
# Parent ac0f1f93198fca8e2f28b9499e197fa387c67234
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>
diff --git a/scripts/functions b/scripts/functions
--- a/scripts/functions
+++ b/scripts/functions
@@ -728,10 +728,15 @@
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) { bzcat "${full_file}" \
+ |tar --strip-components=1 -C "${basename}" -xvf - ;
+ } 2>&1 |CT_DoLog FILE;;
+ .tar.gz|.tgz) { gzip -d -c "${full_file}" \
+ |tar --strip-components=1 -C "${basename}" -xvf - ;
+ } 2>&1 |CT_DoLog 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
More information about the crossgcc
mailing list