X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=trunk%2Fexec%2Fupdate_cache;h=3864d1727aeb0c2ad14e2a7c88acf3800f4d22b7;hb=9ccdccec13be2765facd88844c08e456dc55f362;hp=6f82b49bdd4e8b9d3a01771681745d787132c5a1;hpb=a29ccad70f6598e86efc57dad8201b107e658fb5;p=cran2deb.git diff --git a/trunk/exec/update_cache b/trunk/exec/update_cache index 6f82b49..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)) @@ -19,16 +22,40 @@ available <- available.packages(contrib.url(mirror)) message('updating list of available R task views...') ctv.available <- available.views(repo=mirror) -#message('updating list of base R packages...') -#base_pkgs <- readLines(pipe(paste('sudo pbuilder --execute --override-config --configfile' -# ,shQuote(pbuilder_config),'-- /usr/bin/R --vanilla 2>&1 >/dev/null <' -# ,shQuote(file.path(root,'exec/get_base_pkgs')) -# ,'| grep -v ^W:'))) -base_pkgs <- '' +message('updating list of base R packages...') +base_pkgs <- readLines(pipe(paste('sudo pbuilder --execute --override-config --configfile' + ,shQuote(pbuilder_config),'-- /usr/bin/R --vanilla 2>&1 >/dev/null <' + ,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...')