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.

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
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}
@@ -1289,7 +1290,8 @@ _warn_checksum += ;echo ">>> MASTER_SITE
 EXTRACT_SUFX ?= .tar.gz
 
 .if !empty(GH_COMMIT)
-DISTFILES ?= 
${DISTNAME}-${GH_COMMIT:C/(........).*/\1/}${EXTRACT_SUFX}{${GH_COMMIT}${EXTRACT_SUFX}}
+GH_DISTFILE = 
${DISTNAME}-${GH_COMMIT:C/(........).*/\1/}${EXTRACT_SUFX}{${GH_COMMIT}${EXTRACT_SUFX}}
+DISTFILES ?= ${GH_DISTFILE}
 .else
 .  if defined(DISTNAME)
 DISTFILES ?= ${DISTNAME}${EXTRACT_SUFX}

Reply via email to