Makeing fetchindex really mirror INDEX

Alexander Leidinger Alexander at Leidinger.net
Sun Jan 9 08:49:29 PST 2005


On Sun, 9 Jan 2005 15:39:04 +0100
"Simon L. Nielsen" <simon at freebsd.org> wrote:

>  fetchindex:
> -	@cd ${.CURDIR} && ${FETCHINDEX} ${MASTER_SITE_INDEX}/${INDEXFILE}.bz2 && bunzip2 -f ${INDEXFILE}.bz2 && chmod a+r ${INDEXFILE}
> +	@${FETCHINDEX} -o ${.CURDIR}/${INDEXFILE}.bz2 \
> +		${MASTER_SITE_INDEX}${INDEXFILE}.bz2
> +	@cd ${.CURDIR} && if [ ${INDEXFILE}.bz2 -nt ${INDEXFILE} ]; then \
> +		bunzip2 < ${INDEXFILE}.bz2 > ${INDEXFILE}; \
> +		chmod a+r ${INDEXFILE}; \
> +	fi

Why do you do the work "make" is supposed to do?

The following does what you want (and "make index" works too):
---snip---
Index: Makefile
===================================================================
RCS file: /big/FreeBSD-CVS/ports/Makefile,v
retrieving revision 1.90
diff -u -u -r1.90 Makefile
--- Makefile    17 Dec 2004 11:23:22 -0000      1.90
+++ Makefile    9 Jan 2005 16:45:36 -0000
@@ -69,8 +69,14 @@
        @rm -f ${.CURDIR}/${INDEXFILE}
        @cd ${.CURDIR} && make ${.CURDIR}/${INDEXFILE}
 
-fetchindex:
-       @cd ${.CURDIR} && ${FETCHINDEX} ${MASTER_SITE_INDEX}/${INDEXFILE}.bz2 && bunzip2 -f ${INDEXFILE}.bz2 && chmod a+r ${INDEXFILE}
+${INDEXFILE}.bz2: .PHONY
+       @${FETCHINDEX} ${MASTER_SITE_INDEX}${INDEXFILE}.bz2
+
+${INDEXFILE}: ${INDEXFILE}.bz2 
+       @bunzip2 <${INDEXFILE}.bz2 >${INDEXFILE}
+       @chmod a+r ${INDEXFILE}
+
+fetchindex: ${INDEXFILE}
 
 MASTER_SITE_INDEX?=    http://www.FreeBSD.org/ports/
 FETCHINDEX?=   fetch -am
---snip---

BTW.: if I do it the right way (".PHONY: ${INDEXFILE}.bz2" instead of
adding " .PHONY" to "${INDEXFILE}.bz2:"), it doesn't work here
(6-current) as expected.

Bye,
Alexander.

-- 
         The computer revolution is over. The computers won.

http://www.Leidinger.net                       Alexander @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7


More information about the freebsd-ports mailing list