2 suppressMessages(library(cran2deb))
4 go <- function(name,extra_deps) {
6 pkg <- try((function() {
7 pkg <- prepare.new.debian(prepare.pkg(dir,name),extra_deps)
8 if (file.exists(changesfile(pkg$srcname,pkg$debversion))) {
9 message(paste('N: already built',pkg$srcname,'version',pkg$debversion))
13 # delete the current archive (XXX: assumes mini-dinstall)
14 for (subdir in c('mini-dinstall','unstable')) {
15 path = file.path(dinstall_archive,subdir)
16 if (file.exists(path)) {
17 unlink(path,recursive=T)
21 # delete notes of upload
22 file.remove(Sys.glob(file.path(pbuilder_results,'*.upload')))
24 # make mini-dinstall generate the skeleton of the archive
25 ret = system(paste('umask 022;mini-dinstall --batch -c',dinstall_config))
27 stop('failed to create archive')
30 # pull in all the R dependencies
31 message(paste('N: dependencies:',paste(pkg$depends$r,collapse=', ')))
32 for (dep in pkg$depends$r) {
33 message(paste('N: uploading',dep))
34 ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
37 stop('upload of dependency failed! maybe you did not build it first?')
43 ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
44 ,changesfile(pkg$srcname,pkg$debversion)))
46 stop('upload failed!')
52 if (inherits(pkg,'try-error')) {
58 if (exists('argv')) { # check for littler
64 # first argument is the root --- this is dealt with elsewhere.
66 if (!(argv[i] %in% opts)) {
76 err('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 err('usage: cran2deb [-D extra_dep1,extra_dep2,...] package package ...')
89 build_order <- r.dependency.closure(c(extra_deps$r,argv))
90 message(paste('N: build order',paste(build_order,collapse=', ')))
91 for (pkg in build_order) {