X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=trunk%2Fexec%2Fupdate_cache;h=3864d1727aeb0c2ad14e2a7c88acf3800f4d22b7;hb=9ccdccec13be2765facd88844c08e456dc55f362;hp=e6741a940d8eb660450b0afe577d7e5b5d93f0f2;hpb=3ba98e7ab3d2ba1f6463224d9ed8e5c1c41b3673;p=cran2deb.git diff --git a/trunk/exec/update_cache b/trunk/exec/update_cache index e6741a9..3864d17 100755 --- a/trunk/exec/update_cache +++ b/trunk/exec/update_cache @@ -1,4 +1,5 @@ #!/usr/bin/r -t + # Note: everything in the case needs to be system-independent! library(cran2deb) library(ctv) @@ -9,6 +10,8 @@ library(ctv) #mirror <- 'http://cran.uk.r-project.org/' mirror <- 'http://cran.r-project.org/' +verbose<-FALSE + message('updating list of available R packages...') available <- available.packages(contrib.url(mirror)) @@ -25,9 +28,34 @@ base_pkgs <- readLines(pipe(paste('sudo pbuilder --execute --override-config --c ,shQuote(file.path(root,'exec/get_base_pkgs')) ,'| grep -v ^W:'))) +if (any(grep("^E:",base_pkgs,value=FALSE))) { + cat("Cannot continue, the following error occurred:\n") + cat(paste(grep("^E:",base_pkgs,value=TRUE),collapse="\n")) + cat("\n") + q(save="no") +} + + +if (verbose) { + cat("The following base packages were determined:\n") + print(base_pkgs) +} + 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')) +if (any(grep("^E:",debian_pkgs,value=FALSE))) { + cat("Cannot continue, the following error occurred:\n") + cat(paste(grep("^E:",debian_pkgs,value=TRUE),collapse="\n")) + cat("\n") + q(save="no") +} + +if (verbose) { + cat("The following packages were found to be available:\n") + print(debian_pkgs) +} + save(debian_pkgs, base_pkgs, available, ctv.available, file=file.path(cache_root,'cache.rda'),eval.promises=T) message('synchronising database...')