1 .First.lib <- function(libname, pkgname) {
2 global <- function(name,value) assign(name,value,envir=.GlobalEnv)
3 which_sys <- Sys.getenv('CRAN2DEB_SYS','debian-amd64')
4 if (!length(grep('^[a-z]+-[a-z0-9]+$',which_sys))) {
5 stop('Invalid system specification: must be of the form name-arch')
7 global("host_arch", gsub('^[a-z]+-','',which_sys))
8 global("maintainer", 'cran2deb autobuild <cran2deb@example.org>')
9 global("root", system.file(package='cran2deb'))
10 global("cache_root", '/var/cache/cran2deb')
11 global("pbuilder_results", file.path('/var/cache/cran2deb/results',which_sys))
12 global("pbuilder_config", file.path('/etc/cran2deb/sys',which_sys,'pbuilderrc'))
13 global("dput_config", file.path('/etc/cran2deb/sys',which_sys,'dput.cf'))
14 global("dinstall_config", file.path('/etc/cran2deb/sys',which_sys,'mini-dinstall.conf'))
15 global("dinstall_archive", file.path('/etc/cran2deb/archive',which_sys))
16 global("r_depend_fields", c('Depends','Imports')) # Suggests, Enhances
17 global("scm_revision", 'svn:$Id$')
18 global("changesfile", function(srcname,version='*') {
19 return(file.path(pbuilder_results
20 ,paste(srcname,'_',version,'_'
21 ,host_arch(),'.changes',sep='')))
24 cache <- file.path(cache_root,'cache.rda')
25 if (file.exists(cache)) {
26 load(cache,envir=.GlobalEnv)