getDependencies.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # local variables
  3. DEPENDENCIES_FOLDER=dependenciesFiles
  4. ARTIFACTORY_URL=https://eu-west-1.artifactory.aws.arm.com:443/artifactory
  5. ARTIFACTORY_DEPOT=mcu.depot/ci/depot
  6. PACKCHK_VERSION=1.3.93
  7. if [ -z "$ARTIFACTORY_API_KEY" ]; then
  8. echo "Please set your Artifactory ARTIFACTORY_API_KEY"
  9. exit 1
  10. fi
  11. if [ -z "$USER" ]; then
  12. echo "Please set your short ARM user e.g. sampel01"
  13. exit 1
  14. fi
  15. function downloadFromArtifactory {
  16. filename=$(basename $1)
  17. echo "Fetching ${filename} ..."
  18. if [[ -f "${filename}" ]]; then
  19. sha256sum=$(curl -s -I -H "X-JFrog-Art-Api:$ARTIFACTORY_API_KEY" "${ARTIFACTORY_URL}/${1}" | grep "X-Checksum-Sha256" | cut -d" " -f2)
  20. if echo "${sha256sum} *${filename}" | sha256sum -c --status; then
  21. echo " ... already up to date"
  22. else
  23. rm ${filename}
  24. fi
  25. fi
  26. if [[ ! -f "${filename}" ]]; then
  27. curl -C - -H "X-JFrog-Art-Api:$ARTIFACTORY_API_KEY" -O "${ARTIFACTORY_URL}/${1}"
  28. chmod +x ${filename}
  29. fi
  30. }
  31. function downloadFromDepot {
  32. downloadFromArtifactory "${ARTIFACTORY_DEPOT}/${1}"
  33. }
  34. function gitClone {
  35. echo "Cloning/updating ${2} ..."
  36. if [[ ! -d "${2}" ]]; then
  37. git clone -b $3 $1 $2
  38. else
  39. pushd $2
  40. git clean -fdx
  41. git checkout -f $3
  42. git pull origin $3
  43. popd
  44. fi
  45. }
  46. mkdir -p $DEPENDENCIES_FOLDER
  47. pushd $DEPENDENCIES_FOLDER || exit
  48. downloadFromDepot "doxygen_1.8.6-2_amd64.deb"
  49. downloadFromDepot "ArmCompiler-5.06u7-linux.sh"
  50. downloadFromDepot "ArmCompiler-6.16-linux-x86_64.sh"
  51. downloadFromDepot "ArmCompiler-6.6.4-linux-x86_64.sh"
  52. downloadFromDepot "gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2"
  53. downloadFromDepot "fvp-11.12-linux-x86_64.tar.gz"
  54. downloadFromArtifactory "mcu.promoted/staging/devtools/tools/packchk/${PACKCHK_VERSION}/linux64/PackChk"
  55. gitClone "ssh://${USER}@eu-gerrit-1.euhpc.arm.com:29418/dsg/cmsis/buildtools" "buildtools" "master"
  56. popd || exit