patch for force fetch

David Demelier demelier.david at gmail.com
Mon May 16 08:15:37 UTC 2011


On 16/05/2011 09:02, Andriy Gapon wrote:
>
> I've noticed the following problem.
> If a distfile is updated by a distributor without renaming it (so that checksum
> and possibly size change), then more often than not the port build system would
> fail to fetch the distfile.
> An example:
> ...
>   =>  SHA256 Checksum mismatch for eclipse/javax.servlet.jsp_2.0.0.v200806031607.jar.
> ...
> =>  javax.servlet.jsp_2.0.0.v200806031607.jar doesn't seem to exist in
> /usr/ports/distfiles/eclipse.
> =>  Attempting to fetch
> http://download.eclipse.org/tools/orbit/downloads/drops/R20100519200754/bundles/javax.servlet.jsp_2.0.0.v200806031607.jar
> fetch:
> http://download.eclipse.org/tools/orbit/downloads/drops/R20100519200754/bundles/javax.servlet.jsp_2.0.0.v200806031607.jar:
> Requested Range Not Satisfiable
> =>  Attempting to fetch
> ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/eclipse/javax.servlet.jsp_2.0.0.v200806031607.jar
> fetch:
> ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/eclipse/javax.servlet.jsp_2.0.0.v200806031607.jar:
> size mismatch: expected 63889, actual 62707
> =>  Couldn't fetch it - please try to retrieve this
> =>  port manually into /usr/ports/distfiles/eclipse and try again.
> *** Error code 1
>
> I think that this happens because the old version of the distfile is still
> present in download target location and fetch(1) thinks that it has a partially
> downloaded file and tries to be smart.
>
> The following patch simply tries to remove the stale distfile before calling
> fetch.  Maybe there is a smarter way about this, like e.g. passing some option
> to fetch.
>
> --- /usr/ports/Mk/bsd.port.mk.orig	2011-05-16 09:53:49.461968872 +0300
> +++ /usr/ports/Mk/bsd.port.mk	2011-05-16 09:56:47.995971662 +0300
> @@ -3562,6 +3562,9 @@
>   			   ${ECHO_MSG} "=>  ${DISTDIR} is not writable by you; cannot fetch."; \
>   			   exit 1; \
>   			fi; \
> +			if [ "$$force_fetch" = "true" ]; then \
> +				rm -f $$file $$filebasename \
> +			fi \
>   			if [ ! -z "$$select" ] ; then \
>   				__MASTER_SITES_TMP= ; \
>   				for group in $$select; do \
>

make -DNO_CHECKSUM=yes ... is probably what you want, I guess.

Cheers,

-- 
David Demelier


More information about the freebsd-ports mailing list