All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] pkg-infra: Fix wget -O
@ 2012-03-04 21:10 Arnout Vandecappelle
  2012-03-04 22:50 ` Alvaro Gamez
  2012-03-05  9:30 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2012-03-04 21:10 UTC (permalink / raw)
  To: buildroot

wget -O always creates its output file, so we need a different way to
detect if the download succeeded or not.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
Ideally, wget should have an option to name the downloaded file.
-O <filename> is in fact fully equivalent to -O - > <filename>...
Maybe we should move to curl after all? :-)

 package/Makefile.package.in |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/package/Makefile.package.in b/package/Makefile.package.in
index ea44c6c..da6aee0 100644
--- a/package/Makefile.package.in
+++ b/package/Makefile.package.in
@@ -236,9 +236,13 @@ define SHOW_EXTERNAL_DEPS_HG
 endef
 
 
+# wget -O ... creates the output file before downloading it, so
+# it will essentially always succeed.  As a workaround, test that
+# it is non-empty both before and after.
 define DOWNLOAD_WGET
-	test -e $(DL_DIR)/$(2) || \
-	$(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2)
+	test -s $(DL_DIR)/$(2) || \
+	$(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2) && \
+	test -s $(DL_DIR)/$(2)
 endef
 
 define SOURCE_CHECK_WGET
-- 
tg: (dca6e03..) t/wget (depends on: master)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] pkg-infra: Fix wget -O
  2012-03-04 21:10 [Buildroot] [PATCH] pkg-infra: Fix wget -O Arnout Vandecappelle
@ 2012-03-04 22:50 ` Alvaro Gamez
  2012-03-05  9:30 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Alvaro Gamez @ 2012-03-04 22:50 UTC (permalink / raw)
  To: buildroot

This should be taken into account when the Microblaze related patches get
applied, since this function is severely modified by one of those patches.

2012/3/4 Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

> wget -O always creates its output file, so we need a different way to
> detect if the download succeeded or not.
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> Ideally, wget should have an option to name the downloaded file.
> -O <filename> is in fact fully equivalent to -O - > <filename>...
> Maybe we should move to curl after all? :-)
>
>  package/Makefile.package.in |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/package/Makefile.package.in b/package/Makefile.package.in
> index ea44c6c..da6aee0 100644
> --- a/package/Makefile.package.in
> +++ b/package/Makefile.package.in
> @@ -236,9 +236,13 @@ define SHOW_EXTERNAL_DEPS_HG
>  endef
>
>
> +# wget -O ... creates the output file before downloading it, so
> +# it will essentially always succeed.  As a workaround, test that
> +# it is non-empty both before and after.
>  define DOWNLOAD_WGET
> -       test -e $(DL_DIR)/$(2) || \
> -       $(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2)
> +       test -s $(DL_DIR)/$(2) || \
> +       $(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2) && \
> +       test -s $(DL_DIR)/$(2)
>  endef
>
>  define SOURCE_CHECK_WGET
> --
> tg: (dca6e03..) t/wget (depends on: master)
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>



-- 
?lvaro G?mez Machado
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120304/3c90394b/attachment-0001.html>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] pkg-infra: Fix wget -O
  2012-03-04 21:10 [Buildroot] [PATCH] pkg-infra: Fix wget -O Arnout Vandecappelle
  2012-03-04 22:50 ` Alvaro Gamez
@ 2012-03-05  9:30 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2012-03-05  9:30 UTC (permalink / raw)
  To: buildroot

Le Sun,  4 Mar 2012 22:10:23 +0100,
"Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be> a ?crit :

> wget -O always creates its output file, so we need a different way to
> detect if the download succeeded or not.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

I found the same problem this week-end, and I think that we should
remove the empty file after the download if the download failed. I
don't like having empty files that remain in my download directory.

I will send my version shortly.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-05  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-04 21:10 [Buildroot] [PATCH] pkg-infra: Fix wget -O Arnout Vandecappelle
2012-03-04 22:50 ` Alvaro Gamez
2012-03-05  9:30 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.