build-tarball.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. set -o errexit
  3. PKG_DIR=$(cd $(dirname $0); pwd)
  4. BUILD_DIR=build/output/salt
  5. # In case this is a git checkout, run sdist then extract out tarball
  6. # contents to get all the critical versioning files into place
  7. rm -rf dist/
  8. python2.7 setup.py sdist
  9. gtar xzvf dist/salt*.tar.gz --strip-components=1
  10. rm -rf dist/ $BUILD_DIR
  11. cp $PKG_DIR/_syspaths.py salt/
  12. python2.7 setup.py bdist
  13. python2.7 setup.py bdist_esky
  14. rm salt/_syspaths.py
  15. rm -f dist/*.tar.gz
  16. mkdir -p $BUILD_DIR/{bin/appdata,install,var/log/salt}
  17. cp -r conf $BUILD_DIR/etc
  18. cp $PKG_DIR/*.xml $PKG_DIR/install.sh $BUILD_DIR/install
  19. chmod +x $BUILD_DIR/install/install.sh
  20. unzip -d $BUILD_DIR/bin dist/*.zip
  21. cp $BUILD_DIR/bin/*/libgcc_s.so.1 $BUILD_DIR/bin/
  22. cp $BUILD_DIR/bin/*/libssp.so.0 $BUILD_DIR/bin/
  23. find build/output/salt/bin/ -mindepth 1 -maxdepth 1 -type d -not -name appdata -exec mv {} $BUILD_DIR/bin/appdata/ \;
  24. PYZMQ=$(find ${BUILD_DIR}/bin/ -mindepth 1 -type d -name 'pyzmq-*.egg')/zmq
  25. find /opt/local/lib/ -maxdepth 1 -type l -regextype sed -regex '.*/libzmq.so.[0-9]\+$' -exec cp {} ${PYZMQ}/ \;
  26. find /opt/local/lib/ -maxdepth 1 -type l -regextype sed -regex '.*/libsodium.so.[0-9]\+$' -exec cp {} ${PYZMQ}/ \;
  27. find ${PYZMQ}/ -maxdepth 1 -type f -name '*.so.*' -exec patchelf --set-rpath '$ORIGIN:$ORIGIN/../../:$ORIGIN/../lib' {} \;
  28. find ${PYZMQ}/ -maxdepth 1 -type f -name '*.so.*' -exec cp {} ${PYZMQ}/../../ \;
  29. find ${PYZMQ}/ -maxdepth 3 -type f -name '*.so' -exec patchelf --set-rpath '$ORIGIN:$ORIGIN/../../:$ORIGIN/../lib:$ORIGIN/../../../../' {} \;
  30. gtar -C $BUILD_DIR/.. -czvf dist/salt-$(awk '/^Version:/{print $2}' < PKG-INFO)-esky-smartos.tar.gz salt
  31. echo "tarball built"