| 1 | # Wedge definition for R libraries
 | 
| 2 | #
 | 
| 3 | # Loaded by deps/wedge.sh.
 | 
| 4 | 
 | 
| 5 | set -o nounset
 | 
| 6 | set -o pipefail
 | 
| 7 | set -o errexit
 | 
| 8 | 
 | 
| 9 | # sourced
 | 
| 10 | WEDGE_NAME='R-libs'
 | 
| 11 | WEDGE_VERSION='2023-04-18'
 | 
| 12 | 
 | 
| 13 | # We are installing into /home/wedge-makeer, and we want to use it from
 | 
| 14 | # /home/andy or /home/uke
 | 
| 15 | #
 | 
| 16 | # WEDGE_IS_ABSOLUTE=1
 | 
| 17 | 
 | 
| 18 | # R hits the network
 | 
| 19 | WEDGE_LEAKY_BUILD=1
 | 
| 20 | 
 | 
| 21 | # Notes: dplyr 1.0.3 as of January 2021 made these fail on Xenial.  
 | 
| 22 | # I did an R 4.0 installation.  See build/py.sh install-new-R
 | 
| 23 | #
 | 
| 24 | # February 2023: compile errors with dplyr and Ubuntu 18.04, which has R 3.4.4.
 | 
| 25 | # tidyverse has minimum R of 3.6.
 | 
| 26 | # I need to install a new R again.
 | 
| 27 | 
 | 
| 28 | wedge-make() {
 | 
| 29 |   echo 'No make step'
 | 
| 30 | 
 | 
| 31 | }
 | 
| 32 | 
 | 
| 33 | wedge-install() {
 | 
| 34 |   local build_dir=$1
 | 
| 35 |   local install_dir=$2
 | 
| 36 | 
 | 
| 37 |   # 2024-02 - weird fix, I had to add "rlang" on Debian Bookworm.  Otherwise
 | 
| 38 |   # the smoke test for dplyr/tidyr would fail.
 | 
| 39 | 
 | 
| 40 |   echo
 | 
| 41 |   echo '*** INFO: Rscript --version ***'
 | 
| 42 |   echo
 | 
| 43 |   Rscript --version
 | 
| 44 |   echo
 | 
| 45 | 
 | 
| 46 |   # Gah!  This "devtools" has a shitload of deps itself ... sad
 | 
| 47 |   # #
 | 
| 48 |   # https://support.posit.co/hc/en-us/articles/219949047-Installing-older-versions-of-packages
 | 
| 49 |   if false; then
 | 
| 50 |     INSTALL_DEST=$install_dir Rscript -e \
 | 
| 51 |         'install.packages(c("devtools"), lib=Sys.getenv("INSTALL_DEST"), repos="https://cloud.r-project.org")'
 | 
| 52 |   fi
 | 
| 53 | 
 | 
| 54 |   # Also consider adding ggplot.
 | 
| 55 |   if true; then
 | 
| 56 |     INSTALL_DEST=$install_dir Rscript -e \
 | 
| 57 |       'install.packages(c("rlang", "dplyr", "tidyr", "stringr", "RUnit"), lib=Sys.getenv("INSTALL_DEST"), repos="https://cloud.r-project.org")'
 | 
| 58 |   fi
 | 
| 59 | }
 | 
| 60 | 
 | 
| 61 | wedge-smoke-test() {
 | 
| 62 |   local install_dir=$1
 | 
| 63 | 
 | 
| 64 |   R_LIBS_USER=$install_dir Rscript -e \
 | 
| 65 |     'library(rlang); library(dplyr); library(tidyr); library(stringr); library("RUnit"); print("OK")'
 | 
| 66 | }
 |