Annotation of pkgsrc/mk/fetch/github.mk, revision 1.5
1.5 ! tnn 1: # $NetBSD: github.mk,v 1.4 2015/03/07 16:54:28 tnn Exp $
1.1 tnn 2: #
3: # github.com master site handling
4: #
5: # To use, set in Makefile:
6: #
7: # DISTNAME= exampleproject-1.2
1.5 ! tnn 8: # MASTER_SITES= ${MASTER_SITE_GITHUB:=accountname/}
1.1 tnn 9: #
1.5 ! tnn 10: # The following variables alter github.mk behavior:
1.1 tnn 11: #
1.5 ! tnn 12: # GITHUB_PROJECT defaults to PKGBASE
! 13: # GITHUB_TAG defaults to PKGVERSION_NOREV
! 14: # sometimes you want to override with v${PKGVERSION_NOREV}
! 15: # SHA-1 commit ids are also acceptable
! 16: # GITHUB_RELEASE defaults to not defined, set this to ${DISTNAME}
! 17: # when packaging a release not based on a git tag.
! 18: # GITHUB_TYPE overrides the autodetected MASTER_SITE URL scheme:
1.1 tnn 19: #
20: # "tag"
1.5 ! tnn 21: # This is the default when GITHUB_RELEASE is not defined. Example URL:
! 22: # http://github.com/acct/${GITHUB_PROJECT}/archive/{GITHUB_TAG}.tar.gz
1.1 tnn 23: #
24: # "release"
1.5 ! tnn 25: # This is the default when GITHUB_RELEASE is set. Example URL:
! 26: # http://github.com/acct/${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/${DISTNAME}.tar.gz
1.2 tnn 27: #
28: # Keywords: github
1.1 tnn 29:
1.5 ! tnn 30: # xxx move this to sites.mk
! 31: MASTER_SITE_GITHUB?= https://github.com/
! 32:
! 33: .if defined(MASTER_SITES) && !empty(MASTER_SITES:C,^https\://github.com/[a-zA-Z0-9]*/$,match,:Mmatch)
! 34: _USE_GITHUB= YES
! 35: .endif
! 36:
! 37: .if (defined(GITHUB_TAG) || defined(GITHUB_RELEASE)) && !defined(_USE_GITHUB)
! 38: PKG_FAIL_REASON+= "MASTER_SITES must match https://github.com/account/" \
! 39: "when GITHUB_TAG or GITHUB_RELEASE is in use." \
! 40: "For more information: make help topic=github"
! 41: .endif
1.1 tnn 42:
1.5 ! tnn 43: .if defined(_USE_GITHUB) && !empty(_USE_GITHUB:M[yY][eE][sS])
1.1 tnn 44:
1.5 ! tnn 45: GITHUB_PROJECT?= ${PKGBASE}
! 46: GITHUB_TAG?= ${PKGVERSION_NOREV}
1.1 tnn 47:
1.5 ! tnn 48: . if !empty(GITHUB_TAG:Mmaster)
! 49: PKG_FAIL_REASON+= "master is not a valid tag name, use an explicit commit hash"
1.1 tnn 50: . endif
51:
1.5 ! tnn 52: . if !defined(GITHUB_TYPE)
! 53: . if defined(GITHUB_RELEASE) && !empty(GITHUB_RELEASE)
! 54: GITHUB_TYPE= release
! 55: . else
! 56: GITHUB_TYPE= tag
1.1 tnn 57: . endif
58: . endif
59:
1.5 ! tnn 60: . if !empty(GITHUB_TYPE:Mrelease)
! 61: MASTER_SITES:= ${MASTER_SITES:=${GITHUB_PROJECT}/releases/download/${GITHUB_RELEASE}/}
! 62: . endif
1.1 tnn 63:
1.5 ! tnn 64: . if !empty(GITHUB_TYPE:Mtag)
! 65: MASTER_SITES:= -${MASTER_SITES:=${GITHUB_PROJECT}/archive/${GITHUB_TAG}${EXTRACT_SUFX}}
! 66: . endif
1.1 tnn 67:
68: .endif
CVSweb <webmaster@jp.NetBSD.org>