[R-sig-Debian] "Debain" way of installing packages
A.J. Rossini
blindglobe at gmail.com
Sun Apr 24 17:12:12 CEST 2005
YMMV, but what I do is to install duplicates (i.e. R CMD INSTALL
places things in /usr/local/, and apt-get in /usr/), and resolve the
library I want at load time.
This has a few advantages, and the obvious disadvantage that you can
shoot yourself in the foot REALLY EASILY if you don't pay attention to
what you've got configured.
best,
-tony
On 4/24/05, Gorjanc Gregor <Gregor.Gorjanc at bfro.uni-lj.si> wrote:
> Hello!
>
> I use Debian GNU/Linux at work and I really like apt-get tool. As far as
> I understand the whole picture, there are now some Debian packages of R
> packages. Build of Debian packages is done automagically by Perl script.
>
> By the way, what is the status of Debianizing R packages? Is it stopped,
> just holded, ... I don't know so I am asking
> There is also Bioconductor and I am aware that the list of packages is
> growing quite fast and afterall I understand that there is probably to
> few people to work on Debianization.
>
> The main point of this mail is however installation. I usually first
> try to use apt-get install and if there is no Debian package I use
> R tools. However some packages that I have already installed with R tools
> might eventually appear as Debian packages, ... or I might use
> update.packages() for Debian packages. By the way is field
> 'Package-Manager: Debian' already implemented. I would check, but I
> unfortunately don't have Debain at home.
>
> I was thinking on some functions or eventually an R package r-debian,
> which would ease this installation dilemma. Actually I wrote something
> already in december but put it off. It is given bellow. It is probably
> far from optimal but it was just a proof of concept. Many more functions
> would be needed to fuzz everything up. Any comments?
>
> debian.install.packages <- function(package, ...) {
>
> # Description:
> # Installs package on Debian GNU/Linux system. For given R package it
> # tries to get Debian package and install/upgrade it with apt-get if it
> # exists. Otherwise install.packages() is used.
> # Gregor GORJANC 2004-12-30
>
> # Arguments:
> # package: R package name as character, only one
> # ...: other parameters for install.packages() or update.packages()
>
> # Examples:
> # debian.install.packages("Design")
>
> # Code:
> # apt-get update i.e. refresh list of Debian packages
> system(apt-get update)
>
> # Transform R package name to Debian package name policy i.e change R
> # package name to lowercase and test if this Debian package exists
> # (test1). This could be done without grep, but then it is not possible
> # to test on exit status, since apt-cache search always returns 0.
> packagelow <- tolower(package)
> tmp1 <- c("system(\"apt-cache search ^r- | grep")
> tmp2 <- c("| awk '{print $1}'\", intern = TRUE\)")
> tmp3 <- as.expression(paste(tmp1, packagelow, tmp2, "\n"))
> deb <- eval(parse(file = "", text = tmp3))
>
> cat("\nR package:", package, "\n")
> cat("Corresponding Debian package name:", deb, "\n")
>
> # Package install/update or upgrade in apt meaning
> if (length(deb) != 0) { # Debian package does exist
> cat("Debian package", deb, "exists: yes\n")
> cat("Proceeding with apt-get.\n")
>
> # apt-get install, which can also be used for package upgrade
> tmp1 <- c("system(\"apt-get install")
> tmp2 <- as.expression(paste(tmp1, deb, "\")", "\n"))
> eval(parse(file = "", text = tmp2))
> }
> else { # Debian package doesn't exist or something went wrong in test1
> cat("Debian package", deb, "exists: no\n")
> # cat("Proceeding with install/update.packages().\n")
> # install.update.packages(package, ...)
> cat("Proceeding with install.packages().\n")
> install.packages(package, ...)
> }
> }
>
> One more thing. Why is r-noncran-lindsey and not r-other-lindsey?
>
> --
> Lep pozdrav / With regards,
> Gregor Gorjanc
>
> ------------------------------------------------------------------------
> University of Ljubljana
> Biotechnical Faculty URI: http://www.bfro.uni-lj.si/MR/ggorjan
> Zootechnical Department email: gregor.gorjanc <at> bfro.uni-lj.si
> Groblje 3 tel: +386 (0)1 72 17 861
> SI-1230 Domzale fax: +386 (0)1 72 17 888
> Slovenia
>
> _______________________________________________
> R-SIG-Debian mailing list
> R-SIG-Debian at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-debian
>
--
best,
-tony
"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).
A.J. Rossini
blindglobe at gmail.com
More information about the R-SIG-Debian
mailing list