]> git.donarmstrong.com Git - cran2deb.git/commitdiff
cran2deb: put base_pkgs into the cache. generate cache so that R is happy. use separ...
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:17:47 +0000 (13:17 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:17:47 +0000 (13:17 +0000)
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

pkg/trunk/DESCRIPTION
pkg/trunk/R/debiannaming.R
pkg/trunk/R/debianpkg.R
pkg/trunk/R/zzz.R
pkg/trunk/exec/build
pkg/trunk/exec/get_base_pkgs [new file with mode: 0755]
pkg/trunk/exec/update
pkg/trunk/exec/update_cache
pkg/trunk/inst/etc/pbuilderrc.in

index 9cf7805f18efce7bebbaa1e6d716ac2cf1e59f6d..f0fb522407ec075c0da2b7b052ba89aa6b9166a5 100644 (file)
@@ -5,7 +5,7 @@ Title: Convert CRAN packages into Debian packages
 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
index 08c3f84d9c5ddba64732b4d299d474cffeee2421..001262a4b2d3cd7a02e699819e4b757d0336cfc3 100644 (file)
@@ -1,10 +1,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))) {
index 3b9ca624c7bae25052c419c2838bae62ed077a67..1beb5e67614ca223d5a93dd12def241529a37f95 100644 (file)
@@ -144,7 +144,7 @@ build.debian <- function(pkg) {
                  ,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.')
index c5e78f03e74f939e9fbc54caf9e4889f43fbb921..34811d2622fa93570a1c9e647e1ac2df41b2b9a7 100644 (file)
@@ -1,22 +1,24 @@
 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)
+    }
+}
index 5678f281d08f690f82295ab75a831f6764dcdeb0..04828969ce6c579df92ae5fc016e917278e0b760 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env r
 suppressMessages(library(cran2deb))
+
 go <- function(name,extra_deps) {
     dir <- setup()
     pkg <- try((function() {
diff --git a/pkg/trunk/exec/get_base_pkgs b/pkg/trunk/exec/get_base_pkgs
new file mode 100755 (executable)
index 0000000..d08d625
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/env r
+for (pkg in rownames(installed.packages())) {
+       message(pkg)
+}
index 5e80c2ad30bd528323a77b7bb6742cad3adc9c84..598597cb1be73ac2c1e9a90d85a96082bfa283dc 100755 (executable)
@@ -13,7 +13,7 @@ if ([ ! -e $root/var/archive ]) {
 }
 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
index d80b072495921151147ccd84786594e8418d423e..627e570202d0e5e1898b7adaf1da1283b9fce4db 100755 (executable)
@@ -3,9 +3,18 @@ library(cran2deb)
 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)
index a84b61b67b258e05cadb1913b5647fa056e1e56b..425c0a45bed858aab873c52c6ec9d5a3bdc700d9 100644 (file)
@@ -1,3 +1,4 @@
+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'