This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1 of 5] scripts/functions: force extract folder to archive basename


# HG changeset patch
# User "BenoÃt THÃBAUDEAU" <benoit.thebaudeau@advansee.com>
# Date 1311937489 -7200
# Node ID 6e1412ba8da9b9b8c100482fce442bf83d520f63
# Parent  424fa2092ace47d4d2f417d40f372293a2f02f26
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,11 @@
     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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]