kszucs commented on a change in pull request #12320:
URL: https://github.com/apache/arrow/pull/12320#discussion_r813144377



##########
File path: dev/release/verify-release-candidate.sh
##########
@@ -378,20 +353,268 @@ test_csharp() {
     fi
   fi
 
-  sourcelink test 
artifacts/Apache.Arrow/Release/netstandard1.3/Apache.Arrow.pdb
-  sourcelink test artifacts/Apache.Arrow/Release/netcoreapp2.1/Apache.Arrow.pdb
+  CSHARP_ALREADY_INSTALLED=1
+}
 
+install_go() {
+  # Install go
+  if [ "${GO_ALREADY_INSTALLED:-0}" -gt 0 ]; then
+    show_info "$(go version) already installed at $(which go)"
+    return 0
+  fi
+
+  local version=1.16.12
+  show_info "Installing go version ${version}..."
+
+  local arch="$(uname -m)"
+  if [ "$arch" == "x86_64" ]; then
+    arch=amd64
+  elif [ "$arch" == "aarch64" ]; then
+    arch=arm64
+  fi
+
+  if [ "$(uname)" == "Darwin" ]; then
+    local os=darwin
+  else
+    local os=linux
+  fi
+
+  local archive="go${version}.${os}-${arch}.tar.gz"
+  curl -sLO https://dl.google.com/go/$archive
+
+  local prefix=${ARROW_TMPDIR}/go
+  mkdir -p $prefix
+  tar -xzf $archive -C $prefix
+  rm -f $archive
+
+  export GOROOT=${prefix}/go
+  export GOPATH=${prefix}/gopath
+  export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
+
+  show_info "$(go version) installed at $(which go)"
+
+  GO_ALREADY_INSTALLED=1
+}
+
+install_conda() {
+  # Setup short-lived miniconda for Python and integration tests
+  show_info "Ensuring that Conda is installed..."
+  local prefix=$ARROW_TMPDIR/mambaforge
+
+  # Setup miniconda only if the directory doesn't exist yet
+  if [ "${CONDA_ALREADY_INSTALLED:-0}" -eq 0 ]; then
+    if [ ! -d "${prefix}" ]; then
+      show_info "Installing miniconda at ${prefix}..."
+      local arch=$(uname -m)
+      local platform=$(uname)
+      local 
url="https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-${platform}-${arch}.sh";
+      curl -sL -o miniconda.sh $url
+      bash miniconda.sh -b -p $prefix
+      rm -f miniconda.sh
+    else
+      show_info "Miniconda already installed at ${prefix}"
+    fi
+  else
+    show_info "Conda installed at ${prefix}"
+  fi
+  CONDA_ALREADY_INSTALLED=1
+
+  # Creating a separate conda environment
+  . $prefix/etc/profile.d/conda.sh
+  conda activate base
+}
+
+setup_conda() {
+  # Optionally setup conda environment with the passed dependencies
+  local env="conda-${ENV:-source}"
+  local pyver=${PYTHON_VERSION:-3}
+
+  if [ "${USE_CONDA}" -gt 0 ]; then
+    show_info "Configuring Conda environment..."
+
+    # Deactivate previous env
+    if [ ! -z ${CONDA_PREFIX} ]; then
+      conda deactivate || :
+    fi
+    # Ensure that conda is installed
+    install_conda
+    # Create environment
+    if ! conda env list | cut -d" " -f 1 | grep $env; then
+      mamba create -y -n $env python=${pyver}
+    fi
+    # Install dependencies
+    if [ $# -gt 0 ]; then
+      mamba install -y -n $env $@
+    fi
+    # Activate the environment
+    conda activate $env
+  elif [ ! -z ${CONDA_PREFIX} ]; then
+    echo "Conda environment is active despite that USE_CONDA is set to 0."
+    echo "Deactivate the environment using `conda deactive` before running the 
verification script."
+    return 1
+  fi
+}
+
+setup_virtualenv() {
+  # Optionally setup pip virtualenv with the passed dependencies
+  local env="venv-${ENV:-source}"
+  local pyver=${PYTHON_VERSION:-3}
+  local python=${PYTHON:-"python${pyver}"}
+  local virtualenv="${ARROW_TMPDIR}/${env}"
+  local skip_missing_python=${SKIP_MISSING_PYTHON:-0}
+
+  if [ "${USE_CONDA}" -eq 0 ]; then
+    show_info "Configuring Python ${pyver} virtualenv..."
+
+    if [ ! -z ${CONDA_PREFIX} ]; then
+      echo "Conda environment is active despite that USE_CONDA is set to 0."
+      echo "Deactivate the environment before running the verification script."
+      return 1
+    fi
+    # Deactivate previous env
+    if command -v deactivate &> /dev/null; then
+      deactivate
+    fi
+    # Check that python interpreter exists
+    if ! command -v "${python}" &> /dev/null; then
+      echo "Couldn't locate python interpreter with version ${pyver}"
+      echo "Call the script with USE_CONDA=1 to test all of the python 
versions."
+      return 1
+    fi
+    # Create environment
+    if [ ! -d "${virtualenv}" ]; then
+      show_info "Creating python virtualenv at ${virtualenv}..."
+      $python -m venv ${virtualenv}
+    else
+      show_info "Using already created virtualenv at ${virtualenv}"
+    fi
+    # Activate the environment
+    source "${virtualenv}/bin/activate"
+    # Install dependencies
+    if [ $# -gt 0 ]; then
+      show_info "Installed pip packages $@..."
+      pip install $@
+    fi
+  fi
+}
+
+setup_go() {
+  show_info "Ensuring that Go is installed..."
+  if [ "${USE_CONDA}" -eq 0 ]; then
+    install_go
+  fi
+}
+
+setup_nodejs() {
+  show_info "Ensuring that NodeJS is installed..."
+  if [ "${USE_CONDA}" -eq 0 ]; then
+    install_nodejs
+  fi
+}
+
+test_package_java() {
+  show_header "Build and test Java libraries"
+
+  # Build and test Java (Requires newer Maven -- I used 3.3.9)
+  setup_conda maven || exit 1
+
+  pushd java
+  mvn test
+  mvn package
   popd
 }
 
-# Build and test Python
+test_and_install_cpp() {
+  show_header "Build, install and test C++ libraries"
+
+  # Build and test C++
+  setup_virtualenv numpy || exit 1
+  setup_conda \
+    --file ci/conda_env_unix.txt \
+    --file ci/conda_env_cpp.txt \
+    --file ci/conda_env_gandiva.txt \
+    ncurses \
+    numpy \
+    sqlite \
+    compilers || exit 1
+
+  if [ "${USE_CONDA}" -gt 0 ]; then

Review comment:
       It is. My intention here is to "specify conda dependencies" (we may 
rename the function to something like  `maybe_setup_conda`) but only install 
them if requested by `USE_CONDA` env variable. The same applies to 
`setup_virtualenv` but they are mutually exclusive. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to