On 2018/05/21 15:03, Klemens Nanni wrote:
> Coming from
>
> $ make rebuild
> rm: /tmp/pobj/dwm-6.1/.build_done: Permission denied
> *** Error 1 in /usr/ports/x11/dwm
> (/usr/ports/infrastructure/mk/bsd.port.mk:3409 'rebuild': @rm -f
> /tmp/pobj/dwm-6.1/.build_done)
>
> and some target practise, here's a diff that sprinkles ${_PBUILD} and
> ${_PFETCH} into the rebuild, peek-ftp, show-size and show-fake-size
> targets so they work with PORTS_PRIVSEP set.
>
> As per bsd.port.mk(5), ${FETCH_CMD} is a user setting, so I did not
> embed ${_PFETCH} in contrast to ${LOCK_CMD} and ${TEST_LOG}.
>
> Feedback?
>
> Index: bsd.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> retrieving revision 1.1402
> diff -u -p -r1.1402 bsd.port.mk
> --- bsd.port.mk 17 May 2018 09:59:36 -0000 1.1402
> +++ bsd.port.mk 21 May 2018 12:29:32 -0000
> @@ -3406,7 +3406,7 @@ repackage:
> @${_MAKE} package
>
> rebuild:
> - @rm -f ${_BUILD_COOKIE}
> + @${_PBUILD} rm -f ${_BUILD_COOKIE}
> @${_MAKE} build
>
heh, I wrote a diff for this one today. OK (but please let Marc have a
chance to reply too).
> uninstall deinstall:
> @@ -3415,10 +3415,10 @@ uninstall deinstall:
>
> peek-ftp:
> @echo "DISTFILES=${DISTFILES}"
> - @install -d ${DISTDIR_MODE} ${FULLDISTDIR}; \
> + @${_PFETCH} install -d ${DISTDIR_MODE} ${FULLDISTDIR}; \
> cd ${FULLDISTDIR}; echo "cd ${FULLDISTDIR}"; \
> for i in ${MASTER_SITES:Mftp*}; do \
> - echo "Connecting to $$i"; ${FETCH_CMD} $$i ; break; \
> + echo "Connecting to $$i"; ${_PFETCH} ${FETCH_CMD} $$i ; break; \
> done
OK.
> show-required-by:
> @@ -3434,17 +3434,17 @@ show:
> # du fails if it can't access everything
> show-size:
> @if du -ks ${WRKDIR} 2>/dev/null >${WRKDIR}/wrkdir-size; then \
> - cat ${WRKDIR}/wrkdir-size && rm -f ${WRKDIR}/wrkdir-size; \
> + cat ${WRKDIR}/wrkdir-size && ${_PBUILD} rm -f
> ${WRKDIR}/wrkdir-size; \
I think maybe there's a problem here? The redirection isn't done as _pbuild.
Untested but you could try the old hack for writing as a different user,
e.g. "| ${_PBUILD} tee ${WRKDIR}/wrkdir-size" instead.
> else \
> - chmod -R u+rX ${WRKDIR}; \
> + ${_PBUILD} chmod -R u+rX ${WRKDIR}; \
> du -ks ${WRKDIR}; \
> fi
I think that's okay, though I'm wondering why the first one writes to
wrkdir-size
and this one doesn't.
> show-fake-size:
> @if du -ks ${WRKINST} 2>/dev/null >${WRKINST}/wrkdir-size; then \
> - cat ${WRKINST}/wrkdir-size && rm -f ${WRKINST}/wrkdir-size; \
> + cat ${WRKINST}/wrkdir-size && ${_PBUILD} rm -f
> ${WRKINST}/wrkdir-size; \
> else \
> - chmod -R u+rX ${WRKINST}; \
> + ${_PBUILD} chmod -R u+rX ${WRKINST}; \
> du -ks ${WRKINST}; \
> fi
same as previous.