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'))
4 if (!length(grep('^[a-z]+$',which_system))) {
5 stop('Invalid system specification: must be of the form name')
7 global("maintainer", 'cran2deb autobuild <cran2deb@gmail.com>')
8 global("root", system.file(package='cran2deb'))
9 global("cache_root", '/var/cache/cran2deb')
10 global("indep_arch", "all")
11 global("archs", c("i386", "amd64"))
12 # get the pbuilder results dir, and config
13 global("get_pbuilder_config", function(arch) {
14 sys_arch <- paste(which_system, arch, sep='-')
15 return(c(file.path('/var/cache/cran2deb/results',sys_arch))
16 ,file.path('/etc/cran2deb/sys',sys_arch,'pbuilderrc'))
18 global("reprepro_dir", file.path('/var/www/repo',which_system))
19 global("get_reprepro_orig_tgz", function(srcname, version) {
20 return file.path(reprepro_dir, 'pool', 'main', substr(srcname, 1, 1),
21 srcname, paste(srcname,'_',version,'.orig.tar.gz',
24 global("r_depend_fields", c('Depends','Imports')) # Suggests, Enhances
25 global("scm_revision", paste("svn:", svnversion()))
26 global("patch_dir", '/etc/cran2deb/patches')
27 global("lintian_dir", '/etc/cran2deb/lintian')
28 global("changesfile", function(srcname,version='*',arch='*') {
29 return(file.path(pbuilder_results
30 ,paste(srcname,'_',version,'_'
31 ,arch,'.changes',sep='')))
33 global("version_suffix","cran")
34 # perhaps db_cur_version() should be used instead?
35 global("version_suffix_step",1)
37 cache <- file.path(cache_root,'cache.rda')
38 if (file.exists(cache)) {
39 load(cache,envir=.GlobalEnv)
41 message(paste('I: cran2deb',scm_revision,'building for',which_system,'at',Sys.time()))