}
control[2,'Depends'] <- paste(pkg$depends$bin,collapse=', ')
-# # bundles provide virtual packages of their contents
-# # unnecessary for now; cran2deb converts R bundles itself
-# if (pkg$is_bundle) {
-# control[2,'Provides'] = paste(
-# lapply(r_bundle_contains(pkg$name)
-# ,function(name) return(pkgname_as_debian(paste(name)
-# ,repopref=pkg$repo)))
-# ,collapse=', ')
-# }
-
# generate the description
descr <- 'GNU R package "'
if ('Title' %in% colnames(pkg$description)) {
} else {
descr <- paste(descr,pkg$name,sep='')
}
- if (pkg$is_bundle) {
- long_descr <- pkg$description[1,'BundleDescription']
- } else {
- long_descr <- pkg$description[1,'Description']
- }
+ long_descr <- pkg$description[1,'Description']
if (length(long_descr) < 1 || long_descr == "") {
# bypass lintian extended-description-is-empty for which we care not.
} else {
# XXX: data.frame rownames are unique, so always override repopref for
# now.
- if (!(name %in% rownames(available))) {
- bundle <- r_bundle_of(name)
- if (!is.null(bundle)) {
- name <- bundle
- }
- }
debname = tolower(name)
if (binary) {
if (name %in% rownames(available)) {
# says: ``The sources and headers for the compiled code are in src, plus
# optionally file Makevars or Makefile.'' It seems unlikely that
# architecture independent code would end up here.
- if (pkg$is_bundle) {
- # if it's a bundle, check each of the packages
- pkg$archdep = F
- for (pkgname in r_bundle_contains(pkg$name)) {
- pkg$archdep = file.exists(file.path(pkg$path,pkgname,'src'))
- if (pkg$archdep) {
- break
- }
- }
- } else {
- pkg$archdep = file.exists(file.path(pkg$path,'src'))
- }
+ pkg$archdep = file.exists(file.path(pkg$path,'src'))
pkg$arch <- 'all'
if (pkg$archdep) {
pkg$arch <- host_arch()
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)
}
}
- 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)
-r_bundle_of <- function(pkgname) {
- return(NULL) ## there are no more bundles as of R 2.11.0
-
- ## -- old code below, never reached
- ##
- # returns the bundle containing pkgname or NA
- bundles <- names(available[!is.na(available[, 'Bundle']), 'Contains'])
- # use the first bundle
- for (bundle in bundles) {
- if (pkgname %in% r_bundle_contains(bundle)) {
- return(bundle)
- }
- }
- return(NULL)
-}
-
-r_bundle_contains <- function(bundlename) {
- return(strsplit(available[bundlename,'Contains'],'[[:space:]]+')[[1]])
-}
r_requiring <- function(names) {
- #for (name in names) {
- # if (!(name %in% base_pkgs) && !(name %in% rownames(available))) {
- # bundle <- r_bundle_of(name)
- # if (!is.null(bundle)) {
- # name = bundle
- # names <- c(names,bundle)
- # }
- # }
- # if (name %in% rownames(available) && !is.na(available[name,'Contains'])) {
- # names <- c(names,r_bundle_contains(name))
- # }
- #}
# approximately prune first into a smaller availability
candidates <- rownames(available)[sapply(rownames(available)
,function(name)
if (length(candidates) == 0) {
return(c())
}
- # find a logical index into available of every package/bundle
+ # find a logical index into available of every package
# whose dependency field contains at least one element of names.
# (this is not particularly easy to read---sorry---but is much faster than
# the alternatives i could think of)
}
if (is.null(description)) {
if (!(name %in% rownames(available))) {
- bundle <- r_bundle_of(name)
- if (!is.null(bundle)) {
- name <- bundle
- } else {
- # unavailable packages don't depend upon anything
- return(data.frame())
- }
+ # unavailable packages don't depend upon anything
+ return(data.frame())
}
description <- data.frame()
# keep only the interesting fields
}
version = sub(pat,'\\3',dep)
dep = sub(pat,'\\1',dep)
- if (!(dep %in% rownames(available))) {
- depb <- r_bundle_of(dep)
- if (!is.null(depb)) {
- dep <- depb
- }
- }
return(list(name=dep,version=version))
}
new_build_version <- function(pkgname) {
if (!(pkgname %in% rownames(available))) {
- bundle <- r_bundle_of(pkgname)
- if (is.null(bundle)) {
- fail('tried to discover new version of',pkgname,'but it does not appear to be available')
- }
- name <- bundle
+ fail('tried to discover new version of',pkgname,'but it does not appear to be available')
}
db_ver <- db_latest_build_version(pkgname)
db_succ <- db_latest_build_status(pkgname)[[1]]