Previously, when a new cran2deb was installed, cran2deb update would
re-generate the database and cache in their entirety, as well as lose
all previously generated .debs. Instead they are stored outside the R
package heirarchy and so persist.
The cache is intended to contain everything that should be kept
in-memory for cran2deb (e.g., common data structures like the list of
all available packages), whilst the database is for all other data to be
stored on disk.
git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@81
edb9625f-4e0d-4859-8d74-
9fd3b1da38cb
db_start <- function() {
drv <- dbDriver('SQLite')
- con <- dbConnect(drv, dbname=file.path(root,'data/cran2deb.db'))
+ con <- dbConnect(drv, dbname=file.path(cache_root,'cran2deb.db'))
tables <- dbListTables(con)
if (!dbExistsTable(con,'sysreq_override')) {
dbGetQuery(con,paste('CREATE TABLE sysreq_override ('
.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("cache_root", '/var/cache/cran2deb')
+ global("pbuilder_results", '/var/cache/cran2deb/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
+ global("changesfile", function(srcname,version='*') {
+ return(file.path(pbuilder_results
+ ,paste(srcname,'_',version,'_'
+ ,host_arch(),'.changes',sep='')))
+ })
- cache <- file.path(root,'data/cache.rda')
+ cache <- file.path(cache_root,'cache.rda')
if (file.exists(cache)) {
load(cache,envir=.GlobalEnv)
}
#!/usr/bin/rc
-#success=`{ls var/results/*.deb | wc -l}
-#echo $success successful packages
-#total=$success
-total=0
+success=`{ls /var/cache/cran2deb/results/*.deb | wc -l}
+echo $success successful packages
+total=$success
fn count_dup { sort | uniq -c | sort -n}# | awk '$1 > 1{print}' }
fn collapse { a=`{echo $^* | sed -e 's/ | /|/g'}; echo $^a }
'|' '^ERROR: lazy loading failed for package ''.*'''
'|' '^[[:space:]]*package .* is not available'
'|' 'there is no package called ''.*''')
-faildeb='Unsupported SystemRequirements:'
+faildeb='do not know what to do with SystemRequirement:'
faillic=('No acceptable license: ')
failspc=': No space left on device'
failhdr='error: .*\.hp?p?: No such file or directory'
nfailother=`{hoc -e `{grep -EL $other fail/* /dev/null | wc -l}^-1}
echo $nfailother other failures.
-#total=`{hoc -e $total}
-#succrate=`{hoc -e $success/'('$total')*100'}
-#echo $succrate% success rate '('$total' total)'
-#total=`{hoc -e $total-$nfaillic-$nfailspc-$nfailhdr}
-#succrate=`{hoc -e $success/'('$total')*100'}
-#echo $succrate% success rate without licensing, space and Debian deps issues '('$total' total)'
+total=`{hoc -e $total}
+succrate=`{hoc -e $success/'('$total')*100'}
+echo $succrate% success rate '('$total' total)'
+total=`{hoc -e $total-$nfaillic-$nfailspc-$nfailhdr}
+succrate=`{hoc -e $success/'('$total')*100'}
+echo $succrate% success rate without licensing, space and Debian deps issues '('$total' total)'
grep -EL $other fail/* /dev/null | xargs tail -n 20
y=`{echo $x | sed -e 's,.in$,,'}
sed -e 's:@ROOT@:'^$root^':g' <$x >$y
}
-mkdir -p $root/var/results
+mkdir -p /var/cache/cran2deb/results || exit 1
if ([ ! -e $root/var/archive ]) {
# I symbolically link this into /var/www/
- mkdir $root/var/archive
+ mkdir $root/var/archive || exit 1
}
mini-dinstall --batch -c $root/etc/mini-dinstall.conf || exit 1
-mode=create
-if ([ -e /var/cache/pbuilder/base-cran2deb.tgz ]) {
- mode=update
+if (! ~ $1 quick) {
+ mode=create
+ if ([ -e /var/cache/pbuilder/base-cran2deb.tgz ]) {
+ mode=update
+ }
+ sudo pbuilder $mode --override-config --configfile $root/etc/pbuilderrc
+ $root/exec/update_cache $root
+ $root/exec/license <$root/data/populate_licenses
+ $root/exec/sysreq <$root/data/populate_sysreq
}
-sudo pbuilder $mode --override-config --configfile $root/etc/pbuilderrc
-$root/exec/update_cache $root
-$root/exec/license <$root/data/populate_licenses
-$root/exec/sysreq <$root/data/populate_sysreq
message('updating list of existing Debian packages...')
debian_pkgs <- readLines(pipe('apt-cache rdepends r-base-core | sed -e "/^ r-cran/{s/^[[:space:]]*r/r/;p}" -e d | sort -u'))
-save(debian_pkgs, base_pkgs, available, ctv.available, file=file.path(argv[1],'data/cache.rda'),eval.promises=T)
+save(debian_pkgs, base_pkgs, available, ctv.available, file=file.path(cache_root,'cache.rda'),eval.promises=T)
$ rm ROOT/var/archive
$ ln -s /var/www/cran2deb/ ROOT/var/archive
3. modify OTHERMIRROR of ROOT/etc/pbuilderrc.in to point to your webserver
-4. run: cran2deb update
-5. Try building a simple package: cran2deb build zoo
- (The result will be in ROOT/var/results)
+4. cran2deb needs a persistent cache outside of R's control. therefore, create
+ /var/cache/cran2deb, writable by whichever user(s) will run cran2deb.
+5. run: cran2deb update
+6. Try building a simple package: cran2deb build zoo
+ (The result will be in /var/cache/cran2deb/results)
BASETGZ=/var/cache/pbuilder/base-cran2deb.tgz
HOOKDIR=@ROOT@/etc/hook
-BUILDRESULT=@ROOT@/var/results
+BUILDRESULT=/var/cache/cran2deb/results
EXTRAPACKAGES='debhelper r-base-dev cdbs r-base-core lintian xvfb xauth xfonts-base'
REMOVEPACKAGES='lilo libldap-2.4-2 libopencdk10 libsasl2-2'
# don't actually need aptitude, but pbuilder insists...