Changeset View
Changeset View
Standalone View
Standalone View
Mk/bsd.sites.mk
Context not available. | |||||
# 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 | ||||
Context not available. | |||||
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 | . 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-show-latest: | |||||
@${ECHO_MSG} "--begin latest revisions--"; \ | |||||
for tuple in ${GH_TUPLE}; do \ | |||||
oIFS="$$IFS"; IFS=":"; set -- $$tuple; IFS="$$oIFS"; \ | |||||
account=$$1; shift; project=$$1; shift; tagname=$$1; shift; \ | |||||
other=`echo "$$@" | ${SED} -e 's/ /:/g'`; \ | |||||
[ -n "$$other" ] && other=":$$other"; \ | |||||
rev=`git ls-remote https://github.com/$${account}/$${project}.git HEAD | ${SED} -E "s/^(.......).*/\\1/g"`; \ | |||||
echo "GH_TUPLE+= $$account:$$project:$$rev$$other"; \ | |||||
done; \ | |||||
${ECHO_MSG} "--end latest revisions--" | |||||
gh-show-changed: | |||||
@${ECHO_MSG} "--begin changed revisions--"; \ | |||||
for tuple in ${GH_TUPLE}; do \ | |||||
oIFS="$$IFS"; IFS=":"; set -- $$tuple; IFS="$$oIFS"; \ | |||||
account=$$1; shift; project=$$1; shift; tagname=$$1; shift; \ | |||||
other=`echo "$$@" | ${SED} -e 's/ /:/g'`; \ | |||||
[ -n "$$other" ] && other=":$$other"; \ | |||||
rev=`git ls-remote https://github.com/$${account}/$${project}.git HEAD | ${SED} -E "s/^(.......).*/\\1/g"`; \ | |||||
[ $$tagname != "$$rev" ] && \ | |||||
echo "GH_TUPLE+= $$account:$$project:$$rev$$other"; \ | |||||
done; \ | |||||
${ECHO_MSG} "--end changed revisions--" | |||||
gh-update: | |||||
@${ECHO_MSG} "--begin updating revisions--"; \ | |||||
cnt_updated=0; \ | |||||
cnt_rejected=0; \ | |||||
for tuple in ${GH_TUPLE}; do \ | |||||
oIFS="$$IFS"; IFS=":"; set -- $$tuple; IFS="$$oIFS"; \ | |||||
account=$$1; shift; project=$$1; shift; tagname=$$1; shift; \ | |||||
other=`echo "$$@" | ${SED} -e 's/ /:/g'`; \ | |||||
[ -n "$$other" ] && other=":$$other"; \ | |||||
rev=`git ls-remote https://github.com/$${account}/$${project}.git HEAD | ${SED} -E "s/^(.......).*/\\1/g"`; \ | |||||
[ $$tagname != "$$rev" ] && \ | |||||
(([ -f Makefile.orig ] && ${DIFF} Makefile Makefile.orig > /dev/null) || ${CP} Makefile Makefile.orig) && \ | |||||
while true; do \ | |||||
answer=$$all; \ | |||||
if [ -z "$$answer" ]; then \ | |||||
read -p "Revision of $$account:$$project changed: $$tagname -> $$rev [(a)ccept, (r)eject, accept al(l), re(j)ect all, a(b)ort]? " answer; \ | |||||
fi; \ | |||||
case $$answer in \ | |||||
a) echo "updating $$account:$$project:$$tagname$$other -> $$account:$$project:$$rev$$other"; \ | |||||
${REINPLACE_CMD} -i '' -e "s/:$$tagname/:$$rev/" Makefile; \ | |||||
cnt_updated=$$((cnt_updated+1)); \ | |||||
break;; \ | |||||
r) echo "rejecting $$account:$$project:$$tagname$$other -> $$account:$$project:$$rev$$other"; \ | |||||
cnt_rejected=$$((cnt_rejected=+1)); \ | |||||
break;; \ | |||||
l) all=a; continue;; \ | |||||
j) all=r; continue;; \ | |||||
b) return;; \ | |||||
*) continue;; \ | |||||
esac; \ | |||||
done; \ | |||||
done; \ | |||||
${ECHO_MSG} "--end updating revisions: updated $$cnt_updated, rejected $$cnt_rejected--" | |||||
.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% | ||||
Context not available. |