rang icon indicating copy to clipboard operation
rang copied to clipboard

Support R older than 1.3.1

Open chainsawriot opened this issue 3 years ago • 14 comments

There were changes but R older than 2.5 were really different, e.g. no seq_along; versions older than 1.9 can't even use snake case.

A even safer approach is to use bash to wget and R CMD INSTALL instead. I can only install source package in R 1.3.1 this way.

chainsawriot avatar Feb 02 '23 09:02 chainsawriot

For the time being:

utils::compareVersion(granlist$r_version, "3.1") == -1

Stop dockerize (No Rocker Image)

utils::compareVersion(granlist$r_version, "2.5") == -1

Stop export_granlist (saying not tested)

chainsawriot avatar Feb 03 '23 10:02 chainsawriot

All the functions in header.R and footer.R:

snake case: R 1.9.0 paste0: R 2.15.0 (Should be replaced by paste0(..., sep = "")) tempdir: R 1.6.0 supressWarnings: R 1.8.0 tryCatch: R 1.8.0 seq_along: R 2.4.0 (Should be replaced by a check and then 1:length(install_order))

All other functions should be safe. Maybe minimum version of R 1.8.0 should be declared as the tryCatch block is needed.

Also, state somehwhere that the generated installation script might not look idiomatic now.

chainsawriot avatar Feb 05 '23 14:02 chainsawriot

However, if #17 is implemented, it is safe to go older than R 1.8.0.

chainsawriot avatar Feb 05 '23 14:02 chainsawriot

install.packages can only be used to install source packages since R 2.1.0.

verbose and quiet were introduced since R 3.0.0.

chainsawriot avatar Feb 05 '23 14:02 chainsawriot

It is safer to say the current export_granlist can support up to R 2.1.0; can keep the snake case too, but need to fix paste0 and seq_along. Ignore verbose and quiet. And test.

For older versions, shell script approach should be used.

This can be cited: https://www.r-project.org/doc/Rnews/Rnews_2005-1.pdf

Ripley, B. (2005) Packages and their Management in R 2.1.0. R News

chainsawriot avatar Feb 05 '23 15:02 chainsawriot

Debian Etch / Lenny can be used to compile R 2.1 to R 3.0.

chainsawriot avatar Feb 05 '23 15:02 chainsawriot

Proposed Dockerfile for R < 3.1.0.

R-2 and R-2.13.0 need to be changeable.

FROM debian/eol:lenny
ENV TZ UTC

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && apt-get update -qq && apt-get install wget locales build-essential r-base-dev  -y

RUN wget http://cran.r-project.org/src/base/R-2/R-2.13.0.tar.gz \
    && tar -zxf R-2.13.0.tar.gz \
    && cd R-2.13.0 \
    && ./configure --without-x ; make \
    && make install

COPY gran.R ./gran.R
RUN Rscript gran.R
CMD ["R"]

chainsawriot avatar Feb 05 '23 21:02 chainsawriot

ah dar...

#17 dir.exists is only available since 3.2.0.

chainsawriot avatar Feb 06 '23 18:02 chainsawriot

TODOs

  • [x] eschew all snake cases in inst/header.R and inst/footer.R
  • [x] Check for R version and use R CMD if R version is older than 2.1
  • [x] Test, test, test
  • [x] Check the oldest version of R that can be compiled/installed with Lenny.

chainsawriot avatar Feb 16 '23 12:02 chainsawriot

lenny = 1.8.0

Update: actually 1.6.0 / 1.5.0 / 1.4.0 / 1.3.1 work; only 1.7.x series doesn't work.

There should be an option like "skip_r1.7 = TRUE"

Will use 1.3.1 as the reference version to write header and footer

chainsawriot avatar Mar 05 '23 10:03 chainsawriot

etch doesn't have libcurl4-openssl-dev, should drop.

chainsawriot avatar Mar 05 '23 10:03 chainsawriot

R 1.3.1 doesn't even have compareVersion. Maybe a better approach for <= R 2.1 is to use pure bash (which doesn't sound too bad).

chainsawriot avatar Mar 05 '23 14:03 chainsawriot

The issue is for supporting 1.3.0 or below is the compilation fails on Lenny.

chainsawriot avatar Mar 07 '23 09:03 chainsawriot

#165

chainsawriot avatar Oct 31 '23 14:10 chainsawriot