2 suppressMessages(library(cran2deb))
3 go <- function(name,extra_deps) {
5 pkg <- try((function() {
6 pkg <- prepare.new.debian(prepare.pkg(dir,name),extra_deps)
7 if (file.exists(changesfile(pkg$srcname,pkg$debversion))) {
8 message(paste('N: already built',pkg$srcname,'version',pkg$debversion))
12 # delete the current archive (XXX: assumes mini-dinstall)
13 for (subdir in c('mini-dinstall','unstable')) {
14 path = file.path(dinstall_archive,subdir)
15 if (file.exists(path)) {
16 unlink(path,recursive=T)
20 # delete notes of upload
21 file.remove(Sys.glob(file.path(pbuilder_results,'*.upload')))
23 # make mini-dinstall generate the skeleton of the archive
24 ret = system(paste('umask 022;mini-dinstall --batch -c',dinstall_config))
26 stop('failed to create archive')
29 # pull in all the R dependencies
30 message(paste('N: dependencies:',paste(pkg$depends$r,collapse=', ')))
31 for (dep in pkg$depends$r) {
32 message(paste('N: uploading',dep))
33 ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
36 stop('upload of dependency failed! maybe you did not build it first?')
42 ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
43 ,changesfile(pkg$srcname,pkg$debversion)))
45 stop('upload failed!')
51 if (inherits(pkg,'try-error')) {
57 if (exists('argv')) { # check for littler
63 # first argument is the root --- this is dealt with elsewhere.
65 if (!(argv[i] %in% opts)) {
75 message('E: missing argument')
78 if (argv[i] == '-D') {
79 extra_deps$deb = c(extra_deps$deb,strsplit(chomp(argv[i+1]),',')[[1]])
81 if (argv[i] == '-R') {
82 extra_deps$r = c(extra_deps$r,strsplit(chomp(argv[i+1]),',')[[1]])
83 extra_deps$deb = c(extra_deps$deb,lapply(extra_deps$r,pkgname.as.debian))
87 message('E: usage: cran2deb [-D extra_dep1,extra_dep2,...] package package ...')
90 build_order <- r.dependency.closure(c(extra_deps$r,argv))
91 message(paste('N: build order',paste(build_order,collapse=', ')))
92 for (pkg in build_order) {