]> git.donarmstrong.com Git - cran2deb.git/commitdiff
getrpkg: invoke curl rather than using download.packages.
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:24:18 +0000 (13:24 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:24:18 +0000 (13:24 +0000)
curl has the options necessary to make a mass build possible with my
current unreliable internet connection. some tcp connections hang
indefinitely, which indefinitely halts any build. retrying works. R has
no suitable timeout mechanism.

git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@106 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/trunk/DESCRIPTION
pkg/trunk/R/getrpkg.R

index ca1b2fb01abd41153f864f342f50b753bf47ab67..d591695b8b19e1dbe4f269029536434e0fd6ee07 100644 (file)
@@ -5,7 +5,7 @@ Title: Convert CRAN packages into Debian packages
 Author: Charles Blundell <blundellc@gmail.com>, with assistance from Dirk Eddelbuettel <>
 Maintainer: Charles Blundell <blundellc@gmail.com>
 Depends: ctv, utils, RSQLite, DBI, digest
-SystemRequirements: littler, rc, pbuilder, debian toolchain, web server, mini-dinstall
+SystemRequirements: littler, rc, pbuilder, debian toolchain, web server, mini-dinstall, curl
 Description: Convert CRAN packages into Debian packages, mostly unassisted, easily
  subverting the R package system.
 License: GPL-3
index 6fb60bd71575ce19c1c34610ea59ba9df72d6cef..b1c5719d08d2bbc28e1238f4d8ff2d584b6d708b 100644 (file)
@@ -27,7 +27,18 @@ prepare_pkg <- function(dir, pkgname) {
         }
         pkgname <- bundle
     }
-    archive <- download.packages(pkgname, dir, available=available, repos='', type="source")[1,2]
+    # use this instead of download.packages as it is more resilient to
+    # dodgy network connections (hello BT 'OpenWorld', bad ISP)
+    fn <- paste(pkgname, '_', available[pkgname,'Version'], '.tar.gz', sep='')
+    url <- paste(available[pkgname,'Repository'], fn, sep='/')
+    archive <- file.path(dir, fn)
+    # don't log the output -- we don't care!
+    ret <- system(paste('curl','-o',shQuote(archive),'-m 60 --retry 5',shQuote(url)))
+    if (ret != 0) {
+        fail('failed to download',url)
+    }
+    # end of download.packages replacement
+#    archive <- download.packages(pkgname, dir, available=available, repos='', type="source")[1,2]
     if (length(grep('\\.\\.',archive)) || normalizePath(archive) != archive) {
         fail('funny looking path',archive)
     }