From b4dad67910c7a6a873922908872900e8902bc363 Mon Sep 17 00:00:00 2001 From: blundellc Date: Sat, 13 Sep 2008 13:24:18 +0000 Subject: [PATCH] getrpkg: invoke curl rather than using download.packages. 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 | 2 +- pkg/trunk/R/getrpkg.R | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/trunk/DESCRIPTION b/pkg/trunk/DESCRIPTION index ca1b2fb..d591695 100644 --- a/pkg/trunk/DESCRIPTION +++ b/pkg/trunk/DESCRIPTION @@ -5,7 +5,7 @@ Title: Convert CRAN packages into Debian packages Author: Charles Blundell , with assistance from Dirk Eddelbuettel <> Maintainer: Charles Blundell 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 diff --git a/pkg/trunk/R/getrpkg.R b/pkg/trunk/R/getrpkg.R index 6fb60bd..b1c5719 100644 --- a/pkg/trunk/R/getrpkg.R +++ b/pkg/trunk/R/getrpkg.R @@ -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) } -- 2.39.2