]> git.donarmstrong.com Git - cran2deb.git/blobdiff - trunk/R/build.R
add blacklist. build packages already in debian.
[cran2deb.git] / trunk / R / build.R
index 4ca1923830206a589b2e360a6cc3e11e35f3b8eb..157c888738ffb2ada70c6de4a2f54505c74d3456 100644 (file)
@@ -20,44 +20,19 @@ build <- function(name,extra_deps,force=F) {
             return(NULL)
         }
 
+        if (name %in% db_blacklist_packages()) {
+            fail('package',name,'is blacklisted. consult database for reason.')
+        }
+
         pkg <- prepare_new_debian(prepare_pkg(dir,name),extra_deps)
         if (pkg$debversion != version) {
             fail('expected Debian version',version,'not equal to actual version',pkg$debversion)
         }
-        # delete the current archive (XXX: assumes mini-dinstall)
-        for (subdir in c('mini-dinstall','unstable')) {
-            path = file.path(dinstall_archive,subdir)
-            if (file.exists(path)) {
-                unlink(path,recursive=T)
-            }
-        }
 
         # delete notes of upload
         file.remove(Sys.glob(file.path(pbuilder_results,'*.upload')))
 
-        # make mini-dinstall generate the skeleton of the archive
-        ret = log_system('umask 002;mini-dinstall --batch -c',dinstall_config)
-        if (ret != 0) {
-            fail('failed to create archive')
-        }
-
-        # pull in all the R dependencies
         notice('R dependencies:',paste(pkg$depends$r,collapse=', '))
-        for (dep in pkg$depends$r) {
-            if (pkgname_as_debian(dep) %in% debian_pkgs) {
-                notice('using Debian package of',dep)
-                next
-            }
-            # otherwise, convert to source package name
-            srcdep = pkgname_as_debian(dep,binary=F)
-
-            notice('uploading',srcdep)
-            ret = log_system('umask 002;dput','-c',shQuote(dput_config),'local'
-                        ,changesfile(srcdep))
-            if (ret != 0) {
-                fail('upload of dependency failed! maybe you did not build it first?')
-            }
-        }
         build_debian(pkg)
 
         # upload the package
@@ -67,15 +42,6 @@ build <- function(name,extra_deps,force=F) {
             fail('upload failed!')
         }
 
-        # delete the current archive (XXX: assumes mini-dinstall)
-        # this is handy for group operation
-        for (subdir in c('mini-dinstall','unstable')) {
-            path = file.path(dinstall_archive,subdir)
-            if (file.exists(path)) {
-                unlink(path,recursive=T)
-            }
-        }
-
         return(pkg$debversion)
     })())
     cleanup(dir)
@@ -107,6 +73,7 @@ needs_build <- function(name,version) {
         }
     } else {
         # always rebuild on failure or no record
+        notice('rebuilding',name,': no build record or previous build failed')
         return(T)
     }
     # see if it has already been built
@@ -117,12 +84,15 @@ needs_build <- function(name,version) {
         return(F)
     }
 
-    # XXX: what about building newer versions of Debian packages?
-    if (debname %in% debian_pkgs) {
-        notice(srcname,' exists in Debian (perhaps a different version)')
-        return(F)
+    if (build$r_version != version_upstream(version)) {
+        notice('rebuilding',name,': new upstream version',build$r_version,'(old) vs',version_upstream(version),'(new)')
+    }
+    if (build$deb_epoch != version_epoch(version)) {
+        notice('rebuilding',name,': new cran2deb epoch',build$deb_epoch,'(old) vs',version_epoch(version),'(new)')
+    }
+    if (build$db_version != db_get_version()) {
+        notice('rebuilding',name,': new db version',build$db_version,'(old) vs',db_get_version(),'(new)')
     }
-
     rm(debname,srcname)
     return(T)
 }