diff mbox

[1/5] support/download: fix the bzr helper

Message ID 7397ced020b7a64534c6a240304998d2bf11c961.1404681878.git.yann.morin.1998@free.fr
State Accepted
Commit 84d798694090725eda9e9df37cbb4ba09b631d3e
Headers show

Commit Message

Yann E. MORIN July 6, 2014, 9:27 p.m. UTC
bzr uses the name of the extension of the output file to known what
output format to use: tar, tgz, tar.bz2... If no extension is
recognised, bzr will output to a directory.

Since we use 'mktemp .XXXXXX' to generate temporary files, it obviously
never ends with a recognised extension. Thus, bzr expects the output to
be a directory, and fails since it is a file.

Fix that by forcing the output format.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 support/download/bzr | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnout Vandecappelle July 7, 2014, 5:54 a.m. UTC | #1
On 06/07/14 23:27, Yann E. MORIN wrote:
> bzr uses the name of the extension of the output file to known what
> output format to use: tar, tgz, tar.bz2... If no extension is
> recognised, bzr will output to a directory.
> 
> Since we use 'mktemp .XXXXXX' to generate temporary files, it obviously
> never ends with a recognised extension. Thus, bzr expects the output to
> be a directory, and fails since it is a file.

 I think it would be much simpler and more natural to use

tmp_dl="$( mktemp "${BUILD_DIR}/.XXXXXX.tar.gz" )"
tmp_output="$( mktemp "${output}.XXXXXX.tar.gz" )"

> 
> Fix that by forcing the output format.

 But of course, forcing it explicitly never hurts.

 So even with my earlier comment, this one gets my

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  support/download/bzr | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/download/bzr b/support/download/bzr
> index 3f52ee9..19d837d 100755
> --- a/support/download/bzr
> +++ b/support/download/bzr
> @@ -26,7 +26,7 @@ tmp_output="$( mktemp "${output}.XXXXXX" )"
>  # - finally, we atomically rename to the final file
>  
>  ret=1
> -if ${BZR} export "${tmp_dl}" "${repo}" -r "${rev}"; then
> +if ${BZR} export --format=tgz "${tmp_dl}" "${repo}" -r "${rev}"; then
>      if mv "${tmp_dl}" "${tmp_output}"; then
>          mv "${tmp_output}" "${output}"
>          ret=0
>
diff mbox

Patch

diff --git a/support/download/bzr b/support/download/bzr
index 3f52ee9..19d837d 100755
--- a/support/download/bzr
+++ b/support/download/bzr
@@ -26,7 +26,7 @@  tmp_output="$( mktemp "${output}.XXXXXX" )"
 # - finally, we atomically rename to the final file
 
 ret=1
-if ${BZR} export "${tmp_dl}" "${repo}" -r "${rev}"; then
+if ${BZR} export --format=tgz "${tmp_dl}" "${repo}" -r "${rev}"; then
     if mv "${tmp_dl}" "${tmp_output}"; then
         mv "${tmp_output}" "${output}"
         ret=0