build: add a GITBASE option to pass through, clone if necessary

This makes "make update" update all and clone if necessary, this
will hopefully help people running into out-of-sync issues between
repositories.
This commit is contained in:
Franco Fichtner 2017-07-16 04:57:23 +02:00
parent 2b93218c0c
commit 0d8d31308a
3 changed files with 18 additions and 2 deletions

View File

@ -63,6 +63,7 @@ ADDITIONS?= #os-vmware
DEVICE?= a10
SPEED?= 115200
UEFI?= yes
GITBASE?= https://github.com/opnsense
MIRRORS?= https://opnsense.c0urier.net \
http://mirrors.nycbug.org/pub/opnsense \
http://mirror.wdc1.us.leaseweb.net/opnsense \
@ -126,5 +127,5 @@ ${STEP}: lint
-b ${SRCBRANCH} -B ${PORTSBRANCH} -e ${PLUGINSBRANCH} \
-g ${TOOLSBRANCH} -E ${COREBRANCH} -G ${PORTSREFBRANCH} \
-H "${COREENV}" -Q "${QUICK}" -u "${UEFI:tl}" -U "${SUFFIX}" \
-V "${ADDITIONS}" ${${STEP}_ARGS}
-V "${ADDITIONS}" -O "${GITBASE}" ${${STEP}_ARGS}
.endfor

View File

@ -28,7 +28,7 @@
set -e
OPTS="a:B:b:C:c:d:E:e:F:f:G:g:H:K:k:L:l:m:n:o:P:p:Q:R:S:s:T:t:U:u:v:V:"
OPTS="a:B:b:C:c:d:E:e:F:f:G:g:H:K:k:L:l:m:n:O:o:P:p:Q:R:S:s:T:t:U:u:v:V:"
while getopts ${OPTS} OPT; do
case ${OPT} in
@ -99,6 +99,8 @@ while getopts ${OPTS} OPT; do
n)
export PRODUCT_NAME=${OPTARG}
;;
O) export PRODUCT_GITBASE=${OPTARG}
;;
o)
if [ -n "${OPTARG}" ]; then
export STAGEDIRPREFIX=${OPTARG}
@ -169,6 +171,7 @@ if [ -z "${PRODUCT_NAME}" -o \
-z "${PRODUCT_DEVICE}" -o \
-z "${PRODUCT_SPEED}" -o \
-z "${PRODUCT_KERNEL}" -o \
-z "${PRODUCT_GITBASE}" -o \
-z "${PLUGINSBRANCH}" -o \
-z "${PLUGINSDIR}" -o \
-z "${PORTSBRANCH}" -o \
@ -240,6 +243,17 @@ git_fetch()
git -C ${1} fetch --all --prune
}
git_clone()
{
if [ -d "${1}" ]; then
return
fi
echo ">>> Cloning ${1}:"
git clone "${PRODUCT_GITBASE}/$(basename ${1})" ${1}
}
git_pull()
{
echo ">>> Pulling branch ${2} of ${1}:"

View File

@ -69,6 +69,7 @@ for ARG in ${ARGS}; do
;;
esac
git_clone ${DIR}
git_fetch ${DIR}
for BRANCH in ${BRANCHES}; do
git_pull ${DIR} ${BRANCH}