build/rewind: finish tag matching, add experimental rewind target; closes #71
For now this goes undocumented. The trouble with rewind is: 1. To rewind we need to reset all repositories. That only really works on top of the current branch. Possible solution: only allow rewind for the currently up-to-date version. 2. The master branch development version is in the way and will probably prevent people from building older versions because of this or that mismatch. Possible solution: allow a build without development packages included and maybe default to it.
This commit is contained in:
parent
fec4769c6b
commit
29c2abe2b0
4
Makefile
4
Makefile
|
@ -25,8 +25,8 @@
|
|||
|
||||
STEPS= arm base boot chroot clean compress confirm core distfiles \
|
||||
download dvd info kernel nano plugins ports prefetch print \
|
||||
rebase release rename serial sign skim test update upload \
|
||||
verify vga vm xtools
|
||||
rebase release rename rewind serial sign skim test update \
|
||||
upload verify vga vm xtools
|
||||
SCRIPTS= batch nightly refresh pkg_fingerprint pkg_sign
|
||||
.PHONY: ${STEPS}
|
||||
|
||||
|
|
|
@ -336,22 +336,48 @@ git_tag()
|
|||
{
|
||||
# Fuzzy-match a tag and return it for the caller.
|
||||
|
||||
POOL=$(git -C ${1} tag | grep ^${2}\$ || true)
|
||||
POOL=$(git -C ${1} tag | awk '$1 == "'"${2}"'"')
|
||||
if [ -z "${POOL}" ]; then
|
||||
VERSION=${2%.*}
|
||||
FUZZY=${2##${VERSION}.}
|
||||
MAX=0
|
||||
|
||||
for _POOL in $(git -C ${1} tag | grep ^${VERSION} | sort -r); do
|
||||
if [ "$(echo "${VERSION}" | \
|
||||
grep -c '[.]')" = "0" ]; then
|
||||
FUZZY=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${POOL}" -a -n "${FUZZY}" ]; then
|
||||
for _POOL in $(git -C ${1} tag | \
|
||||
awk 'index($1, "'"${VERSION}"'")'); do
|
||||
_POOL=${_POOL##${VERSION}}
|
||||
if [ -z "${_POOL}" ]; then
|
||||
POOL=${VERSION}${_POOL}
|
||||
break
|
||||
continue
|
||||
fi
|
||||
if [ ${_POOL##.} -lt ${FUZZY} ]; then
|
||||
POOL=${VERSION}${_POOL}
|
||||
break
|
||||
_POOL=${_POOL##.}
|
||||
if [ "$(echo "${_POOL}${FUZZY}" | \
|
||||
grep -c '[a-z.]')" != "0" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ ${_POOL} -lt ${FUZZY} -a \
|
||||
${_POOL} -gt ${MAX} ]; then
|
||||
MAX=${_POOL}
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${MAX} -gt 0 ]; then
|
||||
POOL=${VERSION}.${MAX}
|
||||
else
|
||||
POOL=${VERSION}
|
||||
fi
|
||||
|
||||
# make sure there is no garbage match
|
||||
POOL_TEST=$(git -C ${1} tag | awk '$1 == "'"${POOL}"'"')
|
||||
if [ "${POOL_TEST}" != "${POOL}" ]; then
|
||||
POOL=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${POOL}" ]; then
|
||||
|
@ -359,7 +385,7 @@ git_tag()
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo ">>> ${1} matches tag ${2} -> ${POOL}"
|
||||
echo ">>> ${1} matches tag ${POOL}"
|
||||
|
||||
export REPO_TAG=${POOL}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2018 Franco Fichtner <franco@opnsense.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
set -e
|
||||
|
||||
SELF=rewind
|
||||
|
||||
. ./common.sh
|
||||
|
||||
ARGS="src ports plugins core tools"
|
||||
|
||||
for ARG in ${ARGS}; do
|
||||
case ${ARG} in
|
||||
core)
|
||||
BRANCH=${COREBRANCH}
|
||||
DIR=${COREDIR}
|
||||
;;
|
||||
plugins)
|
||||
BRANCH=${PLUGINSBRANCH}
|
||||
DIR=${PLUGINSDIR}
|
||||
;;
|
||||
ports)
|
||||
BRANCH=${PORTSBRANCH}
|
||||
DIR=${PORTSDIR}
|
||||
;;
|
||||
src)
|
||||
BRANCH=${SRCBRANCH}
|
||||
DIR=${SRCDIR}
|
||||
;;
|
||||
tools)
|
||||
BRANCH=${TOOLSBRANCH}
|
||||
DIR=${TOOLSDIR}
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
git_tag ${DIR} ${PRODUCT_VERSION}
|
||||
continue; # XXX here be dragons
|
||||
git_pull ${DIR} ${BRANCH}
|
||||
git_reset ${DIR}
|
||||
done
|
Loading…
Reference in New Issue