]> git.donarmstrong.com Git - cran2deb.git/commitdiff
use debuild instead of dpkg-source
authorDon Armstrong <don@donarmstrong.com>
Tue, 26 Feb 2013 02:18:45 +0000 (18:18 -0800)
committerDon Armstrong <don@donarmstrong.com>
Tue, 26 Feb 2013 02:18:45 +0000 (18:18 -0800)
put results in the proper location

trunk/R/build.R

index 1839e016705ae6b97c8115e9d264082abbf8419c..911e3f6ba240e103a6d73eb1a61cdb3d9a0c2507 100644 (file)
@@ -130,19 +130,37 @@ needs_build <- function(name,version) {
 build_debian_srcpkg <- function(pkg) {
     wd <- getwd()
     #notice(paste("Now in path ",wd,"\n",sep=""))
-    setwd(pbuilder_results)
-   
+    setwd(pkg$path)
+    
     notice('building Debian source package',pkg$debname,paste('(',pkg$debversion,')',sep=''),'in',getwd(),'...')
 
-    cmd = paste('dpkg-source','-b',pkg$path)
+    
+    cmd = paste('debuild -uc -us -d -S -nc')
+    if (version_revision(pkg$debversion) > 2) {
+      cmd = paste(cmd,'-sd')
+      notice('build should exclude original source')
+    }
+    else {
+      cmd = paste(cmd,'-sa')
+      notice('build should include original source')
+    }
     notice(paste("Executing ",'"',cmd,'"'," from directory '",getwd(),"'.\n",sep=""))
     ret = log_system(cmd)
     setwd(wd)
     if (ret != 0) {
         fail('Failed to build package.')
     }
+    else { # copy the build results into the appropriate location
+      changes.fn <- list.files(path=dirname(pkg$path),pattern="\\.changes$")
+      changes.file <- readLines(file.path(dirname(pkg$path),changes.fn))
+      ## extract out the files that belong to the changes file
+      srcpkg.files <- gsub(".+ ","",changes.file[(which(changes.file=="Files: ")+1):NROW(changes.file)])
+      for (file in c(srcpkg.files,changes.fn)) {
+        file.copy(file.path(dirname(pkg$path),file),file.path(pbuilder_results,file));
+      }
+    }
     return(ret);
-ls}
+}
 
 build_debian <- function(pkg) {
     wd <- getwd()