Monday, July 31, 2023

bsd.port.mk: check wxallowed after extract not patch

'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.

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 31 Jul 2023 21:54:52 -0000
@@ -2718,6 +2718,14 @@ ${_EXTRACT_COOKIE}: ${_WRKDIR_COOKIE}

# run as _pbuild
_post-extract-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
.for _m in ${MODULES:T:U}
. if defined(MOD${_m}_post-extract)
@${MOD${_m}_post-extract}
@@ -2858,14 +2866,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

No comments:

Post a Comment