]> git.donarmstrong.com Git - cran2deb.git/blobdiff - trunk/R/build.R
Improving compliance to Debian policy with the
[cran2deb.git] / trunk / R / build.R
index 157c888738ffb2ada70c6de4a2f54505c74d3456..6eb3b80fc6fe23cc108a72be3abcdaee81468c6a 100644 (file)
@@ -1,5 +1,5 @@
 
-build <- function(name,extra_deps,force=F) {
+build <- function(name,extra_deps,force=F,do_cleanup=T) {
     # can't, and hence don't need to, build base packages
     if (name %in% base_pkgs) {
         return(T)
@@ -21,7 +21,9 @@ build <- function(name,extra_deps,force=F) {
         }
 
         if (name %in% db_blacklist_packages()) {
-            fail('package',name,'is blacklisted. consult database for reason.')
+            #fail('package',name,'is blacklisted. consult database for reason.')
+            notice('package',name,'is blacklisted. consult database for reason.')
+            return(NULL)
         }
 
         pkg <- prepare_new_debian(prepare_pkg(dir,name),extra_deps)
@@ -36,15 +38,32 @@ build <- function(name,extra_deps,force=F) {
         build_debian(pkg)
 
         # upload the package
-        ret = log_system('umask 002;dput','-c',shQuote(dput_config),'local'
-                    ,changesfile(pkg$srcname,pkg$debversion))
+##         ret = log_system('umask 002;dput','-c',shQuote(dput_config),'local' ,changesfile(pkg$srcname,pkg$debversion))
+        ret = log_system('umask 002; cd /var/www/rep; reprepro -b . include testing', changesfile(pkg$srcname,pkg$debversion))
         if (ret != 0) {
             fail('upload failed!')
         }
+##         # wait for mini-dinstall to get to work
+##         upload_success = FALSE
+##         for (i in seq(1,12)) {
+##             if (file.exists(file.path(dinstall_archive,'testing',paste(pkg$srcname, '_', pkg$version, '.orig.tar.gz', sep='')))) {
+##                 upload_success = TRUE
+##                 break
+##             }
+##             warn(i,'/12: does not exist',file.path(dinstall_archive,'testing',paste(pkg$srcname, '_', pkg$version, '.orig.tar.gz', sep='')))
 
+##             Sys.sleep(5)
+##         }
+##         if (!upload_success) {
+##             warn('upload took too long; continuing as normal (some builds may fail temporarily)')
+##         }
         return(pkg$debversion)
     })())
-    cleanup(dir)
+    if (do_cleanup) {
+        cleanup(dir)
+    } else {
+        notice('output is in',dir,'. you must clean this up yourself.')
+    }
     if (is.null(result)) {
         # nothing was done so escape asap.
         return(result)
@@ -76,7 +95,7 @@ needs_build <- function(name,version) {
         notice('rebuilding',name,': no build record or previous build failed')
         return(T)
     }
-    # see if it has already been built
+    # see if it has already been built *and* successfully uploaded
     srcname <- pkgname_as_debian(name,binary=F)
     debname <- pkgname_as_debian(name,binary=T)
     if (file.exists(changesfile(srcname, version))) {