]> git.donarmstrong.com Git - cran2deb.git/blobdiff - pkg/trunk/R/zzz.R
cran2deb: put base_pkgs into the cache. generate cache so that R is happy. use separ...
[cran2deb.git] / pkg / trunk / R / zzz.R
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)
+    }
+}