Hi porters,
I would like to make progress with DIST_TUPLE with an IMO better
approach that removes currently needed workarounds for WRKDIST in most
cases. Key changes are: 1) most cases shouldn't need to set WRKDIST,
and 2) control this through TEMPLATE_WRKDIST_* variables in
dist-tuple.pattern, which should be the main (and hopefully generally
*only* file) to edit for adding new upstream source sites.
This has been through a bulk build, with the only attributable fallout
in the 2 ports below that justify special treatment with manual setting
of WRKDIST.
Diff for DIST_TUPLE at the bottom; obviously for post-8.0 ports tree
unlock.
With this, many ports that had to set WRKDIST manually don't need to do
this anymore (codeberg; ports using commit hash and DISTNAME...). This
can be cleaned up subsequently.
Two ports require adjustments, both of which exhibit non-standard use
cases:
- lang/nim: uses SITES+DISTNAME *and* multiple DIST_TUPLE with '.'
target dir. Non-standard use, so should set WRKDIST manually.
- devel/jj-gh: non-standard GH tagnames (jj-gh-v0.3.1); therefore
justifiable to require this to set WRKDIST manually. (There may be a
smarter regex for *_TAG_MOD.github that can avoid this.)
Diffs for fixing both ports are in the attachment.
ok?
Index: db/dist-tuple.pattern
===================================================================
RCS file: /cvs/ports/infrastructure/db/dist-tuple.pattern,v
diff -u -p -r1.13 dist-tuple.pattern
--- db/dist-tuple.pattern 16 Jan 2026 06:12:28 -0000 1.13
+++ db/dist-tuple.pattern 24 Sep 2026 22:32:55 -0000
@@ -36,6 +36,25 @@ TEMPLATE_DISTFILES.kde ?= \
TEMPLATE_DISTFILES.srht ?= \
<account>-<project>-{~<account>/<project>/archive/}<id>${EXTRACT_SUFX.srht}
+# Templates for WRKDIST; all relative to WRKDIR; same substitutions as for
+# DISTFILES.x. Defaults to TEMPLATE_WRKDIST_TAG for tagged commits and
+# TEMPLATE_WRKDIST_HASH for commit hashes. Set TEMPLATE_WRKDIST_{TAG,HASH}.x
+# to use different pattern.
+# *_MOD e.g. :S or :C make(1) substitution rules for the respective
+# TEMPLATE_WRKDIST_*.
+# - <distname> - substituted for _DT_DISTNAME (see dist-tuple.port.mk)
+TEMPLATE_WRKDIST_TAG ?= <distname>
+TEMPLATE_WRKDIST_TAG_MOD ?=
+TEMPLATE_WRKDIST_HASH ?= <project>-<id>
+TEMPLATE_WRKDIST_HASH_MOD ?= :C,^.*/,,
+
+TEMPLATE_WRKDIST_TAG.codeberg ?= <project>
+TEMPLATE_WRKDIST_HASH.codeberg ?= <project>
+
+TEMPLATE_WRKDIST_TAG.github ?= <project>-<id>
+# XXX: this uses TEMPLATE_WRKDIST_HASH_MOD as the first part -> unify?
+TEMPLATE_WRKDIST_TAG_MOD.github ?= :C,^.*/,,:C/\-(v|V)([0-9])/-\2/:S,/,-,g
+
# template for HOMEPAGE; same substitutions as for DISTFILES.x
# Defaults to TEMPLATE_HOMEPAGE. Set TEMPLATE_HOMEPAGE.x to use different
pattern.
# - <site> - substituted, may correspond to SITES.x
Index: mk/bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
diff -u -p -r1.1652 bsd.port.mk
--- mk/bsd.port.mk 19 Sep 2026 23:17:29 -0000 1.1652
+++ mk/bsd.port.mk 24 Sep 2026 22:32:55 -0000
@@ -897,8 +897,6 @@ WRKDIST ?= ${WRKDIR}/${GH_PROJECT}-${GH_
WRKDIST ?= ${WRKDIR}/${GH_PROJECT}-${GH_COMMIT}
.elif defined(DISTNAME)
WRKDIST ?= ${WRKDIR}/${DISTNAME}
-.elif !empty(_DT_WRKDIST)
-WRKDIST ?= ${_DT_WRKDIST}
.else
WRKDIST ?= ${WRKDIR}
.endif
Index: mk/dist-tuple.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/dist-tuple.port.mk,v
diff -u -p -r1.22 dist-tuple.port.mk
--- mk/dist-tuple.port.mk 1 Apr 2026 15:14:57 -0000 1.22
+++ mk/dist-tuple.port.mk 24 Sep 2026 22:32:55 -0000
@@ -24,15 +24,28 @@ DIST_TUPLE ?=
ERRORS += "Fatal: invalid choice for DIST_TUPLE: ${_template}"
. endif
+# Defaults
_subdir =
+TEMPLATE_WRKDIST_TAG.${_template} ?= ${TEMPLATE_WRKDIST_TAG}
+TEMPLATE_WRKDIST_TAG_MOD.${_template} ?= ${TEMPLATE_WRKDIST_TAG_MOD}
+TEMPLATE_WRKDIST_HASH.${_template} ?= ${TEMPLATE_WRKDIST_HASH}
+TEMPLATE_WRKDIST_HASH_MOD.${_template} ?= ${TEMPLATE_WRKDIST_HASH_MOD}
+
. if "${_id}" == "HASH" || "${_id:C/^[0-9a-f]{10,40}$/HASH/}" != "HASH"
# set DISTNAME if not done by the port and add refs/tags/ subdir
_distname ?=
${_project}-${_id:C/^(v|V|ver|[Rr]el|[Rr]elease)[-._]?([0-9])/\2/:S,/,-,g}
DISTNAME ?= ${_distname}
_subdir = refs/tags/
-_DT_WRKDIST ?= ${WRKDIR}/${_distname}
+_mode = TAG
. else
-_DT_WRKDIST ?= ${WRKDIR}/${_project:C,^.*/,,}-${_id}
+_mode = HASH
+. endif
+
+# set WRKDIST only if target dir '.'
+. if "${_targetdir}" == "."
+. for _subst in
S,<distname>,${_distname},g:S,<account>,${_account},g:S,<project>,${_project},g:S,<id>,${_id},g${TEMPLATE_WRKDIST_${_mode}_MOD.${_template}}
+WRKDIST ?= ${WRKDIR}/${TEMPLATE_WRKDIST_${_mode}.${_template}:${_subst}}
+. endfor
. endif
. for _subst in
S,<account>,${_account},g:S,<project>,${_project},g:S,<id>,${_id},g:S,<subdir>,${_subdir},g:S,<site>,${SITES.${_template}},g
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/jj-gh/Makefile,v
diff -u -p -r1.1.1.1 Makefile
--- Makefile 14 Aug 2026 11:12:52 -0000 1.1.1.1
+++ Makefile 3 Oct 2026 21:45:47 -0000
@@ -6,6 +6,7 @@ COMMENT = jj tools for working with Git
V = 0.2.10
DIST_TUPLE = github mrjones2014 jj-gh jj-gh-v$V .
PKGNAME = jj-gh-$V
+REVISION = 0
CATEGORIES = devel
@@ -23,6 +24,8 @@ CONFIGURE_STYLE = cargo
SEPARATE_BUILD = Yes
RUN_DEPENDS = devel/jujutsu
+
+WRKDIST = ${WRKDIR}/${DISTNAME}
JJGH = ${MODCARGO_TARGET_DIR}/release/jj-gh
post-build:
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/nim/Makefile,v
diff -u -p -r1.28 Makefile
--- Makefile 17 Sep 2026 17:31:35 -0000 1.28
+++ Makefile 3 Oct 2026 21:45:26 -0000
@@ -4,7 +4,7 @@ COMMENT = statically typed systems prog
DISTNAME = nim-2.2.10
EXTRACT_SUFX = .tar.xz
-REVISION = 0
+REVISION = 1
CATEGORIES = lang
@@ -45,6 +45,8 @@ TEST_DEPENDS = archivers/7zip,-main \
devel/pcre \
lang/node \
multimedia/sfml
+
+WRKDIST = ${WRKDIR}/${DISTNAME}
SUBST_VARS += CFLAGS