1 get.dependencies <- function(pkg,extra_deps) {
2 if ('SystemRequirements' %in% colnames(pkg$description)) {
3 stop(paste('Unsupported SystemRequirements:',pkg$description[1,'SystemRequirements']))
6 # determine dependencies
7 dependencies <- r.dependencies.of(description=pkg$description)
9 # these are used for generating the Depends fields
10 as.deb <- function(r,binary) {
11 return(pkgname.as.debian(paste(dependencies[r,]$name)
12 ,version=dependencies[r,]$version
16 depends$bin <- lapply(rownames(dependencies), as.deb, binary=T)
17 depends$build <- lapply(rownames(dependencies), as.deb, binary=F)
18 # add the command line dependencies
19 depends$bin = c(extra_deps$deb,depends$bin)
20 depends$build = c(extra_deps$deb,depends$build)
22 # make sure we depend upon R in some way...
23 if (!length(grep('^r-base',depends$build))) {
24 depends$build = c(depends$build,pkgname.as.debian('R',version='>= 2.7.0',binary=F))
25 depends$bin = c(depends$bin, pkgname.as.debian('R',version='>= 2.7.0',binary=T))
27 # also include stuff to allow tcltk to build (suggested by Dirk)
28 depends$build = c(depends$build,'xvfb','xauth','xfonts-base')
31 depends <- lapply(depends,unique)
33 # append the Debian dependencies
34 depends$build=c(depends$build,'debhelper (>> 4.1.0)','cdbs')
36 depends$bin=c(depends$bin,'${shlibs:Depends}')
39 # the names of dependent source packages (to find the .changes file to
40 # upload via dput). these can be found recursively.
41 depends$r = lapply(r.dependency.closure(dependencies)
43 # append command line dependencies
44 depends$r = c(extra_deps$r, depends$r)
48 generate.control <- function(pkg) {
49 # construct control file
50 control = data.frame()
51 control[1,'Source'] = pkg$srcname
52 control[1,'Section'] = 'math'
53 control[1,'Priority'] = 'optional'
54 control[1,'Maintainer'] = maintainer
55 control[1,'Build-Depends'] = paste(pkg$depends$build,collapse=', ')
56 control[1,'Standards-Version'] = '3.8.0'
58 control[2,'Package'] = pkg$debname
59 control[2,'Architecture'] = 'all'
61 control[2,'Architecture'] = 'any'
63 control[2,'Depends'] = paste(pkg$depends$bin,collapse=', ')
65 # bundles provide virtual packages of their contents
67 control[2,'Provides'] = paste(
68 lapply(r.bundle.contains(pkg$name)
69 ,function(name) return(pkgname.as.debian(paste(name)
75 # generate the description
76 descr = 'GNU R package "'
77 if ('Title' %in% colnames(pkg$description)) {
78 descr = paste(descr,pkg$description[1,'Title'],sep='')
80 descr = paste(descr,pkg$name,sep='')
83 long_descr <- pkg$description[1,'BundleDescription']
85 long_descr <- pkg$description[1,'Description']
87 # using \n\n.\n\n is not very nice, but is necessary to make sure
88 # the longer description does not begin on the synopsis line --- R's
89 # write.dcf does not appear to have a nicer way of doing this.
90 descr = paste(descr,'"\n\n', long_descr, sep='')
91 if ('URL' %in% colnames(pkg$description)) {
92 descr = paste(descr,'\n\nURL: ',pkg$description[1,'URL'],sep='')
94 control[2,'Description'] = descr
96 # Debian policy says 72 char width; indent minimally
97 write.dcf(control,file=pkg$debfile('control.in'),indent=1,width=72)
98 write.dcf(control,indent=1,width=72)