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]

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


BenoÃt, All,

On Thursday 28 July 2011 21:10:13 BenoÃt THÃBAUDEAU wrote:
> # 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;;

Why don't you use:
  CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvjf "${full_file}";;
...

> +        .tar.gz|.tgz) { gzip -d -c "${full_file}" \
> +                        |tar --strip-components=1 -C "${basename}" -xvf - ;
> +                      } 2>&1 |CT_DoLog FILE;;

... and here with -xvzf ...

> +        .tar)         CT_DoExecLog FILE tar --strip-components=1 -C "${basename}" -xvf "${full_file}";;

... while you are using it here?

>          /.git)        CT_ExtractGit "${basename}" "${@}";;
>          *)            CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
>                        return 1
> 

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq


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