upload_packages.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ##
  2. ## Copyright (c) 2017 Minoca Corp.
  3. ##
  4. ## This file is licensed under the terms of the GNU General Public License
  5. ## version 3. Alternative licensing terms are available. Contact
  6. ## info@minocacorp.com for details. See the LICENSE file at the root of this
  7. ## project for complete licensing information..
  8. ##
  9. ## Script Name:
  10. ##
  11. ## upload_packages.sh
  12. ##
  13. ## Abstract:
  14. ##
  15. ## This script uploads the packages to production.
  16. ##
  17. ## Author:
  18. ##
  19. ## Evan Green 20-Jan-2017
  20. ##
  21. ## Environment:
  22. ##
  23. ## Windows Build
  24. ##
  25. if test -z "$SRCROOT"; then
  26. echo "Error: SRCROOT must be set."
  27. exit 1
  28. fi
  29. if test -z "$ARCH"; then
  30. echo "Error: ARCH must be set."
  31. exit 1
  32. fi
  33. if test -z "$UPLOAD_DATE"; then
  34. echo "Uploads not prepared."
  35. exit 1
  36. fi
  37. BINROOT=$SRCROOT/${ARCH}${VARIANT}dbg/bin
  38. VERSION=`cat $BINROOT/kernel-version | \
  39. sed 's/\([0-9]*\)\.\([0-9]*\)\..*/\1.\2/'`
  40. parch=$ARCH$VARIANT
  41. case "$ARCH$VARIANT" in
  42. x86) parch=i686 ;;
  43. x86q) parch=i586 ;;
  44. *) parch="$ARCH" ;;
  45. esac
  46. ##
  47. ## Get the last native build instance.
  48. ##
  49. barch=$ARCH$VARIANT
  50. last_native_build=`python ../../client.py --query "Native Pilot $barch"`
  51. if test -z $last_native_build; then
  52. echo "Error: Failed to get last Native Pilot $barch build."
  53. exit 1
  54. fi
  55. ##
  56. ## Loop over each repository.
  57. ##
  58. for repo in main; do
  59. ##
  60. ## Get the index file, which lists the other files.
  61. ##
  62. repo_dir="$VERSION/$parch/$repo/"
  63. index_file="$repo_dir/Packages"
  64. echo "Downloading $index_file"
  65. python ../../client.py --pull package $index_file Packages \
  66. $last_native_build
  67. packages=`cat Packages | grep Filename: | sed 's/Filename: //'`
  68. ##
  69. ## Create the destination directory.
  70. ##
  71. mkdir_on_production "$repo_dir"
  72. mkdir -p "$repo_dir"
  73. ##
  74. ## Download each package and upload it to production.
  75. ##
  76. for f in $packages Packages Packages.gz; do
  77. file_path="$repo_dir/$f"
  78. python ../../client.py --pull package "$repo_dir/$f" "$repo_dir/$f" 0
  79. upload_to_production "$repo_dir/$f"
  80. done
  81. done