2 build <- function(name,extra_deps) {
5 version <- new_build_version(name)
6 result <- try((function() {
7 # see if it has already been built
8 srcname <- pkgname_as_debian(name,binary=F)
9 debname <- pkgname_as_debian(name,binary=T)
10 if (file.exists(changesfile(srcname, version))) {
11 notice('already built',srcname,'version',version)
14 # XXX: what about building newer versions?
15 if (debname %in% debian_pkgs) {
16 notice(srcname,' exists in Debian (perhaps a different version)')
22 pkg <- prepare_new_debian(prepare_pkg(dir,name),extra_deps)
23 # delete the current archive (XXX: assumes mini-dinstall)
24 for (subdir in c('mini-dinstall','unstable')) {
25 path = file.path(dinstall_archive,subdir)
26 if (file.exists(path)) {
27 unlink(path,recursive=T)
31 # delete notes of upload
32 file.remove(Sys.glob(file.path(pbuilder_results,'*.upload')))
34 # make mini-dinstall generate the skeleton of the archive
35 ret = system(paste('umask 022;mini-dinstall --batch -c',dinstall_config))
37 fail('failed to create archive')
40 # pull in all the R dependencies
41 notice('dependencies:',paste(pkg$depends$r,collapse=', '))
42 for (dep in pkg$depends$r) {
43 if (pkgname_as_debian(dep) %in% debian_pkgs) {
44 notice('using Debian package of',dep)
47 # otherwise, convert to source package name
48 srcdep = pkgname_as_debian(dep,binary=F)
50 notice('uploading',srcdep)
51 ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
52 ,changesfile(srcdep)))
54 fail('upload of dependency failed! maybe you did not build it first?')
60 ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
61 ,changesfile(pkg$srcname,pkg$debversion)))
63 fail('upload failed!')
66 return(pkg$debversion)
70 # nothing was done so escape asap.
73 # otherwise record progress
74 failed = inherits(result,'try-error')
76 error('failure of',name,'means these packages will fail:'
77 ,paste(r_dependency_closure(name,forward_arcs=F),collapse=', '))
79 db_record_build(name, version, log_retrieve(), !failed)
83 build_debian <- function(pkg) {
86 notice('building Debian package'
88 ,paste('(',pkg$debversion,')',sep='')
91 cmd = paste('pdebuild --configfile',shQuote(pbuilder_config))
92 if (version_revision(pkg$debversion) > 2) {
93 cmd = paste(cmd,'--debbuildopts','-sd')
98 fail('Failed to build package.')