From 60474b593b219d6c0889087028be45cb2dc01de0 Mon Sep 17 00:00:00 2001 From: sellorm Date: Tue, 6 Aug 2019 23:17:45 +0100 Subject: [PATCH] Enables output of Linux OS packages for CentOS 7 (#20) * Enables output of Linux OS packages for CentOS 7 * Changed vendor to RStudio * Added post install script to swap in openBLAS shared library * tidied up some dependencies * Added a post remove step to cleanup install dir As we swap in the openBlas shared object file during installation the RPM database knows that the RPM installation has been "interefered" with. Because of this `yum remove` does not clean out the full directory tree. This update therefore prunes the directory tree at /opt/R/R_VERSION --- builder/Dockerfile.centos-7 | 6 ++++ builder/package.centos-7 | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 builder/package.centos-7 diff --git a/builder/Dockerfile.centos-7 b/builder/Dockerfile.centos-7 index 8bae7a8..914283f 100644 --- a/builder/Dockerfile.centos-7 +++ b/builder/Dockerfile.centos-7 @@ -30,6 +30,9 @@ RUN yum -y update \ pcre-devel \ pcre2-devel \ readline-devel \ + rpm-build \ + ruby \ + ruby-devel \ tcl-devel \ tex \ texinfo-tex \ @@ -50,6 +53,8 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ RUN pip install awscli --upgrade --user && \ ln -s /root/.local/bin/aws /usr/bin/aws +RUN gem install fpm + RUN chmod 0777 /opt # Configure flags for CentOS 7 that don't use the defaults in build.sh @@ -66,5 +71,6 @@ ENV CONFIGURE_OPTIONS="\ # RHEL 7 doesn't have the inconsolata font, so override the defaults. ENV R_RD4PDF="times,hyper" +COPY package.centos-7 /package.sh COPY build.sh . ENTRYPOINT ./build.sh diff --git a/builder/package.centos-7 b/builder/package.centos-7 new file mode 100644 index 0000000..e685476 --- /dev/null +++ b/builder/package.centos-7 @@ -0,0 +1,59 @@ +if [[ ! -d /tmp/output/centos-7 ]]; then + mkdir -p /tmp/output/centos-7 +fi + +# create post-install script required for openblas +cat <> /post-install.sh +mv /opt/R/${R_VERSION}/lib/R/lib/libRblas.so /opt/R/${R_VERSION}/lib/R/lib/libRblas.so.keep +ln -s /usr/lib64/libopenblasp.so /opt/R/${R_VERSION}/lib/R/lib/libRblas.so +EOF + +# create after-remove script to remove internal blas +cat <> /before-remove.sh +if [ -d /opt/R/${R_VERSION} ]; then + rm -r /opt/R/${R_VERSION} +fi +EOF + +fpm \ + -s dir \ + -t rpm \ + -v 1 \ + -n R-${R_VERSION} \ + --vendor "RStudio Inc." \ + --deb-priority "optional" \ + --deb-field 'Bugs: https://github.com/rstudio/r-builds/issues' \ + --url "http://www.r-project.org/" \ + --description "GNU R statistical computation and graphics system" \ + --maintainer "RStudio Inc https://github.com/rstudio/r-builds" \ + --license "GPL-2" \ + --after-install /post-install.sh \ + --after-remove /before-remove.sh \ + -p /tmp/output/centos-7/ \ + -d bzip2-devel \ + -d gcc \ + -d gcc-c++ \ + -d gcc-gfortran \ + -d libcurl-devel \ + -d libicu-devel \ + -d libSM \ + -d libtiff \ + -d libXmu \ + -d libXt \ + -d make \ + -d openblas-devel \ + -d pango \ + -d pcre-devel \ + -d pcre2-devel \ + -d perl-Digest-MD5 \ + -d tcl \ + -d tk \ + -d tre \ + -d which \ + -d xz-devel \ + -d zlib-devel \ + /opt/R/${R_VERSION} + +shopt -s extglob +export PKG_FILE=$(ls /tmp/output/centos-7/[rR]-${R_VERSION}*.@(deb|rpm) | head -1) +