X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=trunk%2FR%2Fgetrpkg.R;h=9c87c379460d28ecbc990241cb3fd287cadbd9e9;hb=d8a2e28b2f013a8624cb587f09f90120f46f1ce8;hp=f60329af58e7aca9529a9217d1b652ff7e103aeb;hpb=f9487ec5bcd78eddc4046782a3942166924043b9;p=cran2deb.git diff --git a/trunk/R/getrpkg.R b/trunk/R/getrpkg.R index f60329a..9c87c37 100644 --- a/trunk/R/getrpkg.R +++ b/trunk/R/getrpkg.R @@ -39,6 +39,7 @@ download_pkg <- function(dir, pkgname) { pkg$archive <- file.path(dir, basename(debfn)) file.copy(debfn,pkg$archive) pkg$path = file.path(dir, paste(pkg$srcname ,pkg$version ,sep='-')) + notice('using an existing debianized source tarball:',debfn) } else { # see if we have a local mirror in /srv/R use_local = FALSE @@ -82,6 +83,7 @@ download_pkg <- function(dir, pkgname) { repack_pkg <- function(pkg) { # re-pack into a Debian-named archive with a Debian-named directory. + notice('repacking into debian source archive.') debpath = file.path(dirname(pkg$archive) ,paste(pkg$srcname ,pkg$version @@ -100,6 +102,10 @@ repack_pkg <- function(pkg) { ,'-type f -a ' , '! \\( -name configure -o -name cleanup \\)' ,'-exec chmod -x {} \\;') + if (file.exists(file.path(basename(pkg$path),'debian'))) { + warn('debian/ directory found in tarball! removing...') + unlink(file.path(basename(pkg$path),'debian'),recursive=TRUE) + } # tar it all back up log_system('tar -czf',shQuote(debarchive),shQuote(basename(pkg$path))) setwd(wd) @@ -111,19 +117,9 @@ repack_pkg <- function(pkg) { prepare_pkg <- function(dir, pkgname) { # download and extract an R package named pkgname - # OR the bundle containing pkgname # based loosely on library/utils/R/packages2.R::install.packages - # first a little trick; change pkgname if pkgname is contained in a bundle - if (!(pkgname %in% rownames(available))) { - bundle <- r_bundle_of(pkgname) - if (is.null(bundle)) { - fail('package',pkgname,'is unavailable') - } - pkgname <- bundle - } - # grab the archive and some metadata pkg <- download_pkg(dir, pkgname) @@ -161,10 +157,8 @@ prepare_pkg <- function(dir, pkgname) { } } - pkg$is_bundle = 'Bundle' %in% names(pkg$description[1,]) # note subtly of short circuit operators (no absorption) - if ((!pkg$is_bundle && pkg$description[1,'Package'] != pkg$name) || - ( pkg$is_bundle && pkg$description[1,'Bundle'] != pkg$name)) { + if (pkg$description[1,'Package'] != pkg$name) { fail('package name mismatch') } return(pkg)