]> git.donarmstrong.com Git - cran2deb.git/blob - trunk/R/zzz.R
8861328a76f54977bca4bda0a6ea9cdcc8763517
[cran2deb.git] / trunk / R / zzz.R
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')
6     }
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("changesfile", function(srcname,version='*') {
20         return(file.path(pbuilder_results
21                         ,paste(srcname,'_',version,'_'
22                               ,host_arch,'.changes',sep='')))
23     })
24     global("version_suffix","cran")
25     # perhaps db_cur_version() should be used instead?
26     global("version_suffix_step",1)
27
28     cache <- file.path(cache_root,'cache.rda')
29     if (file.exists(cache)) {
30         load(cache,envir=.GlobalEnv)
31     }
32     message(paste('I: cran2deb',scm_revision,'building for',which_system,'at',Sys.time()))
33 }