Fix fpm installation on openSUSE 15.4; switch to nfpm

fpm currently fails to install because the public_suffix gem dependency
requires Ruby 2.6, which openSUSE 15.4 doesn't provide. Because there have
been so many Ruby dependency issues with fpm in the past, switch to the fewer-
dependency nfpm, which also has better support for code signing if we want to
do that in the future.
This commit is contained in:
Greg Lin 2022-08-22 18:52:05 -05:00
commit a245fc65d9
2 changed files with 60 additions and 51 deletions

View file

@ -40,8 +40,6 @@ RUN zypper --non-interactive --gpg-auto-import-keys -n install \
perl-macros \ perl-macros \
readline-devel \ readline-devel \
rpm-build \ rpm-build \
ruby \
ruby-devel \
shadow \ shadow \
tcl-devel \ tcl-devel \
texinfo \ texinfo \
@ -74,8 +72,9 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2
./aws/install && \ ./aws/install && \
rm -rf aws awscliv2.zip rm -rf aws awscliv2.zip
RUN gem install fpm && \ RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
ln -s /usr/bin/fpm.ruby2.5 /usr/local/bin/fpm zypper --non-interactive --no-gpg-checks install nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN chmod 0777 /opt RUN chmod 0777 /opt

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [[ ! -d /tmp/output/opensuse-154 ]]; then if [[ ! -d /tmp/output/${OS_IDENTIFIER} ]]; then
mkdir -p /tmp/output/opensuse-154 mkdir -p "/tmp/output/${OS_IDENTIFIER}"
fi fi
# R 3.x requires PCRE1 # R 3.x requires PCRE1
@ -39,49 +39,59 @@ if [ -d /opt/R/${R_VERSION} ]; then
fi fi
EOF EOF
fpm \ cat <<EOF > /tmp/nfpm.yml
-s dir \ name: R-${R_VERSION}
-t rpm \ version: 1
-v 1 \ version_schema: none
-n "R-${R_VERSION}" \ release: 1
--vendor "RStudio, PBC" \ maintainer: RStudio, PBC <https://github.com/rstudio/r-builds>
--url "http://www.r-project.org/" \ description: |
--description "GNU R statistical computation and graphics system" \ GNU R statistical computation and graphics system
--maintainer "RStudio, PBC <https://github.com/rstudio/r-builds>" \ vendor: RStudio, PBC
--license "GPLv2" \ homepage: https://www.r-project.org
--after-install /post-install.sh \ license: GPLv2+
--after-remove /after-remove.sh \ depends:
-p /tmp/output/opensuse-154/ \ - fontconfig
-d fontconfig \ - gcc
-d gcc \ - gcc-c++
-d gcc-c++ \ - gcc-fortran
-d gcc-fortran \ - glibc-locale
-d glibc-locale \ - gzip
-d gzip \ - icu.691-devel
-d icu.691-devel \ - libbz2-devel
-d libbz2-devel \ - libcairo2
-d libcairo2 \ - libcurl-devel
-d libcurl-devel \ - libfreetype6
-d libfreetype6 \ - libgomp1
-d libgomp1 \ - libjpeg62
-d libjpeg62 \ - libopenblas_pthreads-devel
-d libopenblas_pthreads-devel \ - libpango-1_0-0
-d libpango-1_0-0 \ - libreadline7
-d libreadline7 \ - libtiff5
-d libtiff5 \ - make
-d make \ - ${pcre_lib}
-d ${pcre_lib} \ - tar
-d tar \ - tcl
-d tcl \ - tk
-d tk \ - unzip
-d unzip \ - which
-d which \ - xorg-x11
-d xorg-x11 \ - xorg-x11-fonts-100dpi
-d xorg-x11-fonts-100dpi \ - xorg-x11-fonts-75dpi
-d xorg-x11-fonts-75dpi \ - xz-devel
-d xz-devel \ - zip
-d zip \ - zlib-devel
-d zlib-devel \ contents:
"/opt/R/${R_VERSION}" - src: /opt/R/${R_VERSION}
dst: /opt/R/${R_VERSION}
scripts:
postinstall: /post-install.sh
postremove: /after-remove.sh
EOF
export PKG_FILE=$(ls /tmp/output/opensuse-154/R-${R_VERSION}*.rpm | head -1) nfpm package \
-f /tmp/nfpm.yml \
-p rpm \
-t "/tmp/output/${OS_IDENTIFIER}"
export PKG_FILE=$(ls /tmp/output/${OS_IDENTIFIER}/R-${R_VERSION}*.rpm | head -1)