make mirror-maker sturdier:

- pass an argument for the file into which we want to save the result, to
avoid getting it polluted with error messages (defaults to /dev/stdout for
debug).
- create the makefile fragment as a temp file and only copy it when complete.
- copy it in one chunk, so that one can read a partial mirror-maker file
and have it be usable.

This does allow for people to start a make mirror-maker in one shell, and
start fetching stuff right away, before mirror-maker is finished.

This also produces usable mirror-maker Makefiles even if the ports tree
contains bogus entries.
This commit is contained in:
espie 2007-07-28 12:58:34 +00:00
parent 1bf103301e
commit fb338f26c3
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.54 2006/11/27 15:38:01 espie Exp $
# $OpenBSD: Makefile,v 1.55 2007/07/28 12:58:34 espie Exp $
# $FreeBSD: Makefile,v 1.36 1997/10/04 15:54:31 jkh Exp $
#
@ -115,7 +115,7 @@ mirror-maker:
trap "rm -f $${_DONE_FILES}" 0 1 2 3 13 15; \
${MAKE} fetch-makefile \
ECHO_MSG='echo >&2' \
>>${MIRROR_MK}
_FETCH_MAKEFILE=${MIRROR_MK}
homepages.html:
@echo '<html><ul>' >$@

View File

@ -1,6 +1,6 @@
#-*- mode: Makefile; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make:
# $OpenBSD: bsd.port.mk,v 1.911 2007/07/09 13:32:56 espie Exp $
# $OpenBSD: bsd.port.mk,v 1.912 2007/07/28 12:58:34 espie Exp $
# $FreeBSD: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp $
# $NetBSD: bsd.port.mk,v 1.62 1998/04/09 12:47:02 hubertf Exp $
#
@ -69,6 +69,7 @@ CLEANDEPENDS ?= No
USE_SYSTRACE ?= No
BULK ?= No
RECURSIVE_FETCH_LIST ?= Yes
_FETCH_MAKEFILE ?= /dev/stdout
WRKOBJDIR ?=
FAKEOBJDIR ?=
BULK_TARGETS ?=
@ -2333,7 +2334,13 @@ _internal-clean:
# mirroring utilities
fetch-makefile:
@exec ${MAKE} __FETCH_ALL=Yes __ARCH_OK=Yes NO_IGNORE=Yes _fetch-makefile
@mk=`mktemp ${TMPDIR}/mk.XXXXXXX`; \
if ${MAKE} __FETCH_ALL=Yes __ARCH_OK=Yes NO_IGNORE=Yes _fetch-makefile >$$mk; then \
cat $$mk >>${_FETCH_MAKEFILE}; \
else \
echo >&2 "Problem in ${PKGPATH}"; \
fi; \
rm -f $$mk
mirror-maker-fetch:
@mk=`mktemp ${TMPDIR}/mk.XXXXXXXX`; ${MAKE} fetch-makefile >$$mk; \