diff options
author | tnn <tnn@pkgsrc.org> | 2015-03-07 21:14:32 +0000 |
---|---|---|
committer | tnn <tnn@pkgsrc.org> | 2015-03-07 21:14:32 +0000 |
commit | 81fcba18057452d58defaf207bfe816a44067012 (patch) | |
tree | d18fff182a5a12ae373c933b891f03d5ed58e40d /mk/fetch/github.mk | |
parent | bf6508dc403f19fcb5e7c6d4ddca56c34e08e0b0 (diff) | |
download | pkgsrc-81fcba18057452d58defaf207bfe816a44067012.tar.gz |
Address issues raised by agc@ to make the github master site handling
more pkgsrcesque.
1) turn _USE_GITHUB into an internal infrastructure variable
2) put back MASTER_SITES in packages' Makefiles.
3) encode the account in the master site URL, remove GH_ACCOUNT
4) rename GH_PROJECT to GITHUB_PROJECT
5) rename GH_TAGNAME to GITHUB_TAG and allow it to accept commit hash
as well as tag. GH_COMMIT is gone.
6) turn on this functionality when MASTER_SITES matches a predefined github
pattern instead of via explicit USE_GITHUB setting.
Diffstat (limited to 'mk/fetch/github.mk')
-rw-r--r-- | mk/fetch/github.mk | 85 |
1 files changed, 42 insertions, 43 deletions
diff --git a/mk/fetch/github.mk b/mk/fetch/github.mk index 83f7ce71fb3..7a66c39e0d4 100644 --- a/mk/fetch/github.mk +++ b/mk/fetch/github.mk @@ -1,69 +1,68 @@ -# $NetBSD: github.mk,v 1.4 2015/03/07 16:54:28 tnn Exp $ +# $NetBSD: github.mk,v 1.5 2015/03/07 21:14:32 tnn Exp $ # # github.com master site handling # # To use, set in Makefile: # # DISTNAME= exampleproject-1.2 -# USE_GITHUB= YES +# MASTER_SITES= ${MASTER_SITE_GITHUB:=accountname/} # -# The following variables alter USE_GITHUB behavior: +# The following variables alter github.mk behavior: # -# GH_ACCOUNT defaults to PKGBASE -# GH_PROJECT defaults to PKGBASE -# GH_TAGNAME defaults to PKGVERSION_NOREV -# (sometimes you want to override with v${PKGVERSION_NOREV}) -# GH_COMMIT explicit commit hash if no tag is available -# GH_RELEASE default empty, may be set to ${DISTNAME} for example -# GH_TYPE overrides the autodetected MASTER_SITE URL scheme: +# GITHUB_PROJECT defaults to PKGBASE +# GITHUB_TAG defaults to PKGVERSION_NOREV +# sometimes you want to override with v${PKGVERSION_NOREV} +# SHA-1 commit ids are also acceptable +# GITHUB_RELEASE defaults to not defined, set this to ${DISTNAME} +# when packaging a release not based on a git tag. +# GITHUB_TYPE overrides the autodetected MASTER_SITE URL scheme: # # "tag" -# This is the default when GH_TAGNAME is set or no type was specified. Exampe URL: -# http://github.com/acct/proj/archive/{GH_TAGNAME}.tar.gz +# This is the default when GITHUB_RELEASE is not defined. Example URL: +# http://github.com/acct/${GITHUB_PROJECT}/archive/{GITHUB_TAG}.tar.gz # # "release" -# This is the default when GH_RELEASE is set. Example URL: -# http://github.com/acct/proj/releases/download/${GH_RELEASE}/${DISTNAME}.tar.gz -# -# "commit" -# This is the default when GH_COMMIT is set. Example URL: -# http://github.com/acct/proj/archive/${GH_COMMIT}.tar.gz +# This is the default when GITHUB_RELEASE is set. Example URL: +# http://github.com/acct/${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/${DISTNAME}.tar.gz # # Keywords: github -.if defined(USE_GITHUB) && !empty(USE_GITHUB:M[yY][eE][sS]) +# xxx move this to sites.mk +MASTER_SITE_GITHUB?= https://github.com/ + +.if defined(MASTER_SITES) && !empty(MASTER_SITES:C,^https\://github.com/[a-zA-Z0-9]*/$,match,:Mmatch) +_USE_GITHUB= YES +.endif + +.if (defined(GITHUB_TAG) || defined(GITHUB_RELEASE)) && !defined(_USE_GITHUB) +PKG_FAIL_REASON+= "MASTER_SITES must match https://github.com/account/" \ + "when GITHUB_TAG or GITHUB_RELEASE is in use." \ + "For more information: make help topic=github" +.endif -# maybe move this to sites.mk -MASTER_SITE_GITHUB?= https://github.com/ +.if defined(_USE_GITHUB) && !empty(_USE_GITHUB:M[yY][eE][sS]) -GH_ACCOUNT?= ${PKGBASE} -GH_PROJECT?= ${PKGBASE} -GH_TAGNAME?= ${PKGVERSION_NOREV} +GITHUB_PROJECT?= ${PKGBASE} +GITHUB_TAG?= ${PKGVERSION_NOREV} -. if !empty(GH_TAGNAME:Mmaster) -PKG_FAIL_REASON+= "master is not a valid tag name, use an explicit commit hash (hint: set GH_COMMIT)" +. if !empty(GITHUB_TAG:Mmaster) +PKG_FAIL_REASON+= "master is not a valid tag name, use an explicit commit hash" . endif -. if !defined(GH_TYPE) -. if defined(GH_COMMIT) && !empty(GH_COMMIT:M*) -GH_TYPE= commit -. elif defined(GH_RELEASE) && !empty(GH_RELEASE:M*) -GH_TYPE= release -. else -GH_TYPE= tag +. if !defined(GITHUB_TYPE) +. if defined(GITHUB_RELEASE) && !empty(GITHUB_RELEASE) +GITHUB_TYPE= release +. else +GITHUB_TYPE= tag . endif . endif -.if !empty(GH_TYPE:Mrelease) -MASTER_SITES?= ${MASTER_SITE_GITHUB}${GH_ACCOUNT}/${GH_PROJECT}/releases/download/${GH_RELEASE}/ -.endif - -.if !empty(GH_TYPE:Mcommit) -MASTER_SITES?= -${MASTER_SITE_GITHUB}${GH_ACCOUNT}/${GH_PROJECT}/archive/${GH_COMMIT}${EXTRACT_SUFX} -.endif +. if !empty(GITHUB_TYPE:Mrelease) +MASTER_SITES:= ${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/} +. endif -.if !empty(GH_TYPE:Mtag) -MASTER_SITES?= -${MASTER_SITE_GITHUB}${GH_ACCOUNT}/${GH_PROJECT}/archive/${GH_TAGNAME}${EXTRACT_SUFX} -.endif +. if !empty(GITHUB_TYPE:Mtag) +MASTER_SITES:= -${MASTER_SITES:=${GITHUB_PROJECT}/archive/${GITHUB_TAG}${EXTRACT_SUFX}} +. endif .endif |