prepare_receipt.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #/bin/bash
  2. # this script should be run from build directory
  3. VERSION=1 # eg 1.0rc2
  4. NUMBER=1 # jenkins build number
  5. # Detect whether we are running on a Yosemite or El Capitan machine, and generate
  6. # an appropriately named ZIP file for the Homebrew receipt to point at.
  7. if echo `sw_vers` | grep "10.11"; then
  8. OSX_VERSION=el_capitan
  9. elif echo `sw_vers` | grep "10.10"; then
  10. OSX_VERSION=yosemite
  11. else
  12. echo Unsupported OS X version. We only support Yosemite and El Capitan
  13. exit 1
  14. fi
  15. while [ "$1" != "" ]; do
  16. case $1 in
  17. --version )
  18. shift
  19. VERSION=$1
  20. ;;
  21. --number )
  22. shift
  23. NUMBER=$1
  24. ;;
  25. esac
  26. shift
  27. done
  28. # prepare template directory
  29. rm -rf cpp-ethereum
  30. mkdir cpp-ethereum
  31. mkdir cpp-ethereum/$VERSION
  32. p="../webthree-helpers/homebrew/"
  33. cp ${p}homebrew.mxcl.cpp-ethereum.plist ${p}INSTALL_RECEIPT.json ../web-helpers/LICENSE cpp-ethereum/$VERSION
  34. # build umbrella project and move install directory to destination
  35. #
  36. # TODO - Except it isn't actually building it is? Maybe it used to
  37. # at some point in the past? Does that mean that we are dependent
  38. # on some previous build/install steps having happened by the time
  39. # we run this script? Probably.
  40. mkdir -p install
  41. cp -rf install/* cpp-ethereum/$VERSION
  42. # tar everything
  43. NAME="cpp-ethereum-${VERSION}.${OSX_VERSION}.bottle.${NUMBER}.tar.gz"
  44. tar -zcvf $NAME cpp-ethereum
  45. # get variables
  46. HASH=`git rev-parse HEAD`
  47. SIGNATURE=`openssl sha1 ${NAME} | cut -d " " -f 2`
  48. # Pull the current cpp-ethereum.rb file from Github. We used to use a template file.
  49. curl https://raw.githubusercontent.com/ethereum/homebrew-ethereum/master/cpp-ethereum.rb > cpp-ethereum.rb.in
  50. # prepare receipt
  51. if [ ${OSX_VERSION} == yosemite ]; then
  52. sed -e s/revision\ \=\>\ \'[[:xdigit:]][[:xdigit:]]*\'/revision\ \=\>\ \'${HASH}\'/g \
  53. -e s/version\ \'.*\'/version\ \'${VERSION}\'/g \
  54. -e s/sha1\ \'[[:xdigit:]][[:xdigit:]]*\'\ \=\>\ \:\yosemite/sha1\ \'${SIGNATURE}\'\ \=\>\ \:yosemite/g \
  55. -e s/revision[[:space:]][[:digit:]][[:digit:]]*/revision\ ${NUMBER}/g < cpp-ethereum.rb.in > "cpp-ethereum.rb"
  56. else
  57. sed -e s/revision\ \=\>\ \'[[:xdigit:]][[:xdigit:]]*\'/revision\ \=\>\ \'${HASH}\'/g \
  58. -e s/version\ \'.*\'/version\ \'${VERSION}\'/g \
  59. -e s/sha1\ \'[[:xdigit:]][[:xdigit:]]*\'\ \=\>\ \:\el\_capitan/sha1\ \'${SIGNATURE}\'\ \=\>\ \:el\_capitan/g \
  60. -e s/revision[[:space:]][[:digit:]][[:digit:]]*/revision\ ${NUMBER}/g < cpp-ethereum.rb.in > "cpp-ethereum.rb"
  61. fi