[vlc-devel] [PATCH] contrib: remove empty file on download fail

Thomas Guillem thomas at gllm.fr
Wed Aug 26 11:32:25 CEST 2020



On Wed, Aug 26, 2020, at 11:22, Alexandre Janniaux wrote:
> Hi,
> 
> This is probably missing `-f` in order to avoid failure with
> the rm command, and the rm should probably be done before curl
> so as to remove the dependency if it exists and correctly return
> an error in case of failure with curl.

If it's done before the curl command then download won't be executed again after a failure. That is what I'm trying to solve. (makefile dependencies)

Also, the download command is not appending but overriding, this make a rm before curl useless.

Since the file is always created, regardless of failure or not, I don't think the "-f" is useful.


> 
>    download = rm -f "$@" && curl -f -L -- "$(1)" > "$@"
> 
> Regards,
> --
> Alexandre Janniaux
> Videolabs
> 
> On Wed, Aug 26, 2020 at 11:09:26AM +0200, Thomas Guillem wrote:
> > This fixes package not downloaded again in case of a first failure.
> >
> > The other download rules (wget, fetch) are already following this behavior on
> > fail.
> > ---
> >  contrib/src/main.mak | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/contrib/src/main.mak b/contrib/src/main.mak
> > index d0df860a954..fc1480cca19 100644
> > --- a/contrib/src/main.mak
> > +++ b/contrib/src/main.mak
> > @@ -247,7 +247,7 @@ endif
> >  SVN ?= $(error subversion client (svn) not found)
> >
> >  ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
> > -download = curl -f -L -- "$(1)" > "$@"
> > +download = curl -f -L -- "$(1)" > "$@" || rm "$@"
> >  else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
> >  download = (rm -f $@.tmp && \
> >  	wget --passive -c -p -O $@.tmp "$(1)" && \
> > --
> > 2.28.0
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list