Fri May 12 20:09:09 2023 UTC ()
mk/fetch/github.mk: reject "main" as well as "master", and clarify

PR 57062 from Andrew Cagney


(dholland)
diff -r1.15 -r1.16 pkgsrc/mk/fetch/github.mk

cvs diff -r1.15 -r1.16 pkgsrc/mk/fetch/github.mk (expand / switch to unified diff)

--- pkgsrc/mk/fetch/github.mk 2021/04/10 09:03:13 1.15
+++ pkgsrc/mk/fetch/github.mk 2023/05/12 20:09:09 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: github.mk,v 1.15 2021/04/10 09:03:13 nia Exp $ 1# $NetBSD: github.mk,v 1.16 2023/05/12 20:09:09 dholland Exp $
2# 2#
3# github.com master site handling 3# github.com master site handling
4# 4#
5# To use, set in Makefile: 5# To use, set in Makefile:
6# 6#
7# DISTNAME= exampleproject-1.2 7# DISTNAME= exampleproject-1.2
8# MASTER_SITES= ${MASTER_SITE_GITHUB:=accountname/} 8# MASTER_SITES= ${MASTER_SITE_GITHUB:=accountname/}
9# 9#
10# The following variables alter github.mk behavior: 10# The following variables alter github.mk behavior:
11# 11#
12# GITHUB_PROJECT defaults to PKGBASE 12# GITHUB_PROJECT defaults to PKGBASE
13# GITHUB_TAG defaults to PKGVERSION_NOREV 13# GITHUB_TAG defaults to PKGVERSION_NOREV
14# sometimes you want to override with v${PKGVERSION_NOREV} 14# sometimes you want to override with v${PKGVERSION_NOREV}
@@ -35,28 +35,28 @@ _USE_GITHUB= YES @@ -35,28 +35,28 @@ _USE_GITHUB= YES
35.endif 35.endif
36 36
37.if (defined(GITHUB_TAG) || defined(GITHUB_RELEASE)) && !defined(_USE_GITHUB) 37.if (defined(GITHUB_TAG) || defined(GITHUB_RELEASE)) && !defined(_USE_GITHUB)
38PKG_FAIL_REASON+= "MASTER_SITES must match https://github.com/account/" \ 38PKG_FAIL_REASON+= "MASTER_SITES must match https://github.com/account/" \
39 "when GITHUB_TAG or GITHUB_RELEASE is in use." \ 39 "when GITHUB_TAG or GITHUB_RELEASE is in use." \
40 "For more information: make help topic=github" 40 "For more information: make help topic=github"
41.endif 41.endif
42 42
43.if defined(_USE_GITHUB) && !empty(_USE_GITHUB:M[yY][eE][sS]) 43.if defined(_USE_GITHUB) && !empty(_USE_GITHUB:M[yY][eE][sS])
44 44
45GITHUB_PROJECT?= ${PKGBASE} 45GITHUB_PROJECT?= ${PKGBASE}
46GITHUB_TAG?= ${PKGVERSION_NOREV} 46GITHUB_TAG?= ${PKGVERSION_NOREV}
47 47
48. if !empty(GITHUB_TAG:Mmaster) 48. if !empty(GITHUB_TAG:Mmaster) || !empty(GITHUB_TAG:Mmain)
49PKG_FAIL_REASON+= "master is not a valid tag name, use an explicit commit hash" 49PKG_FAIL_REASON+= "main (or master) is not a valid tag name; use an explicit commit hash or a tag, not a branch"
50. endif 50. endif
51 51
52. if !defined(GITHUB_TYPE) 52. if !defined(GITHUB_TYPE)
53. if defined(GITHUB_RELEASE) && !empty(GITHUB_RELEASE) 53. if defined(GITHUB_RELEASE) && !empty(GITHUB_RELEASE)
54GITHUB_TYPE= release 54GITHUB_TYPE= release
55. else 55. else
56GITHUB_TYPE= tag 56GITHUB_TYPE= tag
57. endif 57. endif
58. endif 58. endif
59 59
60. if !empty(GITHUB_TYPE:Mtag) && !empty(GITHUB_TAG:M[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*) 60. if !empty(GITHUB_TYPE:Mtag) && !empty(GITHUB_TAG:M[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*)
61# If the github tag is a git hash (7 or more hex digits), encode it in the 61# If the github tag is a git hash (7 or more hex digits), encode it in the
62# distfile name. 62# distfile name.