upload_binaries.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/sh
  2. ## Copyright (c) 2014 Minoca Corp. All Rights Reserved.
  3. ##
  4. ## Script Name:
  5. ##
  6. ## package_binaries.sh
  7. ##
  8. ## Abstract:
  9. ##
  10. ## This script archives the native build artifacts.
  11. ##
  12. ## Author:
  13. ##
  14. ## Evan Green 13-Jun-2014
  15. ##
  16. ## Environment:
  17. ##
  18. ## Minoca Build
  19. ##
  20. set -e
  21. if test -z "$ARCH"; then
  22. echo "ARCH must be set."
  23. exit 1
  24. fi
  25. if test -z "$DEBUG"; then
  26. echo "DEBUG must be set."
  27. exit 1
  28. fi
  29. export TMPDIR=$PWD
  30. export TEMP=$TMPDIR
  31. ARCHIVE_LOCATION=$PWD/..
  32. file=minoca-bin-$ARCH$VARIANT$DEBUG.tar.gz
  33. file_path=$ARCHIVE_LOCATION/$file
  34. file_size=`ls -l $file_path | \
  35. sed -n 's/[^ ]* *[^ ]* *[^ ]* *[^ ]* *\([0123456789]*\).*/\1/p'`
  36. python ../../client.py --result "Binary Size" integer "$file_size"
  37. python ../../client.py --upload schedule $file_path $file
  38. echo Uploaded file $file_path, size $file_size
  39. ##
  40. ## Upload the packages. VERSION is major and minor numbers (ie 0.1 of 0.1.888).
  41. ##
  42. package_dir="$ARCHIVE_LOCATION/packages"
  43. VERSION=`cat $package_dir/kernel-version | sed 's/\([0-9]*\)\.\([0-9]*\)\..*/\1.\2/'`
  44. case "$ARCH" in
  45. x86)
  46. ##
  47. ## Quark uses i586, everything else is i686.
  48. ##
  49. if test "x$VARIANT" = "xq"; then
  50. parch=i586
  51. else
  52. parch=i686
  53. fi
  54. ;;
  55. armv6) parch=armv6 ;;
  56. armv7) parch=armv7 ;;
  57. *)
  58. echo "Invalid arch $ARCH."
  59. exit 1
  60. esac
  61. for file in `ls $package_dir`; do
  62. python ../../client.py --upload package $package_dir/$file $VERSION/$parch/main/$file
  63. done
  64. rm -rf "$file_path" "$package_dir"