package_source.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/sh
  2. ## Copyright (c) 2014 Minoca Corp. All Rights Reserved.
  3. ##
  4. ## Script Name:
  5. ##
  6. ## package_source.sh
  7. ##
  8. ## Abstract:
  9. ##
  10. ## This script compresses the bin directory of the build output. SRCROOT,
  11. ## ARCH, and DEBUG must all be set.
  12. ##
  13. ## Author:
  14. ##
  15. ## Evan Green 13-May-2014
  16. ##
  17. ## Environment:
  18. ##
  19. ## Minoca (Windows) Build
  20. ##
  21. set -e
  22. SAVE_IFS="$IFS"
  23. IFS='
  24. '
  25. export SRCROOT=`echo $SRCROOT | sed 's_\\\\_/_g'`
  26. IFS="$SAVE_IFS"
  27. unset SAVE_IFS
  28. if test -z $SRCROOT; then
  29. echo "SRCROOT must be set."
  30. exit 1
  31. fi
  32. export TMPDIR=$PWD
  33. export TEMP=$TMPDIR
  34. OUTROOT=$SRCROOT/$ARCH$VARIANT$DEBUG
  35. export PATH="$SRCROOT/tools/win32/mingw/bin;$SRCROOT/tools;$OUTROOT/bin;$OUTROOT/testbin;$OUTROOT/bin/tools/bin;$SRCROOT/tools/win32/scripts;$SRCROOT/tools/win32/swiss;$SRCROOT/tools/win32/bin;$SRCROOT/tools/win32/ppython/app;$SRCROOT/tools/win32/ppython/App/Scripts;$PATH"
  36. rm -rf ./src
  37. mkdir ./src
  38. echo "Exporting OS"
  39. cd $SRCROOT/os
  40. git archive HEAD > $TMPDIR/os.tar
  41. mkdir $TMPDIR/src/os
  42. tar -xf $TMPDIR/os.tar -C $TMPDIR/src/os
  43. rm $TMPDIR/os.tar
  44. mkdir $TMPDIR/src/os/.git
  45. echo $((`git rev-list --count HEAD` + 1000)) > $TMPDIR/src/os/revision
  46. git rev-parse --abbrev-ref HEAD > $TMPDIR/src/os/branch
  47. git rev-parse HEAD > $TMPDIR/src/os/commit
  48. git rev-parse HEAD > $TMPDIR/src/os/.git/HEAD
  49. echo "Exporting third-party"
  50. cd $SRCROOT/third-party
  51. git archive HEAD > $TMPDIR/tp.tar
  52. mkdir $TMPDIR/src/third-party
  53. tar -xf $TMPDIR/tp.tar -C $TMPDIR/src/third-party
  54. rm $TMPDIR/tp.tar
  55. echo "Exporting client script"
  56. cd $TMPDIR
  57. git archive --format=tar --remote=ssh://git@git.minoca.co:2222/minoca/web.git \
  58. HEAD mweb/mbuild/client.py > web.tar
  59. tar -Oxf web.tar > ./src/client.py
  60. rm web.tar
  61. echo "Archiving"
  62. set +e
  63. tar -czf minoca-src.tar.gz ./src
  64. echo "Done Packaging Source"