Changeset View
Changeset View
Standalone View
Standalone View
Mk/bsd.sites.mk
Show First 20 Lines • Show All 513 Lines • ▼ Show 20 Lines | |||||
# | # | ||||
# GH_PROJECT - name of the project on GitHub | # GH_PROJECT - name of the project on GitHub | ||||
# default: ${PORTNAME} | # default: ${PORTNAME} | ||||
# | # | ||||
# GH_TAGNAME - name of the tag to download (2.0.1, hash, ...) | # GH_TAGNAME - name of the tag to download (2.0.1, hash, ...) | ||||
# Using the name of a branch here is incorrect. It is | # Using the name of a branch here is incorrect. It is | ||||
# possible to do GH_TAGNAME= GIT_HASH to do a snapshot. | # possible to do GH_TAGNAME= GIT_HASH to do a snapshot. | ||||
# default: ${DISTVERSION} | # default: ${DISTVERSION} | ||||
# GH_TUPLE - above shortened to account:project:tagname[:group] | |||||
# | # | ||||
.if defined(USE_GITHUB) | .if defined(USE_GITHUB) | ||||
. if defined(GH_TAGNAME) && ${GH_TAGNAME} == master | . if defined(GH_TAGNAME) && ${GH_TAGNAME} == master | ||||
IGNORE?= Using master as GH_TAGNAME is invalid. \ | IGNORE?= Using master as GH_TAGNAME is invalid. \ | ||||
Must use a tag or commit hash so the upstream does \ | Must use a tag or commit hash so the upstream does \ | ||||
not "reroll" as soon as the branch is updated | not "reroll" as soon as the branch is updated | ||||
. endif | |||||
. if defined(GH_TUPLE) | |||||
GH_ACCOUNT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\1\4@} | |||||
GH_PROJECT+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\2\4@} | |||||
GH_TAGNAME+= ${GH_TUPLE:C@^([^:]*):([^:]*):([^:]*)((:[^:]*)?)@\3\4@} | |||||
gh-get-latest-revisions: | |||||
@${ECHO_MSG} "--begin latest revisions--"; \ | |||||
for tuple in ${GH_TUPLE}; do \ | |||||
oIFS="$$IFS"; IFS=":"; set -- $$tuple; IFS="$$oIFS"; \ | |||||
[ -n "$$4" ] && group=":$$4"; \ | |||||
rev=`git ls-remote https://github.com/$$1/$$2.git HEAD | ${SED} -E "s/^(.......).*/\\1/g"`; \ | |||||
jbeich: Why not use GitHub API ? For example,
```lang=sh
$ git ls-remote https://github.com/rust… | |||||
echo "GH_TUPLE+= $$1:$$2:$$rev$$group"; \ | |||||
done; \ | |||||
${ECHO_MSG} "--end latest revisions--" | |||||
gh-get-changed-revisions: | |||||
@${ECHO_MSG} "--begin changed revisions--"; \ | |||||
for tuple in ${GH_TUPLE}; do \ | |||||
oIFS="$$IFS"; IFS=":"; set -- $$tuple; IFS="$$oIFS"; \ | |||||
[ -n "$$4" ] && group=":$$4"; \ | |||||
rev=`git ls-remote https://github.com/$$1/$$2.git HEAD | ${SED} -E "s/^(.......).*/\\1/g"`; \ | |||||
[ $$3 != "$$rev" ] && \ | |||||
jbeichUnsubmitted Not Done Inline ActionsWhy not combine the targets? gh-get-latest-revisions gh-get-changed-revisions: ... case ${.TARGET} in \ *changed*) \ [ $$3 != "$$rev" ] && \ ... jbeich: Why not combine the targets?
```lang=bsdmake
gh-get-latest-revisions gh-get-changed-revisions… | |||||
echo "GH_TUPLE+= $$1:$$2:$$rev$$group"; \ | |||||
done; \ | |||||
${ECHO_MSG} "--end changed revisions--" | |||||
. endif | . endif | ||||
# We are cheating and using backend URLS for Github here. See ports/194898 | # We are cheating and using backend URLS for Github here. See ports/194898 | ||||
# comment #15 for explanation as to why and how to deal with it if it breaks. | # comment #15 for explanation as to why and how to deal with it if it breaks. | ||||
MASTER_SITE_GITHUB+= https://codeload.github.com/%SUBDIR% | MASTER_SITE_GITHUB+= https://codeload.github.com/%SUBDIR% | ||||
MASTER_SITE_GITHUB_CLOUD+= https://cloud.github.com/downloads/%SUBDIR% | MASTER_SITE_GITHUB_CLOUD+= https://cloud.github.com/downloads/%SUBDIR% | ||||
. if !defined(MASTER_SITES) || !${MASTER_SITES:MGH} && !${MASTER_SITES:MGHC} && !${USE_GITHUB:Mnodefault} | . if !defined(MASTER_SITES) || !${MASTER_SITES:MGH} && !${MASTER_SITES:MGHC} && !${USE_GITHUB:Mnodefault} | ||||
MASTER_SITES+= GH | MASTER_SITES+= GH | ||||
▲ Show 20 Lines • Show All 952 Lines • Show Last 20 Lines |
Why not use GitHub API ? For example,
With tags it'd be slightly longer.