Some comments already. I haven't looked very closely.
On Sat, Aug 05, 2023 at 03:12:18PM -0400, Thomas Frohwein wrote:
> The current draft hijacks post-extract target, but it would be easy to
> add this to _post-extract-finalize in bsd.port.mk similar to how the
> post-extract commands from modules are handled, if this is of interest.
Please do that.
> # where submodule distfiles will be stored
> GHSM_DIST_SUBDIR ?= gh-submodules
Please keep to the GH_* subspace.
Already, modules usually use MOD* variable names, but in the GH case, that
would be a bit long.
> .for _ghaccount _ghproject _ghtagcommit _targetdir in ${GH_SUBMODULES}
> DISTFILES +=
> ${GHSM_DIST_SUBDIR}/{}${_ghaccount}/${_ghproject}/archive/${_ghtagcommit}${GH_SUFX}:${GHSM_MASTER_SITESN}
> .endfor
>
> # post-extract target for moving the submodules to the target directories
> GHSM_post-extract =
> .for _ghaccount _ghproject _ghtagcommit _targetdir in ${GH_SUBMODULES}
> GHSM_post-extract += \
> test -d ${GHSM_WRKSR}/${_targetdir} || rm -rf
> ${GHSM_WRKSRC}/${_targetdir} ; \
That line is weird.
> mv ${WRKDIR}/${_ghproject}-${_ghtagcommit} ${GHSM_WRKSRC}/${_targetdir}
> ;
> .endfor
Please do a single loop. That's slightly more readable for me.
> # XXX: would best belong in _post-extract-finalize in bsd.port.mk rather than
> # hijacking post-extract here
> post-extract:
> @${ECHO_MSG} "moving GitHub submodules to ${GHSM_WRKSRC}" ;
> mkdir -p ${GHSM_WRKSRC} ;
> ${GHSM_post-extract}
Also please draft a diff for port-modules(5)
I'm also wondering if keeping the main GH_* stuff in bsd.port.mk makes a lot
of sense, instead of grouping everything in github.port.mk