]> git.donarmstrong.com Git - cran2deb.git/commitdiff
cran2deb: use /var/cache/cran2deb as a permanent cache between installs.
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:21:11 +0000 (13:21 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:21:11 +0000 (13:21 +0000)
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

pkg/trunk/R/db.R
pkg/trunk/R/zzz.R
pkg/trunk/exec/diagnose
pkg/trunk/exec/update
pkg/trunk/exec/update_cache
pkg/trunk/inst/doc/README
pkg/trunk/inst/etc/pbuilderrc.in

index c802baea8b72e477869b7a159dd21382be6d9bfb..81b7b59f1ef76448fba9e355bd535ba960c5f9ba 100644 (file)
@@ -1,7 +1,7 @@
 
 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 ('
index be2d55e31f694127822455c653e89fc374377d47..7a532275b36cb79bd22edf7bbe44d8ca0d1f58a5 100644 (file)
@@ -1,20 +1,21 @@
 .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)
     }
index 5f303e79467c76bfa41e9fa8f54bc4369e1e11e7..091da01274daae03be58b19de70128cb2d9c1da7 100755 (executable)
@@ -1,9 +1,8 @@
 #!/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 }
@@ -15,7 +14,7 @@ faildep=('^Error: package ''.*'' could not be loaded'
      '|' '^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'
@@ -62,11 +61,11 @@ echo
 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
 
index e816a20b4d16341a3c5b3a1001a48b20336b8cc9..7659205f26b45e2df7b464063f2914450006857a 100755 (executable)
@@ -6,17 +6,19 @@ for (x in `{find $root/etc -type f -name '*.in'}) {
     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
index ef91f13d0f00b5f90409628451b74ba1daacbfeb..60c63c0530870902e1fc892005ae4b7dbb9d330f 100755 (executable)
@@ -24,4 +24,4 @@ base_pkgs <- readLines(pipe(paste('sudo pbuilder --execute --override-config --c
 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)
index 9b1c581fd8c9371c836f69e7fc25ab18830dc518..c514b3c41fbe290e80c3986f670f32edf017fd76 100644 (file)
@@ -18,7 +18,9 @@ Let ROOT be the value returned by running: cran2deb root
     $ 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)
 
index 425c0a45bed858aab873c52c6ec9d5a3bdc700d9..cd553bddb10c1ce31bdb1c0661bde86992ae209c 100644 (file)
@@ -1,6 +1,6 @@
 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...