From 8557d4d0695e06a22410528bf1740dcfe22da1d2 Mon Sep 17 00:00:00 2001 From: Deepak Majeti Date: Wed, 6 Mar 2024 14:30:48 -0800 Subject: [PATCH] Add support for sudo in setup scripts (#8943) Summary: Ubuntu requires sudo to install at the standard path. Pull Request resolved: https://github.com/facebookincubator/velox/pull/8943 Reviewed By: Yuhta Differential Revision: D54593906 Pulled By: kgpai fbshipit-source-id: cb7ee939d3fdf2675531ce5852c541b89519e07d --- .github/workflows/scheduled.yml | 11 ++++++----- scripts/setup-helper-functions.sh | 3 ++- scripts/setup-ubuntu.sh | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index a3910c54aaa0c..419b51a35ee42 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -18,6 +18,7 @@ on: pull_request: paths: - ".github/workflows/scheduled.yml" + - scripts/* schedule: - cron: '0 3 * * *' @@ -75,7 +76,7 @@ jobs: ref: "${{ inputs.ref || 'main' }}" - name: "Install dependencies" - run: cd velox && source ./scripts/setup-ubuntu.sh + run: cd velox && sudo ./scripts/setup-ubuntu.sh - name: "Build" run: | @@ -125,7 +126,7 @@ jobs: ref: "${{ inputs.ref || 'main' }}" - name: "Install dependencies" - run: source ./scripts/setup-ubuntu.sh + run: sudo ./scripts/setup-ubuntu.sh - name: Download presto fuzzer uses: actions/download-artifact@v3 @@ -173,7 +174,7 @@ jobs: ref: "${{ inputs.ref || 'main' }}" - name: "Install dependencies" - run: source ./scripts/setup-ubuntu.sh + run: sudo ./scripts/setup-ubuntu.sh - name: Download spark expression fuzzer uses: actions/download-artifact@v3 @@ -247,7 +248,7 @@ jobs: ref: "${{ inputs.ref || 'main' }}" - name: "Install dependencies" - run: source ./scripts/setup-ubuntu.sh + run: sudo ./scripts/setup-ubuntu.sh - name: Download aggregation fuzzer uses: actions/download-artifact@v3 @@ -288,7 +289,7 @@ jobs: ref: "${{ inputs.ref || 'main' }}" - name: "Install dependencies" - run: source ./scripts/setup-ubuntu.sh + run: sudo ./scripts/setup-ubuntu.sh - name: Download join fuzzer uses: actions/download-artifact@v3 diff --git a/scripts/setup-helper-functions.sh b/scripts/setup-helper-functions.sh index 4f0a11e152fd9..aeb29399ba308 100644 --- a/scripts/setup-helper-functions.sh +++ b/scripts/setup-helper-functions.sh @@ -158,6 +158,7 @@ function cmake_install { mkdir -p "${BINARY_DIR}" CPU_TARGET="${CPU_TARGET:-unknown}" COMPILER_FLAGS=$(get_cxx_flags $CPU_TARGET) + SUDO="${SUDO:-""}" # CMAKE_POSITION_INDEPENDENT_CODE is required so that Velox can be built into dynamic libraries \ cmake -Wno-dev -B"${BINARY_DIR}" \ @@ -169,6 +170,6 @@ function cmake_install { -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" \ -DBUILD_TESTING=OFF \ "$@" - ninja -C "${BINARY_DIR}" install + ${SUDO} ninja -C "${BINARY_DIR}" install } diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index 102974b6a3333..4c35e0c701824 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -29,6 +29,7 @@ BOOST_VERSION=boost-1.84.0 NPROC=$(getconf _NPROCESSORS_ONLN) DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)} export CMAKE_BUILD_TYPE=Release +export SUDO=sudo # Install all velox and folly dependencies. # The is an issue on 22.04 where a version conflict prevents glog install,