1 .First.lib <- function(libname, pkgname) {
2 global <- function(name,value) assign(name,value,envir=.GlobalEnv)
3 global("which_system", Sys.getenv('CRAN2DEB_SYS','debian-amd64'))
4 if (!length(grep('^[a-z]+-[a-z0-9]+$',which_system))) {
5 stop('Invalid system specification: must be of the form name-arch')
7 global("host_arch", gsub('^[a-z]+-','',which_system))
8 global("maintainer", 'cran2deb autobuild <cran2deb@gmail.com>')
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_system))
12 global("pbuilder_config", file.path('/etc/cran2deb/sys',which_system,'pbuilderrc'))
13 global("dput_config", file.path('/etc/cran2deb/sys',which_system,'dput.cf'))
14 global("dinstall_config", file.path('/etc/cran2deb/sys',which_system,'mini-dinstall.conf'))
15 global("dinstall_archive", file.path('/etc/cran2deb/archive',which_system))
16 global("r_depend_fields", c('Depends','Imports')) # Suggests, Enhances
17 global("scm_revision", paste("svn:", svnversion()))
18 global("patch_dir", '/etc/cran2deb/patches')
19 global("lintian_dir", '/etc/cran2deb/lintian')
20 global("changesfile", function(srcname,version='*') {
21 return(file.path(pbuilder_results
22 ,paste(srcname,'_',version,'_'
23 ,host_arch,'.changes',sep='')))
25 global("version_suffix","cran")
26 # perhaps db_cur_version() should be used instead?
27 global("version_suffix_step",1)
29 cache <- file.path(cache_root,'cache.rda')
30 if (file.exists(cache)) {
31 load(cache,envir=.GlobalEnv)
33 message(paste('I: cran2deb',scm_revision,'building for',which_system,'at',Sys.time()))