Fixes #20613. Support R 4.0

This commit is contained in:
Andrea Dell'Amico 2021-03-02 11:27:16 +01:00
parent c4d7ac457e
commit e1af001711
5 changed files with 43 additions and 10 deletions

View File

@ -11,6 +11,11 @@ The most important variables are listed below:
``` yaml
# Set to True if you want install from the CRAN deb repository
r_install_cran_repo: False
# Use 'cran35' for R 3.6
r_cran_repo_version: 'cran40'
r_cran_repo_url: 'https://cloud.r-project.org/bin/linux/ubuntu {{ ansible_distribution_release }}-{{ r_cran_repo_version }}/'
# Use 'marutter/c2d4u3.5' for R 3.6
r_cran_ubuntu_packages_ppa: 'ppa:marutter/c2d4u'
#r_cran_mirror_site: http://cran.rstudio.com
r_cran_set_default_mirror: True
r_cran_mirror_site: https://cran.mirror.garr.it/mirrors/CRAN/

View File

@ -11,18 +11,25 @@
#
# Set to True if you want install from the CRAN deb repository
r_install_cran_repo: False
#r_cran_mirror_site: http://cran.rstudio.com
# “Michael Rutter marutter@gmail.com” with key ID 0x51716619e084dab9
# E298A3A825C0D65DFD57CBB651716619E084DAB9
r_cran_repo_apt_key: 'E298A3A825C0D65DFD57CBB651716619E084DAB9'
# Use 'cran35' for R 3.6
r_cran_repo_version: 'cran40'
r_cran_repo_url: 'https://cloud.r-project.org/bin/linux/ubuntu {{ ansible_distribution_release }}-{{ r_cran_repo_version }}/'
# Use 'marutter/c2d4u3.5' for R 3.6
r_cran_ubuntu_packages_ppa: 'ppa:marutter/c2d4u'
r_cran_set_default_mirror: True
r_cran_mirror_site: https://cran.mirror.garr.it/mirrors/CRAN/
r_base_specific_version: False
r_base_pkg_version: 3.4.4
r_base_pkg_version: 4.0.3
r_packages_main_state: present
r_packages_state: '{{ r_packages_main_state }}'
r_sitelib_path: '/usr/local/lib/R/site-library'
r_plugins_from_deb: True
r_packages_cleanup: False
#
r_packages_updater: False
r_packages_updater: True
r_package_updater_via_subversion: True
r_package_updater_subversion_repo: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RPackagesManagement/
r_packages_svn_base_dir: /srv/r_updater
@ -105,6 +112,9 @@ r_base_packages_java_dev_el:
- R-java-devel
r_distribution_required_el_packages: []
r_cran_ubuntu_packages: []
r_cran_install_from_sources: True
r_plugins_list_to_install: []
# - { name: 'R2WinBUGS', repo: '{{ r_cran_mirror_site }}' }
# - { name: 'R2jags', repo: '{{ r_cran_mirror_site }}' }

View File

@ -1,18 +1,18 @@
---
- block:
- name: Add the cran repository key
apt_key: id=E084DAB9 keyserver=keyserver.ubuntu.com state=present
apt_key: id={{ r_cran_repo_apt_key }} keyserver=keyserver.ubuntu.com state=present
tags: [ 'r_software', 'r_repo', 'r_repo_key' ]
- name: Add the CRAN repository
apt_repository: repo='deb http://cran.rstudio.com/bin/linux/ubuntu {{ ansible_distribution_release }}/' state=present update_cache=yes
apt_repository: repo='deb {{ r_cran_repo_url }}' state=present update_cache=yes
when: r_install_cran_repo
tags: [ 'r_software', 'r_repo' ]
- block:
- name: Remove the CRAN repository
apt_repository: repo='deb http://cran.rstudio.com/bin/linux/ubuntu {{ ansible_distribution_release }}/' state=absent update_cache=yes
apt_repository: repo='deb {{ r_cran_repo_url }}' state=absent update_cache=yes
when: not r_install_cran_repo
tags: [ 'r_software', 'r_repo' ]
@ -26,7 +26,7 @@
tags: [ 'r_software', 'r_pkg', 'r_pkg_hold' ]
- name: Install the R base packages.
apt: pkg={{ r_base_packages_list }} state={{ r_packages_main_state }} force=yes update_cache=yes cache_valid_time=3600
apt: pkg={{ r_base_packages_list }} state={{ r_packages_main_state }} update_cache=yes cache_valid_time=3600
- name: When we install specific R deb packages, put them on hold
shell: apt-mark hold {{ item }}

View File

@ -19,9 +19,24 @@
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_version' ]
- block:
- name: Add the Ubuntu PPA '{{ r_cran_ubuntu_packages_ppa }}'
apt_repository: repo='{{ r_cran_ubuntu_packages_ppa }}' state=present update_cache=yes
- name: Install the R plugins from the Ubuntu PPA
apt: pkg={{ r_cran_ubuntu_packages }} state=present cache_valid_time=3600
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_deb_plugins' ]
- block:
- name: Install the R devtools package from CRAN
command: >
Rscript --slave --no-save --no-restore-history -e "if (! ('devtools' %in% installed.packages()[,'Package'])) { install.packages(pkgs='devtools', repos=c('https://cloud.r-project.org/')); print('Added'); } else { print('Already installed'); }"
register: install_devtools_result
failed_when: "install_devtools_result.rc != 0 or 'had non-zero exit status' in install_devtools_result.stderr"
changed_when: "'Added' in install_devtools_result.stdout"
- name: Install R packages from the cran sources repo or from an alternative repository, latest available version.
command: >
Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages(pkgs='{{ item.name }}', repos=c('{{ item.repo | default ('https://cloud.r-project.org') }}/')); print('Added'); } else { print('Already installed'); }"
Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { require(devtools); require(methods) ; install.packages(pkgs='{{ item.name }}', repos=c('{{ item.repo | default ('https://cloud.r-project.org') }}/')); print('Added'); } else { print('Already installed'); }"
register: install_plugins_result
failed_when: "install_plugins_result.rc != 0 or 'had non-zero exit status' in install_plugins_result.stderr"
changed_when: "'Added' in install_plugins_result.stdout"
@ -35,7 +50,7 @@
- name: Install R packages from the cran sources, specific versions.
command: >
Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else if (packageVersion('{{ item.name }}') != '{{ item.version }}') { install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else { print('Already Installed'); }"
Rscript --slave --no-save --no-restore-history -e "if (! ('{{ item.name }}' %in% installed.packages()[,'Package'])) { install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else if (packageVersion('{{ item.name }}') != '{{ item.version }}') { require(devtools); require(methods) ; install.packages('{{ r_source_plugins_dest_dir }}/{{ item.source }}', repos = NULL, type='source'); print('Added'); } else { print('Already Installed'); }"
register: install_s_plugins_result
failed_when: "install_s_plugins_result.rc != 0 or 'had non-zero exit status' in install_s_plugins_result.stderr"
changed_when: '"Added" in install_s_plugins_result.stdout'
@ -62,5 +77,6 @@
with_items: '{{ r_plugins_list_to_remove | default([]) }}'
when: r_plugins_list_to_remove is defined
when: r_cran_install_from_sources
tags: [ 'r_software', 'r_pkg', 'r_plugins' ]

View File

@ -34,7 +34,9 @@
state: present
when: r_packages_updater_also_upgrades_installed_packages
when: r_packages_updater
when:
- r_cran_install_from_sources
- r_packages_updater
tags: [ 'r_software', 'r_pkg', 'r_plugins', 'r_plugins_github', 'r_cran_pkgs', 'r_github_pkgs', 'r_packages_updater' ]
- block: