On 2021/11/13 11:48, Klemens Nanni wrote: > On Sat, Nov 13, 2021 at 11:31:57AM +0000, Stuart Henderson wrote: > > We have a few ports that use GH_* and have a second distfile, so have to > > build up their own DISTFILES. Where that uses GH_TAGNAME it's not too bad > > but the ones with GH_COMMIT are a bit horrible: > > > > $ ag -G Makef ^DISTF.*GH_COMMIT > > devel/cabal-bundler/Makefile > > 13:DISTFILES = > > ${DISTNAME}-${GH_COMMIT:C/(........).*/\1/}${EXTRACT_SUFX}{${GH_COMMIT}${EXTRACT_SUFX}} > > \ > > > > devel/msbuild/Makefile > > 29:DISTFILES = ${DISTNAME}{${GH_COMMIT}}${EXTRACT_SUFX} \ > > > > net/arp-scan/Makefile > > 22:DISTFILES = > > ${DISTNAME}-${GH_COMMIT:C/(........).*/\1/}${EXTRACT_SUFX}{${GH_COMMIT}${EXTRACT_SUFX}} > > \ > > > > net/ntopng/Makefile > > 19:DISTFILES= ntopng-${NTOPNG_V}-{}${GH_COMMIT}.tar.gz > > ndpi-${NDPI_V}-{}${NDPI_COMMIT}.tar.gz:0 > > > > x11/gnome/gdm/Makefile > > 15:DISTFILES= > > ${DISTNAME}-${GH_COMMIT:C/(........).*/\1/}${EXTRACT_SUFX}{${GH_COMMIT}${EXTRACT_SUFX}} > > \ > > > > x11/mruby-zest/Makefile > > 45:DISTFILES= zyn-fusion-{}${GH_COMMIT}${EXTRACT_SUFX} \ > > > > Seems like it might be useful to provide the generated distfile name > > in a variable that can be reused here. I set it for ports using either > > GH_TAGNAME and GH_COMMIT so that it doesn't need modifying if we > > need to update something to an untagged checkout. > > I like the idea! > > > Any comments? OK? > > > > > > Index: src/share/man/man5/bsd.port.mk.5 > > =================================================================== > > RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v > > retrieving revision 1.546 > > diff -u -p -r1.546 bsd.port.mk.5 > > --- src/share/man/man5/bsd.port.mk.5 8 Oct 2021 13:52:28 -0000 > > 1.546 > > +++ src/share/man/man5/bsd.port.mk.5 13 Nov 2021 11:27:24 -0000 > > @@ -1925,6 +1925,12 @@ Account name of the GitHub user hosting > > .It Ev GH_COMMIT > > SHA1 commit id to fetch. > > It is an error to specify ${GH_COMMIT} when ${GH_TAGNAME} is specified. > > +.It Ev GH_DISTFILE > > +Set by > > +.Nm > > +to the generated name of the distribution file. > > +This can be useful for ports listing multiple > > +.Ev DISTFILES . > > .It Ev GH_PROJECT > > Name of the project on GitHub. > > .It Ev GH_TAGNAME > > OK kn
Thanks. > > Index: ports/infrastructure/mk/bsd.port.mk > > =================================================================== > > RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v > > retrieving revision 1.1558 > > diff -u -p -r1.1558 bsd.port.mk > > --- ports/infrastructure/mk/bsd.port.mk 8 Nov 2021 13:36:25 -0000 > > 1.1558 > > +++ ports/infrastructure/mk/bsd.port.mk 13 Nov 2021 11:27:24 -0000 > > @@ -612,6 +612,7 @@ GH_PROJECT ?= > > > > .if !empty(GH_PROJECT) && !empty(GH_TAGNAME) > > DISTNAME ?= > > ${GH_PROJECT}-${GH_TAGNAME:C/^(v|V|ver|[Rr]el|[Rr]elease)[-._]?([0-9])/\2/} > > +GH_DISTFILE = > > ${GH_PROJECT}-${GH_TAGNAME:C/^(v|V|ver|[Rr]el|[Rr]elease)[-._]?([0-9])/\2/}${EXTRACT_SUFX} > > .endif > > > > PKGNAME ?= ${DISTNAME} > > You're not using GH_DISTFILE for ports using GH_TAGNAME, is that > intentional? > > With your diff, picking a random GH_TAGNAME por: > > $ make -C /usr/ports/security/hydra -p | egrep > '^(DIST(FILES|NAME)|GH_DISTFILE)' > DISTFILES = ${DISTNAME}${EXTRACT_SUFX} > DISTNAME = > ${GH_PROJECT}-${GH_TAGNAME:C/^(v|V|ver|[Rr]el|[Rr]elease)[-._]?([0-9])/\2/} > GH_DISTFILE = > ${GH_PROJECT}-${GH_TAGNAME:C/^(v|V|ver|[Rr]el|[Rr]elease)[-._]?([0-9])/\2/}${EXTRACT_SUFX} I think I see what you mean. GH_TAGNAME doesn't normally set DISTFILES directly, only DISTNAME (which normal ports infrastructure turns into DISTFILES by adding EXTRACT_SUFX). So using GH_DISTFILE to build up that name doesn't work (unless we strip off EXTRACT_SUFX but that doesn't make sense to me). Whereas with GH_COMMIT, DISTNAME isn't automatically set at all, it is up to the port to do so. Originally I only had this set when you use GH_COMMIT not GH_TAGNAME, on the basis that it's easy to get the distfile name for a GH_TAGNAME port anyway. But then I wanted to test an update of librenms from a commit hash rather than the usual tag, and realised it would reduce churn in a port Makefile if it could cope with changing between the two. So in a nutshell (assuming I understand the question correctly): yes it's intended.