Index | Thread | Search

From:
Fabien Romano <fabienromano@gmail.com>
Subject:
Re: misc/portroach, attempt to support DIST_TUPLE
To:
Thomas Frohwein <tfrohwein@fastmail.com>, ports@openbsd.org, jasper@openbsd.org, Theo Buehler <tb@theobuehler.org>, Antoine Jacoutot <ajacoutot@openbsd.org>
Date:
Wed, 23 Sep 2026 07:46:46 +0100

Download raw body.

Thread
In my WIP, I fix the site from 'portroach build'
If some people are interested in a new portroach,
I guess I will have something I'm ok with in a few months.

The fix may look like this one.
https://github.com/fabienr/portroach/commit/91167d4e14ba6f1be3be092a057fa837523d0ead

Anyway, we need a fix in ports because some mix DIST_TUPLES and SITES.*
If I remember correctly, DIST_TUPLES works because the SITES.* get selected.
But if a port uses both DIST_TUPLES and SITES.* then the SITE could be wrong.
I gave a quick look on /usr/ports/infrastructure/mk/bsd.port.mk

.if !defined(ROACH_URL)
.  for d in ${DISTFILES}
_ROACH_DISTFILE ?= $d
.  endfor
.endif
.if !defined(ROACH_URL)
.  for w in ${.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

Which means we select DISTFILES (SITES) first.
Otherwise we check all the DISTFILES.* and take the first one.
I guess this depends on the order of declaration (or variable name ?).
DIST_TUPLES comes late, so it happens ROACH_URL isn't correct.
This is an issue I went into; I just don't have an example at hand.

I propose to promote the first DIST_TUPLE seen as the main SITES.
Note, I didn't finish testing (bulk / dpb).
diff at the end.

On 9/22/26 01:06, Andrew Hewus Fresh wrote:
> On Mon, Sep 21, 2026 at 02:25:56PM -0700, Thomas Frohwein wrote:
>> On Thu, 6 Jun 2024 18:16:54 +0100
>> Fabien ROMANO <fabienromano@gmail.com> wrote:
>>
>>> As example I took archivers/blosc2 (GH_*) & archives/zpaqfranz
>>> (DIST_TUPLE). Main difference are mastersites & distfiles from
>>> portroach.db :
>>>
>>> archivers/blosc2 =
>>> https://github.com/Blosc/c-blosc2/archive/refs/tags/v2.14.3/ +
>>> c-blosc2-2.14.3.tar.gz archives/zpaqfranz = https://github.com/ +
>>> fcorbelli/zpaqfranz/archive/refs/tags/59.5.tar.gz
>>>
>>> Portroach use the first one (mastersites) which does not contain
>>> project/name on DIST_TUPLE. If we append distfiles to mastersites
>>> before GetFiles then SiteHandler can find new version of zpaqfranz.
>>> For me it's not clear yet if this should be changed somewhere
>>> downside (mk implementation, sqlports, portroach build).
>>
>> Based on some conversations in hackroom, I'd like to revisit this diff
>> from Fabien. It seems the back and forth between DIST_TUPLE=github...
>> and GH_* variables is whiplash-inducing, and the only reason that GH_*
>> has been seeing more adoption again is portroach.
>>
>> Can someone more knowledgeable about portroach give an opinion on this,
>> or advise how to test that the output is valid?
>>
>> Slightly adjusted diff (REVISION to 9 now) below.
> 
> I am very not knowledgeable about portroach, not even sure how to
> actually test it.  However, looking at the example ROACH_SITES/ROACH_URL
> in the example zpaqfranz port, I think this bodge should work.
> 
> It seems like we should be building `$site` with:
> 
> $site = URI->new($ROACH_URL)->abs($ROACH_SITES);
> 
> which, afaict, would do what is desired here.
> 
> $ perl -MURI -E 'say URI->new(`make show=ROACH_URL`)->abs(`make show=ROACH_SITES`)'
> https://github.com/fcorbelli/zpaqfranz/archive/refs/tags/64.8.tar.gz
> 
> I didn't look at where we get `$site` in this context though.
> 
>  
>>
>>>
>>> I checked quickly how SiteHandler use url and, except Mozilla.pm (but
>>> does it match any port ?), including distfile into url should not be
>>> a problem. But to be safe, I choose to implement a fallback, first
>>> try with only mastersite and if GetFiles failed then try harder with
>>> distfiles.
>>>
>>> I do not run portroach in prod and I just discovered it (& perl),
>>> this diff was only lightly tested on this small example. I will
>>> experiment further but maybe this small diff is enough, sry if I
>>> screw up something.
>>>
>>> [zpaqfranz                     ] VersionCheck()
>>> [zpaqfranz                     ] Checking site: https://github.com/
>>> [zpaqfranz                     ] [https://github.com/           ]
>>> Using dedicated site handler for site. [zpaqfranz
>>> ] [https://github.com/           ] UPDATE 59.5 -> 59.7 [zpaqfranz
>>>                 ] Done [blosc2                        ] VersionCheck()
>>> [blosc2                        ] Checking site:
>>> https://github.com/Blosc/c-blosc2/archive/refs/tags/v2.14.3/ [blosc2
>>>                       ] [https://gith...s/tags/v2.14.3/] Using
>>> dedicated site handler for site. [blosc2                        ]
>>> [https://gith...s/tags/v2.14.3/] UPDATE 2.14.3 -> 2.14.4 [blosc2
>>>                   ] Done
>>>
>>>

-- 
Fabien Romano

Index: dist-tuple.port.mk
===================================================================
RCS file: /mnt/ext/cvs/ports/infrastructure/mk/dist-tuple.port.mk,v
diff -u -p -r1.22 dist-tuple.port.mk
--- dist-tuple.port.mk	1 Apr 2026 15:14:57 -0000	1.22
+++ dist-tuple.port.mk	22 Sep 2026 17:06:47 -0000
@@ -37,10 +37,17 @@ _DT_WRKDIST ?= ${WRKDIR}/${_project:C,^.

 .    for _subst in
S,<account>,${_account},g:S,<project>,${_project},g:S,<id>,${_id},g:S,<subdir>,${_subdir},g:S,<site>,${SITES.${_template}},g

-DISTFILES.${_template} +=		${TEMPLATE_DISTFILES.${_template}:${_subst}}
 EXTRACT_SUFX.${_template} ?=		${TEMPLATE_EXTRACT_SUFX}
 TEMPLATE_HOMEPAGE.${_template} ?=	${TEMPLATE_HOMEPAGE}
 HOMEPAGE ?=	${TEMPLATE_HOMEPAGE.${_template}:${_subst}}
+
+.      if !defined(SITES) && empty(GH_ACCOUNT) && empty(GH_PROJECT)
+SITES =		${SITES.${_template}}
+DISTFILES =	${TEMPLATE_DISTFILES.${_template}:${_subst}}
+EXTRACT_SUFX =	${EXTRACT_SUFX.${_template}}
+.      else
+DISTFILES.${_template} += ${TEMPLATE_DISTFILES.${_template}:${_subst}}
+.      endif

 .      if "${_targetdir}" != "." && "${_template}" == "codeberg"
 MODDIST-TUPLE_post-extract += \