Apache DataFusion SQL Query Engine
ARROW-4960: [R] Build r-arrow conda package in crossbow
Uwe L. Korn3af22d442217
diff --git a/ci/docker/conda-r.dockerfile b/ci/docker/conda-r.dockerfiledeleted file mode 100644index 79b6ebc3b2..0000000000--- a/ci/docker/conda-r.dockerfile+++ /dev/null@@ -1,53 +0,0 @@-# Licensed to the Apache Software Foundation (ASF) under one-# or more contributor license agreements. See the NOTICE file-# distributed with this work for additional information-# regarding copyright ownership. The ASF licenses this file-# to you under the Apache License, Version 2.0 (the-# "License"); you may not use this file except in compliance-# with the License. You may obtain a copy of the License at-#-# http://www.apache.org/licenses/LICENSE-2.0-#-# Unless required by applicable law or agreed to in writing,-# software distributed under the License is distributed on an-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY-# KIND, either express or implied. See the License for the-# specific language governing permissions and limitations-# under the License.--ARG repo-ARG arch-FROM ${repo}:${arch}-conda-cpp--# Need locales so we can set UTF-8-RUN apt-get update -y && \- apt-get install -y locales && \- locale-gen en_US.UTF-8 && \- apt-get clean && \- rm -rf /var/lib/apt/lists/*--# install R specific packages-ARG r=3.6.1-COPY ci/conda_env_r.yml /arrow/ci/-RUN conda install -q \- --file arrow/ci/conda_env_r.yml \- r-base=$r \- nomkl && \- conda clean --all--# Ensure parallel compilation of of C/C++ code-RUN echo "MAKEFLAGS=-j$(R -s -e 'cat(parallel::detectCores())')" >> $CONDA_PREFIX/lib/R/etc/Makeconf--ENV ARROW_BUILD_STATIC=OFF \- ARROW_BUILD_TESTS=OFF \- ARROW_BUILD_UTILITIES=OFF \- ARROW_DEPENDENCY_SOURCE=SYSTEM \- ARROW_FLIGHT=OFF \- ARROW_GANDIVA=OFF \- ARROW_NO_DEPRECATED_API=ON \- ARROW_ORC=OFF \- ARROW_PARQUET=ON \- ARROW_PLASMA=OFF \- ARROW_USE_CCACHE=ON \- ARROW_USE_GLOG=OFF \- LC_ALL=en_US.UTF-8diff --git a/dev/archery/archery/tests/test_docker.py b/dev/archery/archery/tests/test_docker.pyindex 73e7f66120..2ed0c9dd94 100644--- a/dev/archery/archery/tests/test_docker.py+++ b/dev/archery/archery/tests/test_docker.py@@ -122,7 +122,6 @@ x-hierarchy:- conda-python:- conda-python-pandas- conda-python-dask- - conda-r- ubuntu-cpp:- ubuntu-cpp-cmake32- ubuntu-c-glib:@@ -138,8 +137,6 @@ services:image: dummyconda-python-dask:image: dummy- conda-r:- image: dummyubuntu-cpp:image: dummyubuntu-cpp-cmake32:@@ -529,7 +526,6 @@ def test_listing_images(arrow_compose_path):'conda-python','conda-python-dask','conda-python-pandas',- 'conda-r','ubuntu-c-glib','ubuntu-cpp','ubuntu-cpp-cmake32',diff --git a/dev/tasks/conda-recipes/.ci_support/r/linux_64_r_base3.6.yaml b/dev/tasks/conda-recipes/.ci_support/r/linux_64_r_base3.6.yamlnew file mode 100644index 0000000000..ac945ce72d--- /dev/null+++ b/dev/tasks/conda-recipes/.ci_support/r/linux_64_r_base3.6.yaml@@ -0,0 +1,22 @@+c_compiler:+- gcc+c_compiler_version:+- '7'+channel_sources:+- conda-forge,defaults+channel_targets:+- conda-forge main+cxx_compiler:+- gxx+cxx_compiler_version:+- '7'+docker_image:+- condaforge/linux-anvil-comp7+pin_run_as_build:+ r-base:+ min_pin: x.x+ max_pin: x.x+r_base:+- '3.6'+target_platform:+- linux-64diff --git a/dev/tasks/conda-recipes/.ci_support/r/linux_64_r_base4.0.yaml b/dev/tasks/conda-recipes/.ci_support/r/linux_64_r_base4.0.yamlnew file mode 100644index 0000000000..51d26f834c--- /dev/null+++ b/dev/tasks/conda-recipes/.ci_support/r/linux_64_r_base4.0.yaml@@ -0,0 +1,22 @@+c_compiler:+- gcc+c_compiler_version:+- '7'+channel_sources:+- conda-forge,defaults+channel_targets:+- conda-forge main+cxx_compiler:+- gxx+cxx_compiler_version:+- '7'+docker_image:+- condaforge/linux-anvil-comp7+pin_run_as_build:+ r-base:+ min_pin: x.x+ max_pin: x.x+r_base:+- '4.0'+target_platform:+- linux-64diff --git a/dev/tasks/conda-recipes/.ci_support/r/osx_64_r_base3.6.yaml b/dev/tasks/conda-recipes/.ci_support/r/osx_64_r_base3.6.yamlnew file mode 100644index 0000000000..e3c5b898be--- /dev/null+++ b/dev/tasks/conda-recipes/.ci_support/r/osx_64_r_base3.6.yaml@@ -0,0 +1,26 @@+MACOSX_DEPLOYMENT_TARGET:+- '10.9'+c_compiler:+- clang+c_compiler_version:+- '10'+channel_sources:+- conda-forge,defaults+channel_targets:+- conda-forge main+cxx_compiler:+- clangxx+cxx_compiler_version:+- '10'+macos_machine:+- x86_64-apple-darwin13.4.0+macos_min_version:+- '10.9'+pin_run_as_build:+ r-base:+ min_pin: x.x+ max_pin: x.x+r_base:+- '3.6'+target_platform:+- osx-64diff --git a/dev/tasks/conda-recipes/.ci_support/r/osx_64_r_base4.0.yaml b/dev/tasks/conda-recipes/.ci_support/r/osx_64_r_base4.0.yamlnew file mode 100644index 0000000000..8343a284b9--- /dev/null+++ b/dev/tasks/conda-recipes/.ci_support/r/osx_64_r_base4.0.yaml@@ -0,0 +1,26 @@+MACOSX_DEPLOYMENT_TARGET:+- '10.9'+c_compiler:+- clang+c_compiler_version:+- '10'+channel_sources:+- conda-forge,defaults+channel_targets:+- conda-forge main+cxx_compiler:+- clangxx+cxx_compiler_version:+- '10'+macos_machine:+- x86_64-apple-darwin13.4.0+macos_min_version:+- '10.9'+pin_run_as_build:+ r-base:+ min_pin: x.x+ max_pin: x.x+r_base:+- '4.0'+target_platform:+- osx-64diff --git a/dev/tasks/conda-recipes/.ci_support/r/win_64_r_base3.6.yaml b/dev/tasks/conda-recipes/.ci_support/r/win_64_r_base3.6.yamlnew file mode 100644index 0000000000..3fb7f88499--- /dev/null+++ b/dev/tasks/conda-recipes/.ci_support/r/win_64_r_base3.6.yaml@@ -0,0 +1,12 @@+channel_sources:+- conda-forge,defaults+channel_targets:+- conda-forge main+pin_run_as_build:+ r-base:+ min_pin: x.x+ max_pin: x.x+r_base:+- '3.6'+target_platform:+- win-64diff --git a/dev/tasks/conda-recipes/.ci_support/r/win_64_r_base4.0.yaml b/dev/tasks/conda-recipes/.ci_support/r/win_64_r_base4.0.yamlnew file mode 100644index 0000000000..02c2a70756--- /dev/null+++ b/dev/tasks/conda-recipes/.ci_support/r/win_64_r_base4.0.yaml@@ -0,0 +1,12 @@+channel_sources:+- conda-forge,defaults+channel_targets:+- conda-forge main+pin_run_as_build:+ r-base:+ min_pin: x.x+ max_pin: x.x+r_base:+- '4.0'+target_platform:+- win-64diff --git a/dev/tasks/conda-recipes/azure.linux.yml b/dev/tasks/conda-recipes/azure.linux.ymlindex 05bee14424..3ab9504dbb 100755--- a/dev/tasks/conda-recipes/azure.linux.yml+++ b/dev/tasks/conda-recipes/azure.linux.yml@@ -6,6 +6,7 @@ jobs:variables:CONFIG: {{ config }}+ R_CONFIG: {{ r_config|default("") }}ARROW_VERSION: {{ arrow.no_rc_version }}UPLOAD_PACKAGES: Falsediff --git a/dev/tasks/conda-recipes/azure.osx.yml b/dev/tasks/conda-recipes/azure.osx.ymlindex e7b1b85fdc..3251754d2d 100755--- a/dev/tasks/conda-recipes/azure.osx.yml+++ b/dev/tasks/conda-recipes/azure.osx.yml@@ -5,6 +5,7 @@ jobs:timeoutInMinutes: 360variables:CONFIG: {{ config }}+ R_CONFIG: {{ r_config|default("") }}ARROW_VERSION: {{ arrow.no_rc_version }}UPLOAD_PACKAGES: Falsesteps:@@ -65,6 +66,12 @@ jobs:-m ./.ci_support/${CONFIG}.yaml \--clobber-file ./.ci_support/clobber_${CONFIG}.yaml \--output-folder ./build_artifacts++ if [ ! -z "${R_CONFIG}" ]; then+ conda build r-arrow \+ -m ./.ci_support/r/${R_CONFIG}.yaml \+ --output-folder ./build_artifacts+ fiworkingDirectory: arrow/dev/tasks/conda-recipesdisplayName: Build recipesdiff --git a/dev/tasks/conda-recipes/azure.win.yml b/dev/tasks/conda-recipes/azure.win.ymlindex f7f3708ca2..efa27ed358 100755--- a/dev/tasks/conda-recipes/azure.win.yml+++ b/dev/tasks/conda-recipes/azure.win.yml@@ -5,6 +5,7 @@ jobs:timeoutInMinutes: 360variables:CONFIG: {{ config }}+ R_CONFIG: {{ r_config|default("") }}ARROW_VERSION: {{ arrow.no_rc_version }}CONDA_BLD_PATH: D:\\bld\\UPLOAD_PACKAGES: False@@ -66,6 +67,14 @@ jobs:PYTHONUNBUFFERED: 1condition: not(contains(variables['CONFIG'], 'vs2008'))+ - script: |+ conda.exe build r-arrow -m .ci_support\r\%R_CONFIG%.yaml+ displayName: Build recipe+ workingDirectory: arrow\dev\tasks\conda-recipes+ env:+ PYTHONUNBUFFERED: 1+ condition: contains(variables['R_CONFIG'], 'win')+# Using github release tries to find a common ancestor between the# currently pushed tag and the latest tag of the github repository# (don't know why).diff --git a/dev/tasks/conda-recipes/build_steps.sh b/dev/tasks/conda-recipes/build_steps.shindex a18f97290b..a19a3124ea 100755--- a/dev/tasks/conda-recipes/build_steps.sh+++ b/dev/tasks/conda-recipes/build_steps.sh@@ -40,4 +40,12 @@ conda build \--clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" \--output-folder "${output_dir}"+if [ ! -z "${R_CONFIG}" ]; then+ conda build \+ "${FEEDSTOCK_ROOT}/r-arrow" \+ -m "${CI_SUPPORT}/r/${R_CONFIG}.yaml" \+ --output-folder "${output_dir}"+fi++touch "${output_dir}/conda-forge-build-done-${CONFIG}"diff --git a/dev/tasks/conda-recipes/r-arrow/bld.bat b/dev/tasks/conda-recipes/r-arrow/bld.batnew file mode 100644index 0000000000..a193ddc0a7--- /dev/null+++ b/dev/tasks/conda-recipes/r-arrow/bld.bat@@ -0,0 +1,9 @@+bash %RECIPE_DIR%/build_win.sh+IF %ERRORLEVEL% NEQ 0 exit 1+cp %RECIPE_DIR%/configure.win r+IF %ERRORLEVEL% NEQ 0 exit 1+cp %RECIPE_DIR%/install.libs.R r/src+IF %ERRORLEVEL% NEQ 0 exit 1+set "MAKEFLAGS=-j%CPU_COUNT%"+"%R%" CMD INSTALL --build r+IF %ERRORLEVEL% NEQ 0 exit 1diff --git a/dev/tasks/conda-recipes/r-arrow/build.sh b/dev/tasks/conda-recipes/r-arrow/build.shnew file mode 100644index 0000000000..0a6c7961fc--- /dev/null+++ b/dev/tasks/conda-recipes/r-arrow/build.sh@@ -0,0 +1,3 @@+#!/bin/bash+export DISABLE_AUTOBREW=1+$R CMD INSTALL --build r/.diff --git a/dev/tasks/conda-recipes/r-arrow/build_win.sh b/dev/tasks/conda-recipes/r-arrow/build_win.shnew file mode 100755index 0000000000..88e0462f66--- /dev/null+++ b/dev/tasks/conda-recipes/r-arrow/build_win.sh@@ -0,0 +1,8 @@+#!/bin/bash++set -exuo pipefail+++# Rename arrow.dll to lib_arrow.dll to avoid conflicts with the arrow-cpp arrow.dll+sed -i -e 's/void R_init_arrow/__declspec(dllexport) void R_init_lib_arrow/g' r/src/arrowExports.cpp+sed -i -e 's/useDynLib(arrow/useDynLib(lib_arrow/g' r/NAMESPACEdiff --git a/dev/tasks/conda-recipes/r-arrow/configure.win b/dev/tasks/conda-recipes/r-arrow/configure.winnew file mode 100755index 0000000000..3a6ea90f27--- /dev/null+++ b/dev/tasks/conda-recipes/r-arrow/configure.win@@ -0,0 +1,8 @@+#!/bin/bash++set -euxo pipefail++echo "PKG_CPPFLAGS=-DNDEBUG -I\"${LIBRARY_PREFIX}/include\" -I\"${PREFIX}/include\" -DARROW_R_WITH_ARROW -DARROW_R_WITH_S3" > src/Makevars.win+echo "PKG_CXXFLAGS=\$(CXX_VISIBILITY)" >> src/Makevars.win+echo 'CXX_STD=CXX11' >> src/Makevars.win+echo "PKG_LIBS=-L\"${LIBRARY_PREFIX}/lib\" -larrow_dataset -lparquet -larrow" >> src/Makevars.windiff --git a/dev/tasks/conda-recipes/r-arrow/install.libs.R b/dev/tasks/conda-recipes/r-arrow/install.libs.Rnew file mode 100644index 0000000000..005bbe16b9--- /dev/null+++ b/dev/tasks/conda-recipes/r-arrow/install.libs.R@@ -0,0 +1,5 @@+src_dir <- file.path(R_PACKAGE_SOURCE, "src", fsep = "/")+dest_dir <- file.path(R_PACKAGE_DIR, paste0("libs", R_ARCH), fsep="/")++dir.create(file.path(R_PACKAGE_DIR, paste0("libs", R_ARCH), fsep="/"), recursive = TRUE, showWarnings = FALSE)+file.copy(file.path(src_dir, "arrow.dll", fsep = "/"), file.path(dest_dir, "lib_arrow.dll", fsep = "/"))diff --git a/dev/tasks/conda-recipes/r-arrow/meta.yaml b/dev/tasks/conda-recipes/r-arrow/meta.yamlnew file mode 100644index 0000000000..5f0643bef3--- /dev/null+++ b/dev/tasks/conda-recipes/r-arrow/meta.yaml@@ -0,0 +1,66 @@+{% set version = ARROW_VERSION %}+{% set posix = 'm2-' if win else '' %}+{% set native = 'm2w64-' if win else '' %}++package:+ name: r-arrow+ version: {{ version|replace("-", "_") }}++source:+ path: ../../../../++build:+ merge_build_host: true # [win]+ number: 0+ rpaths:+ - lib/R/lib/+ - lib/++requirements:+ build:+ - {{ compiler('c') }} # [not win]+ - {{ compiler('cxx') }} # [not win]+ - {{ compiler('r_clang') }} # [win]+ - pkg-config # [not win]+ - {{ posix }}make+ - {{ posix }}sed # [win]+ - {{ posix }}coreutils # [win]+ - {{ posix }}filesystem # [win]+ - {{ posix }}zip # [win]+ host:+ # Needs to be here, otherwise merge_build_host runs into issues+ - pkg-config # [win]+ - r-base+ - arrow-cpp {{ version }}+ - r-cpp11+ - r-r6+ - r-assertthat+ - r-bit64+ - r-purrr+ - r-rlang+ - r-tidyselect+ run:+ - r-base+ - r-r6+ - r-assertthat+ - r-bit64+ - r-purrr+ - r-rlang+ - r-tidyselect++test:+ commands:+ - $R -e "library('arrow')" # [not win]+ - "\"%R%\" -e \"library('arrow'); data(mtcars); write_parquet(mtcars, 'test.parquet')\"" # [win]++about:+ home: https://github.com/apache/arrow+ license: Apache-2.0+ license_file: LICENSE.txt+ summary: R Integration to 'Apache' 'Arrow'.+ license_family: APACHE++extra:+ recipe-maintainers:+ - conda-forge/r+ - conda-forge/arrow-cppdiff --git a/dev/tasks/conda-recipes/run_docker_build.sh b/dev/tasks/conda-recipes/run_docker_build.shindex d728d07e16..8a90037948 100755--- a/dev/tasks/conda-recipes/run_docker_build.sh+++ b/dev/tasks/conda-recipes/run_docker_build.sh@@ -61,6 +61,7 @@ docker run ${DOCKER_RUN_ARGS} \-v "${build_dir}":/build:rw \-e FEEDSTOCK_ROOT="/arrow/dev/tasks/conda-recipes" \-e CONFIG \+ -e R_CONFIG \-e HOST_USER_ID \-e UPLOAD_PACKAGES \-e ARROW_VERSION \diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.ymlindex 9cda368d86..9acf6b239d 100644--- a/dev/tasks/tasks.yml+++ b/dev/tasks/tasks.yml@@ -133,11 +133,24 @@ tasks:ci: azuretemplate: conda-recipes/azure.clean.yml+ # Important notes on the conda setup here:+ #+ # * On conda-forge the `pyarrow` and `arrow-cpp` packages are built in+ # the same feedstock as the dependency matrix is the same for them as+ # Python and the OS are the main dimension. The R package `r-arrow` is+ # an independent feedstock as it doesn't have the Python but the+ # R dimension. To limit the number of CI jobs, we are building `r-arrow`+ # for R 3.6 with the Python 3.6 jobs and for R 4.0 with the Python 3.7 jobs.+ # * The files in `dev/tasks/conda-recipes/.ci_support/` are automatically+ # generated and to be synced regularly from the feedstock. We have no way+ # yet to generate them inside the arrow repository automatically.+conda-linux-gcc-py36-cpu:ci: azuretemplate: conda-recipes/azure.linux.ymlparams:config: linux_cuda_compiler_versionNonepython3.6.____cpython+ r_config: linux_64_r_base3.6artifacts:- arrow-cpp-{no_rc_version}-py36(h[a-z0-9]+)_0_cpu.tar.bz2- pyarrow-{no_rc_version}-py36(h[a-z0-9]+)_0_cpu.tar.bz2@@ -147,6 +160,7 @@ tasks:template: conda-recipes/azure.linux.ymlparams:config: linux_cuda_compiler_versionNonepython3.7.____cpython+ r_config: linux_64_r_base4.0artifacts:- arrow-cpp-{no_rc_version}-py37(h[a-z0-9]+)_0_cpu.tar.bz2- pyarrow-{no_rc_version}-py37(h[a-z0-9]+)_0_cpu.tar.bz2@@ -221,6 +235,7 @@ tasks:template: conda-recipes/azure.osx.ymlparams:config: osx_python3.6.____cpython+ r_config: osx_64_r_base3.6artifacts:- arrow-cpp-{no_rc_version}-py36(h[a-z0-9]+)_0_cpu.tar.bz2- pyarrow-{no_rc_version}-py36(h[a-z0-9]+)_0_cpu.tar.bz2@@ -230,6 +245,7 @@ tasks:template: conda-recipes/azure.osx.ymlparams:config: osx_python3.7.____cpython+ r_config: osx_64_r_base4.0artifacts:- arrow-cpp-{no_rc_version}-py37(h[a-z0-9]+)_0_cpu.tar.bz2- pyarrow-{no_rc_version}-py37(h[a-z0-9]+)_0_cpu.tar.bz2@@ -250,6 +266,7 @@ tasks:template: conda-recipes/azure.win.ymlparams:config: win_python3.6.____cpython+ r_config: win_64_r_base3.6artifacts:- arrow-cpp-{no_rc_version}-py36(h[a-z0-9]+)_0_cpu.tar.bz2- pyarrow-{no_rc_version}-py36(h[a-z0-9]+)_0_cpu.tar.bz2@@ -259,6 +276,7 @@ tasks:template: conda-recipes/azure.win.ymlparams:config: win_python3.7.____cpython+ r_config: win_64_r_base4.0artifacts:- arrow-cpp-{no_rc_version}-py37(h[a-z0-9]+)_0_cpu.tar.bz2- pyarrow-{no_rc_version}-py37(h[a-z0-9]+)_0_cpu.tar.bz2@@ -1796,14 +1814,6 @@ tasks:r_tag: 3.6-opensuse42not_cran: "TRUE"- test-conda-r-4.0:- ci: github- template: docker-tests/github.linux.yml- params:- env:- R: 4.0- run: conda-r-test-ubuntu-18.04-r-sanitizer:ci: azuretemplate: docker-tests/azure.linux.ymldiff --git a/docker-compose.yml b/docker-compose.ymlindex d130ebcf42..195fc0104d 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -94,7 +94,6 @@ x-hierarchy:- conda-python-turbodbc- conda-python-kartothek- conda-python-spark- - conda-r- debian-cpp:- debian-c-glib:- debian-ruby@@ -824,30 +823,6 @@ services:################################## R ########################################- conda-r:- # Usage:- # docker-compose build conda-cpp- # docker-compose build conda-r- # docker-compose run conda-r- image: ${REPO}:${ARCH}-conda-r-${R}- build:- context: .- dockerfile: ci/docker/conda-r.dockerfile- cache_from:- - ${REPO}:${ARCH}-conda-r-${R}- args:- repo: ${REPO}- arch: ${ARCH}- r: ${R}- shm_size: *shm-size- environment:- <<: *ccache- NOT_CRAN: 'true'- volumes: *conda-volumes- command:- ["/arrow/ci/scripts/cpp_build.sh /arrow /build &&- /arrow/ci/scripts/r_test.sh /arrow"]-ubuntu-r:# Usage:# docker-compose build ubuntu-cpp