diff --git a/scripts/build_macos.sh b/scripts/build_macos.sh deleted file mode 100755 index b07ad76df..000000000 --- a/scripts/build_macos.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -set -e - -BUILD_DIR=build -INSTALL_DIR=usr/local -BIN_DIR=$BUILD_DIR/$INSTALL_DIR/bin - -print_error() -{ - echo -e "\e[31m$1\e[0m" -} - -if [ ! -d "dvc" ]; then - print_error "Please run this script from repository root" - exit 1 -fi - -trap 'print_error "FAIL"; exit 1' ERR - -print_info() -{ - echo -e "\e[32m$1\e[0m" -} - -command_exists() -{ - command -v $1 > /dev/null 2>&1 -} - -fpm_build() -{ - print_info "Building $1..." - VERSION=$(python -c "import dvc; from dvc import VERSION; print(str(VERSION))") - fpm -s dir -f -t $1 --osxpkg-identifier-prefix com.dataversioncontrol -n dvc -v $VERSION -C $BUILD_DIR $INSTALL_DIR -} - -cleanup() -{ - print_info "Cleaning up..." - rm -rf build -} - -install_dependencies() -{ - print_info "Installing requirements..." - pip install -r requirements.txt - - print_info "Installing fpm..." - gem install --no-ri --no-rdoc fpm - - print_info "Installing pyinstaller..." - pip install pyinstaller -} - -build_dvc() -{ - print_info "Building dvc binary..." - pyinstaller --onefile --additional-hooks-dir $(pwd)/scripts/hooks dvc/__main__.py --name dvc --distpath $BIN_DIR --specpath $BUILD_DIR -} - -cleanup -install_dependencies -build_dvc -fpm_build osxpkg -cleanup - -print_info "Successfully built dvc osx package" diff --git a/scripts/build_linux.sh b/scripts/build_posix.sh similarity index 74% rename from scripts/build_linux.sh rename to scripts/build_posix.sh index cac40d430..474e552d7 100755 --- a/scripts/build_linux.sh +++ b/scripts/build_posix.sh @@ -1,11 +1,19 @@ #!/bin/bash set -e +set -x BUILD_DIR=build -INSTALL_DIR=usr BIN_DIR=$BUILD_DIR/$INSTALL_DIR/bin +if [[ "$(uname)" == 'Linux' ]]; then + INSTALL_DIR=usr + FPM_FLAGS= +else + INSTALL_DIR=usr/local + FPM_FLAGS='--osxpkg-identifier-prefix com.dataversioncontrol' +fi + print_error() { echo -e "\e[31m$1\e[0m" @@ -32,7 +40,7 @@ fpm_build() { print_info "Building $1..." VERSION=$(python -c "import dvc; from dvc import VERSION; print(str(VERSION))") - fpm -s dir -f -t $1 -n dvc -v $VERSION -C $BUILD_DIR $INSTALL_DIR + fpm -s dir -f -t $1 $FPM_FLAGS -n dvc -v $VERSION -C $BUILD_DIR $INSTALL_DIR } cleanup() @@ -51,6 +59,9 @@ install_dependencies() elif command_exists apt-get; then sudo apt-get update -y sudo apt-get install ruby-dev build-essential rpm python-pip python-dev + elif command_exists brew; then + brew update + brew install ruby else echo "Unable to install fpm dependencies" && exit 1 fi @@ -68,13 +79,21 @@ build_dvc() { print_info "Building dvc binary..." pyinstaller --onefile --additional-hooks-dir $(pwd)/scripts/hooks dvc/__main__.py --name dvc --distpath $BIN_DIR --specpath $BUILD_DIR + + $BIN_DIR/dvc --help } cleanup install_dependencies build_dvc -fpm_build rpm -fpm_build deb + +if [[ "$(uname)" == 'Linux' ]]; then + fpm_build rpm + fpm_build deb +else + fpm_build osxpkg +fi + cleanup -print_info "Successfully built dvc rpm and deb packages" +print_info "Successfully built dvc packages" diff --git a/scripts/ci/script.sh b/scripts/ci/script.sh index 2cef917bd..3cf2b0807 100644 --- a/scripts/ci/script.sh +++ b/scripts/ci/script.sh @@ -22,11 +22,6 @@ if [[ "$TRAVIS_PULL_REQUEST" == "false" && \ fi if [[ ! -z "$TRAVIS_TAG" ]]; then - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - ./scripts/build_macos.sh - else - ./scripts/build_linux.sh - fi - ./scripts/build_package.sh + ./scripts/build_posix.sh fi