build-version.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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. site=`awk 'BEGIN { FS="=" } /^SITE=([a-f0-9]+)(\s*#.+)?$/ { print $2; }' $versionfile | awk 'BEGIN { FS="#" } { print $1; }'`
  13. ts=`awk 'BEGIN { FS="=" } /^TS=.+$/ { print $2; }' $versionfile`
  14. [ -z "$base" ] && abort "Failed to parse Gluon base commit-id from version file."
  15. [ -z "$branch" ] && abort "Failed to parse branch name from version file."
  16. [ -z "$site" ] && abort "Failed to parse site repo commit-id from version file."
  17. [ -z "$ts" ] && abort "Failed to parse timestamp from version file."
  18. # remove all spaces from git-commit-ids
  19. base="${base// /}"
  20. site="${site// /}"
  21. info "Building $branch version '$version' again ..."
  22. echo " * Gluon base = $base"
  23. echo " * Site repo = $site"
  24. echo " * Timestamp = $ts"
  25. echo
  26. # invoke build script
  27. BASE="$base" BRANCH="$branch" SITE="$site" VERSION="$version" BUILD_TS="$ts" ./build.sh