So with the new DIST stuff, portroach is going to be even more lost than
usual.
I propose we try something like the following patch.
What this does:
if ROACH_URL isn't manually defined, bsd.port.mk will try its best to give it
a default value.
Namely:
- grab the first DISTFILES
- if there is none grab the first DISTFILES*
(note that if several DISTFILES.* variables are defined, this could take
any one of them, to hilariously bad result)
- use the same conversion rules as the rest of bsd.port.mk to deduce the
correct url and put it into ROACH_URL
Afterwards, while looking through DISTFILES*, set up ROACH_SITES when
we find our url.
(and finally, yield a fatal error if we didn't find our url)
Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1615
diff -u -p -r1.1615 bsd.port.mk
--- bsd.port.mk 6 Sep 2023 15:01:45 -0000 1.1615
+++ bsd.port.mk 6 Sep 2023 15:42:09 -0000
@@ -1349,6 +1349,24 @@ _CACHE_VARIABLES += DISTFILES
. endif
.endif
+.if !defined(ROACH_URL)
+. for d in ${DISTFILES}
+_ROACH_DISTFILE ?= $d
+. endfor
+.endif
+.if !defined(ROACH_URL)
+. for w in ${_CACHE_VARIABLES:MDISTFILES*}
+. for d in ${$w}
+_ROACH_DISTFILE ?= $d
+. endfor
+. endfor
+.endif
+
+.if defined(_ROACH_DISTFILE)
+. for u in ${_ROACH_DISTFILE:C/:[0-9]$//:C/^.*\{(.*)\}(.*)$/\1\2/}
+ROACH_URL = $u
+. endfor
+.endif
_ALL_DISTFILES_VARIABLES =
@@ -1380,6 +1398,9 @@ _warn_distfiles += ${e:M*\:[0-9]}
. if !defined($m)
ERRORS += "Fatal: $m is not defined but referenced by $e in $v"
. endif
+. if "${u}" == "${ROACH_URL}"
+ROACH_SITES = ${$m}
+. endif
. if empty(_FILES:M$f)
_FILES += $f
. if empty(DIST_SUBDIR)
@@ -1416,6 +1437,9 @@ EXTRACT_ONLY = ${ALL_DISTFILES}
ERRORS += "Fatal: EXTRACT_ONLY file $f not part of DISTFILES*"
. endif
. endfor
+.endif
+.if defined(ROACH_URL) && !defined(ROACH_SITES)
+ERRORS += "Fatal: where should portroach look for ${ROACH_URL}"
.endif
PATCH_CASES ?=