On Tue, Aug 01, 2023 at 11:17:48AM +0200, Sebastien Marie wrote: > On Mon, Jul 31, 2023 at 10:17:05PM +0000, Klemens Nanni wrote: > > 'make patch' on a WXNEEDED=Yes port without wxallowed fails after > > patching and before creating the patch cookie, so subsequent setting > > of the option and rerunning the target will try to patch again. > > > > If the check is done right after extract, rerunning that target usually > > has higher chances of just working. > > > > Is there a reason I'm not aware of that this is done after patch? > > > > > > I just forgot to set wxallowed on /usr/ports/pobj when building > > ungoogled-chromium where 'make clean && mount ... && make patch' takes > > considerably longer than 'mount ... && make extract' to recover from > > forgetting to set wxallowed. > > Personally, having it in extract step might be not convenient as extracting > will > require 'wxallowed', even if I just want to extract to look at source code.
Good point. > Ideally, I would put such control code at start of 'configure' step. Doesn't "gen" also run GNU auto* which potentially needs wxallowed? That's why I have moved it there now. Either way, making the check the first step of a target instead needs its own target so that PORTS_PRIVSEP=Yes stays in effect. post-* or *-finalize where the first diff put it do not need that, as they're already run as _pbuild. Does that still work for everyone's favourite USE_WXNEEDED=Yes workflow without breaking other stuff, when you forget to set wxallowed? Index: bsd.port.mk =================================================================== RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v retrieving revision 1.1595 diff -u -p -r1.1595 bsd.port.mk --- bsd.port.mk 8 Jul 2023 10:20:16 -0000 1.1595 +++ bsd.port.mk 6 Aug 2023 12:05:44 -0000 @@ -2858,14 +2858,6 @@ ${_PATCH_COOKIE}: ${_EXTRACT_COOKIE} # Run as _pbuild _post-patch-finalize: -.if ${USE_WXNEEDED:L} == "yes" - @wrktmp=`df -P ${WRKOBJDIR_${PKGPATH}} | awk 'END { print $$6 }'`; \ - if ! mount | grep -q " $${wrktmp} .*wxallowed"; then \ - echo "Fatal: ${WRKOBJDIR_${PKGPATH}} must be on a wxallowed filesystem" \ - "(in ${PKGPATH})" >&2; \ - false; \ - fi -.endif .if !empty(_LINKER_FLAGS) || ${_NONDEFAULT_LD:L} == "yes" @printf '#!/bin/sh\nexec ${_LD_PROGRAM} ${_LINKER_FLAGS} "$$@"\n' >${WRKDIR}/bin/ld @chmod 555 ${WRKDIR}/bin/ld @@ -2905,10 +2897,23 @@ _gen-finalize: esac; done .endif +.if ${USE_WXNEEDED:L} == "yes" +_use-wxneeded: + @wrktmp=`df -P ${WRKOBJDIR_${PKGPATH}} | awk 'END { print $$6 }'`; \ + if ! mount | grep -q " $${wrktmp} .*wxallowed"; then \ + echo "Fatal: ${WRKOBJDIR_${PKGPATH}} must be on a wxallowed filesystem" \ + "(in ${PKGPATH})" >&2; \ + false; \ + fi +.endif + # The real gen stage ${_GEN_COOKIE}: ${_PATCH_COOKIE} @${ECHO_MSG} "===> Generating configure for ${FULLPKGNAME}${_MASTER}" +.if ${USE_WXNEEDED:L} == "yes" + @${_PMAKE} _use-wxneeded +.endif .if target(do-gen) @${_PMAKE} do-gen .endif