From owner-svn-doc-all@freebsd.org Tue Sep 19 09:57:16 2017 Return-Path: Delivered-To: svn-doc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF3CEE09924; Tue, 19 Sep 2017 09:57:16 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87222751A4; Tue, 19 Sep 2017 09:57:16 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8J9vFMZ072566; Tue, 19 Sep 2017 09:57:15 GMT (envelope-from wosch@FreeBSD.org) Received: (from wosch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8J9vFrq072565; Tue, 19 Sep 2017 09:57:15 GMT (envelope-from wosch@FreeBSD.org) Message-Id: <201709190957.v8J9vFrq072565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wosch set sender to wosch@FreeBSD.org using -f From: Wolfram Schneider Date: Tue, 19 Sep 2017 09:57:15 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r50879 - head/share/mk X-SVN-Group: doc-head X-SVN-Commit-Author: wosch X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 50879 X-SVN-Commit-Repository: doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2017 09:57:16 -0000 Author: wosch Date: Tue Sep 19 09:57:15 2017 New Revision: 50879 URL: https://svnweb.freebsd.org/changeset/doc/50879 Log: fix race conditions in doc image builds PR: 222327 Modified: head/share/mk/doc.images.mk Modified: head/share/mk/doc.images.mk ============================================================================== --- head/share/mk/doc.images.mk Tue Sep 19 09:54:21 2017 (r50878) +++ head/share/mk/doc.images.mk Tue Sep 19 09:57:15 2017 (r50879) @@ -102,15 +102,19 @@ EPS2PNM_RES?= 100 ## If we want grayscale, convert with ppmtopgm before running through pnmtops .if defined(GREYSCALE_IMAGES) .scr.eps: + tmpfile=$$(mktemp ${.TARGET}.XXXXXXXX); \ ${SCR2PNG} ${SCR2PNGOPTS} < ${.ALLSRC} | \ ${PNGTOPNM} ${PNGTOPNMOPTS} | \ ${PPMTOPGM} ${PPMTOPGMOPTS} | \ - ${PNMTOPS} ${PNMTOPSOPTS} > ${.TARGET} + ${PNMTOPS} ${PNMTOPSOPTS} > $$tmpfile && \ + ${MV} -f $$tmpfile ${.TARGET} .else .scr.eps: + tmpfile=$$(mktemp ${.TARGET}.XXXXXXXX); \ ${SCR2PNG} ${SCR2PNGOPTS} < ${.ALLSRC} | \ ${PNGTOPNM} ${PNGTOPNMOPTS} | \ - ${PNMTOPS} ${PNMTOPSOPTS} > ${.TARGET} + ${PNMTOPS} ${PNMTOPSOPTS} > $$tmpfile && \ + ${MV} -f $$tmpfile ${.TARGET} .endif # The .txt files need to have any trailing spaces trimmed from @@ -126,7 +130,8 @@ EPS2PNM_RES?= 100 | ${PNMTOPNG} > ${.TARGET} .pic.ps: - ${PIC2PS} ${.ALLSRC} > ${.TARGET} + tmpfile=$$(mktemp ${.TARGET}.XXXXXXXX); \ + ${PIC2PS} ${.ALLSRC} > $$tmpfile && ${MV} -f $$tmpfile ${.TARGET} # When ghostscript built with A4=yes is used, ps2epsi's paper size also # becomes the A4 size. However, the ps2epsi fails to convert grops(1) @@ -139,22 +144,24 @@ EPS2PNM_RES?= 100 # must contain %%BoundingBox line which the "gs -sDEVICE=bbox" outputs # (the older versions calculated BBox directly in ps2epsi.ps). .ps.eps: - ${PS2BBOX} ${PS2BBOXOPTS} ${.ALLSRC} > ${.TARGET} 2>&1 - ${SETENV} outfile=${.TARGET} ${PS2EPS} ${PS2EPSOPTS} < ${.ALLSRC} 1>&2 + tmpfile=$$(mktemp ${.TARGET}.XXXXXXXX); \ + ${PS2BBOX} ${PS2BBOXOPTS} ${.ALLSRC} > $$tmpfile 2>&1; \ + ${SETENV} outfile=$$tmpfile ${PS2EPS} ${PS2EPSOPTS} < ${.ALLSRC} 1>&2; \ (echo "save countdictstack mark newpath /showpage {} def /setpagedevice {pop} def";\ echo "%%EndProlog";\ echo "%%Page: 1 1";\ echo "%%BeginDocument: ${.ALLSRC}";\ - ) >> ${.TARGET} + ) >> $$tmpfile; \ ${SED} -e '/^%%BeginPreview:/,/^%%EndPreview[^!-~]*$$/d' \ -e '/^%!PS-Adobe/d' \ -e '/^%%[A-Za-z][A-Za-z]*[^!-~]*$$/d'\ - -e '/^%%[A-Za-z][A-Za-z]*: /d' < ${.ALLSRC} >> ${.TARGET} + -e '/^%%[A-Za-z][A-Za-z]*: /d' < ${.ALLSRC} >> $$tmpfile; \ (echo "%%EndDocument";\ echo "%%Trailer";\ echo "cleartomark countdictstack exch sub { end } repeat restore";\ echo "%%EOF";\ - ) >> ${.TARGET} + ) >> $$tmpfile; \ + ${MV} -f $$tmpfile ${.TARGET} # We can't use suffix rules to generate the rules to convert EPS to PNG and # PNG to EPS. This is because a .png file can depend on a .eps file, and