[R-sig-Debian] "Debain" way of installing packages

Dirk Eddelbuettel edd at debian.org
Sun Apr 24 19:45:48 CEST 2005


Hi Gregor,

Your enthusiasm in this matter is greatly appreciated. I am CC'ing this to
the existing list on the alioth.debian.org hosting system: pkg-bioc-devel.
This was initially set up my Matt Hope to foster debianising BioC, I then
threw my exisiting Perl infrastructure (used previously for Quantian) at it
and Egon Willighagen carried it from there with further improvements,
incl. large scale builds of amd64 packages.

With a little push from all of us (Hi Tony, Hi Matt, Hi Egon, Hi
anybody-else-willing-to-chip-in :) we can make this even better and hopefully
have something proper by the summer, maybe for DSC 20003.

On 24 April 2005 at 16:04, Gorjanc Gregor 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, ...)
|     }
| }

As Tony said in his follow-up, the mixing and matching is hard to do
properly, which is why I think the high-end solution is to provide a robust
script, maybe with a db backend, that debianises what is on CRAN -- similar
to what exists on Windows. We'd simply use apt-get instead of
install.packages() wherever possible.
 
| One more thing. Why is r-noncran-lindsey and not r-other-lindsey?

Because nobody pressed Chris hard enough to implement the change. I am sure
he would take a patch from you (hint, hint).

Cheers, Dirk

PS Adorable type in you Subject line. I have done gazillion times as well :)

| 
| --
| 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

-- 
Better to have an approximate answer to the right question than a precise 
answer to the wrong question.  --  John Tukey as quoted by John Chambers



More information about the R-SIG-Debian mailing list