base_pkgs is the list of all packages that are provided in the basic
install of R. It is found by listing all installed packages in the
pbuilder environment.
Previously the cache of availabile packages lived in sysdata.rda.
Unfortunately it appears that R does not like it when sysdata.rda is
updated after package installation (I think this is something to do with
lazy loading, but disabling this did not seem to help). Instead the
cache is maintained separated in the data/ package directory.
pbuilder now uses base-cran2deb.tgz for the cran2deb pbuilder
environment -- this should help keep cran2deb from interfering from
other uses of pbuilder.
git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@54
edb9625f-4e0d-4859-8d74-
9fd3b1da38cb
Author: Charles Blundell <blundellc@gmail.com>, with assistance from Dirk Eddelbuettel <>
Maintainer: Charles Blundell <blundellc@gmail.com>
Depends: ctv, utils, RSQLite, DBI
-SystemRequirements: rc, pbuilder, debian toolchain, web server
+SystemRequirements: rc, pbuilder, debian toolchain, web server, mini-dinstall
Description: Convert CRAN packages into Debian packages, mostly unassisted, easily
subverting the R package system.
License: GPL-3
-# sudo pbuilder --execute r -e 'rownames(installed.packages())'
-# XXX: has to be a better way of doing this
-base_pkgs=c('base', 'datasets','grDevices','graphics','grid', 'methods'
- ,'splines','stats', 'stats4', 'tcltk', 'tools','utils')
-# found in R source directory:
-# 'profile', 'datasets'
-
repourl.as.debian <- function(url) {
# map the url to a repository onto its name in debian package naming
if (length(grep('cran',url))) {
,pkg$debname
,paste('(',pkg$debversion,')',sep='')
,'...'))
- ret = system(paste('pdebuild --configfile',pbuilder_config))
+ ret = system(paste('pdebuild --configfile',shQuote(pbuilder_config)))
setwd(wd)
if (ret != 0) {
stop('Failed to build package.')
library(DBI)
library(RSQLite)
-changesfile <- function(srcname,version='*') {
- return(file.path(pbuilder_results
- ,paste(srcname,'_',version,'_'
- ,host.arch(),'.changes',sep='')))
-}
-
-maintainer <- 'cran2deb buildbot <cran2deb@example.org>'
-root <- system.file(package='cran2deb')
-pbuilder_results <- file.path(root,'var/results')
-pbuilder_config <- file.path(root,'etc/pbuilderrc')
-dput_config <- file.path(root,'etc/dput.cf')
-dinstall_config <- file.path(root,'etc/mini-dinstall.conf')
-dinstall_archive <- file.path(root,'var/archive')
-r_depend_fields <- c('Depends','Imports') # Suggests, Enhances
-
-# we cache the list of available packages
-# should be pulled in already
-#load(file.path(root,'var/cache/available.cache.Rd'))
+.First.lib <- function(libname, pkgname) {
+ global <- function(name,value) assign(name,value,envir=.GlobalEnv)
+ global("changesfile", function(srcname,version='*') {
+ return(file.path(pbuilder_results
+ ,paste(srcname,'_',version,'_'
+ ,host.arch(),'.changes',sep='')))
+ })
+ global("maintainer", 'cran2deb buildbot <cran2deb@example.org>')
+ global("root", system.file(package='cran2deb'))
+ global("pbuilder_results", file.path(root,'var/results'))
+ global("pbuilder_config", file.path(root,'etc/pbuilderrc'))
+ global("dput_config", file.path(root,'etc/dput.cf'))
+ global("dinstall_config", file.path(root,'etc/mini-dinstall.conf'))
+ global("dinstall_archive", file.path(root,'var/archive'))
+ global("r_depend_fields", c('Depends','Imports')) # Suggests, Enhances
+ cache <- file.path(root,'data/cache.rda')
+ if (file.exists(cache)) {
+ load(cache,envir=.GlobalEnv)
+ }
+}
#!/usr/bin/env r
suppressMessages(library(cran2deb))
+
go <- function(name,extra_deps) {
dir <- setup()
pkg <- try((function() {
--- /dev/null
+#!/usr/bin/env r
+for (pkg in rownames(installed.packages())) {
+ message(pkg)
+}
}
mini-dinstall --batch -c $root/etc/mini-dinstall.conf || exit 1
mode=create
-if ([ -e /var/cache/pbuilder/base.tgz ]) {
+if ([ -e /var/cache/pbuilder/base-cran2deb.tgz ]) {
mode=update
}
sudo pbuilder $mode --override-config --configfile $root/etc/pbuilderrc
library(ctv)
#mirror <- 'http://cran.uk.r-project.org/'
mirror <- 'http://cran.r-project.org/'
+
message('updating list of available R packages...')
available <- available.packages(contrib.url(mirror))
available <- rbind(available,available.packages(contrib.url('http://www.bioconductor.org/')))
+
message('updating list of available R task views...')
ctv.available <- available.views(repo=mirror)
-save(available, ctv.available, file=file.path(argv[1],'R/sysdata.rda'),eval.promises=T)
+message('updating list of base R packages...')
+base_pkgs <- readLines(pipe(paste('sudo pbuilder --execute --override-config --configfile'
+ ,shQuote(pbuilder_config),'-- /usr/bin/R --vanilla 2>&1 >/dev/null <'
+ ,shQuote(file.path(root,'exec/get_base_pkgs'))
+ ,'| grep -v ^W:')))
+
+
+save(base_pkgs, available, ctv.available, file=file.path(argv[1],'data/cache.rda'),eval.promises=T)
+BASETGZ=/var/cache/pbuilder/base-cran2deb.tgz
HOOKDIR=@ROOT@/etc/hook
BUILDRESULT=@ROOT@/var/results
EXTRAPACKAGES='debhelper r-base-dev cdbs r-base-core lintian xvfb xauth xfonts-base'