build-version.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # calls build.sh with information found in given version
  3. MY_DIR=$(dirname $0)
  4. MY_DIR=$(readlink -f "$MY_DIR")
  5. pushd $MY_DIR > /dev/null
  6. . functions.sh
  7. version=$1
  8. versionfile="${MY_DIR}/versions/${version}"
  9. [ -r $versionfile ] || abort "Failed to find the version '$version'."
  10. base=`awk 'BEGIN { FS="=" } /^GLUON=([a-f0-9]+)(\s*#.+)?$/ { print $2; }' $versionfile | awk 'BEGIN { FS="#" } { print $1; }'`
  11. branch=`awk 'BEGIN { FS="=" } /^BRANCH=([a-z]+)$/ { print $2; }' $versionfile`
  12. version=`awk 'BEGIN { FS="=" } /^VERSION=([0-9\.\-+~a-z]+)$/ { print $2; }' $versionfile`
  13. site=`awk 'BEGIN { FS="=" } /^SITE=([a-f0-9]+)(\s*#.+)?$/ { print $2; }' $versionfile | awk 'BEGIN { FS="#" } { print $1; }'`
  14. targets=`awk 'BEGIN { FS="=" } /^TARGETS=.+$/ { print $2; }' $versionfile`
  15. ts=`awk 'BEGIN { FS="=" } /^TS=.+$/ { print $2; }' $versionfile`
  16. [ -z "$base" ] && abort "Failed to parse Gluon base commit-id from version file."
  17. [ -z "$branch" ] && abort "Failed to parse branch name from version file."
  18. [ -z "$version" ] && abort "Failed to parse version from version file."
  19. [ -z "$site" ] && abort "Failed to parse site repo commit-id from version file."
  20. [ -z "$ts" ] && abort "Failed to parse timestamp from version file."
  21. # remove all spaces from git-commit-ids
  22. base="${base// /}"
  23. site="${site// /}"
  24. info "Building $branch version '$version' again ..."
  25. echo " * Gluon base = $base"
  26. echo " * Site repo = $site"
  27. echo " * Timestamp = $ts"
  28. echo " * Targets = $targets"
  29. echo
  30. # invoke build script
  31. if [ "$NO_DOCKER" == "1" ]; then
  32. BASE="$base" BRANCH="$branch" SITE="$site" VERSION="$version" BUILD_TS="$ts" TARGETS="$targets" ./build.sh
  33. else
  34. BASE="$base" BRANCH="$branch" SITE="$site" VERSION="$version" BUILD_TS="$ts" TARGETS="$targets" ./docker-build.sh
  35. fi