build.sh: Rework branch concept

We only build "stable" images now and push them first to the testing
branch and then to the stable branch. Thus, the versioning should always
be based on the newer of the two branches, stable and testing. A
paramter isn't needed anymore.

This closes #15 and #14.
This commit is contained in:
Jan-Philipp Litza 2016-02-11 22:36:54 +01:00
parent e7bbb54da7
commit 3509b3932f
1 changed files with 22 additions and 34 deletions

View File

@ -40,32 +40,26 @@ extract_local_version() {
echo "${local_version_tmp%~testing}" echo "${local_version_tmp%~testing}"
} }
if [ "$#" = 0 ]; then
cat <<USAGE
Usage: $(basename $0) [--debug] <branch>
This script takes the intended branch, "testing" or "stable", as the single
parameter. It then tries to autodetermine the correct release name, builds
gluon for the corresponding branch and all supported platforms (excluding
x86*), and optionally signs it if an ecdsutils keyfile is found (standard path:
~/.ecdsakey)
USAGE
exit 1
fi
debug= debug=
if [ "$1" = "--debug" ]; then if [ "$#" -gt 0 ]; then
debug=1 if [ "$1" = '-h' -o "$1" = '--help' ]; then
shift cat <<USAGE
fi Usage: $(basename $0) [--debug]
GLUON_BRANCH="$1" This script tries to autodetermine the correct release name, builds gluon for
all supported platforms (excluding x86*), and optionally signs it if an
if [ "$GLUON_BRANCH" != "testing" -a "$GLUON_BRANCH" != "stable" ]; then ecdsutils keyfile is found (standard path: ~/.ecdsakey)
echo "Branch not supported yet!" USAGE
exit 1 exit 1
fi
if [ "$1" = "--debug" ]; then
debug=1
shift
fi
fi fi
GLUON_BRANCH="stable"
GLUON_TAG="$(get_GLUON_TAG)" GLUON_TAG="$(get_GLUON_TAG)"
# remove prefixed "v" # remove prefixed "v"
GLUON_TAG="${GLUON_TAG#v}" GLUON_TAG="${GLUON_TAG#v}"
@ -94,22 +88,15 @@ if ! $cont; then
echo "Building Gluon ${GLUON_TAG} as ${GLUON_BRANCH}" echo "Building Gluon ${GLUON_TAG} as ${GLUON_BRANCH}"
last_release_testing="$(get_last_release testing)" last_release_testing="$(get_last_release testing)"
last_release_stable="$(get_last_release stable)" last_release_stable="$(get_last_release stable)"
echo "Last release in branch testing was ${last_release_testing}" last_release="$(echo "${last_release_testing}\n${last_release_stable}" | sort -V | tail -n1)"
if is_based_on "$last_release_testing" "$GLUON_TAG"; then echo "Last release was ${last_release}"
local_version="$(extract_local_version "$last_release_testing")" if is_based_on "$last_release" "$GLUON_TAG"; then
if [ "$GLUON_BRANCH" != "stable" ]; then local_version="$(extract_local_version "$last_release")"
local_version="$(($local_version + 1))"
fi
elif [ "$GLUON_BRANCH" = "stable" ] && is_based_on "$last_release_stable" "$GLUON_TAG"; then
local_version="$(extract_local_version "$last_release_stable")"
local_version="$(($local_version + 1))" local_version="$(($local_version + 1))"
else else
# new gluon version => reset local version number # new gluon version => reset local version number
local_version=1 local_version=1
fi fi
if [ "$GLUON_BRANCH" = "testing" ]; then
local_version="${local_version}~testing"
fi
auto_determined_release="${GLUON_TAG}+${LOCAL_SUFFIX}${local_version}" auto_determined_release="${GLUON_TAG}+${LOCAL_SUFFIX}${local_version}"
read -p "Release name for this build [default: ${auto_determined_release}]: " GLUON_RELEASE read -p "Release name for this build [default: ${auto_determined_release}]: " GLUON_RELEASE
GLUON_RELEASE="${GLUON_RELEASE:-$auto_determined_release}" GLUON_RELEASE="${GLUON_RELEASE:-$auto_determined_release}"
@ -155,6 +142,7 @@ for target in ar71xx-generic ar71xx-nand mpc85xx-generic x86-generic; do
echo "TARGET_${env_target}_DONE=1" >> "$statefile" echo "TARGET_${env_target}_DONE=1" >> "$statefile"
done done
make manifest make manifest
make manifest GLUON_BRANCH=testing GLUON_PRIORITY=0
cd .. cd ..
if [ -n "$KEYFILE" -a -r "$KEYFILE" ]; then if [ -n "$KEYFILE" -a -r "$KEYFILE" ]; then