X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=trunk%2FR%2Fbuild.R;h=7c4f617b0d46d9d300acc897d1faf47f99c9c911;hb=c48d582b7c5d15d1a57c56f7ff81b8f4168f282f;hp=bddc8e30d42f31a59bc6b389cb06bc662f34594b;hpb=e9d1abd2e82f3a11e862ba1c82e63d7d486e8d20;p=cran2deb.git diff --git a/trunk/R/build.R b/trunk/R/build.R index bddc8e3..7c4f617 100644 --- a/trunk/R/build.R +++ b/trunk/R/build.R @@ -10,7 +10,7 @@ build <- function(name,extra_deps,force=F,do_cleanup=T) { # obtain the Debian version-to-be version <- try(new_build_version(name)) if (inherits(version,'try-error')) { - error('failed to build',name) + error('failed to build in new_build_version: ',name) return(NULL) } @@ -21,7 +21,9 @@ build <- function(name,extra_deps,force=F,do_cleanup=T) { } 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) @@ -33,14 +35,24 @@ build <- function(name,extra_deps,force=F,do_cleanup=T) { file.remove(Sys.glob(file.path(pbuilder_results,'*.upload'))) notice('R dependencies:',paste(pkg$depends$r,collapse=', ')) - build_debian(pkg) + #if (debug) notice(paste("build_debian(",pkg,") invoked\n",sep="")) + build_debian_srcpkg(pkg) + #if (debug) notice(paste("build_debian(",pkg,") completed.\n",sep="")) + # upload the package +# notice("Package upload") ## 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!') - } + +### cmd = paste('umask 002; cd /var/www/cran2deb/rep && reprepro -b . include testing', changesfile(pkg$srcname,pkg$debversion),sep=" ") +### #if (verbose) notice('Executing: ',cmd) +### ret = log_system(cmd) +### if (ret != 0) { +### #fail('upload failed!') +### notice("Upload failed, ignored.") +### } else { +### notice("Upload successful.") +### } ## # wait for mini-dinstall to get to work ## upload_success = FALSE ## for (i in seq(1,12)) { @@ -110,27 +122,46 @@ needs_build <- function(name,version) { if (build$db_version != db_get_version()) { notice('rebuilding',name,': new db version',build$db_version,'(old) vs',db_get_version(),'(new)') } + notice(paste("Now deleting ",debname,", ",srcname,".\n",sep="")) rm(debname,srcname) return(T) } +build_debian_srcpkg <- function(pkg) { +# wd <- getwd() + #notice(paste("Now in path ",wd,"\n",sep="")) +# setwd(pkg$path) + + notice('building Debian source package',pkg$debname,paste('(',pkg$debversion,')',sep=''),'in',getwd(),'...') + + cmd = paste('dpkg-source','-b',pkg$path) + notice(paste("Executing ",'"',cmd,'"'," from directory '",getwd(),"'.\n",sep="")) + ret = log_system(cmd) +# setwd(wd) + if (ret != 0) { + fail('Failed to build package.') + } + return(ret); +} + build_debian <- function(pkg) { wd <- getwd() + #notice(paste("Now in path ",wd,"\n",sep="")) setwd(pkg$path) - notice('building Debian package' - ,pkg$debname - ,paste('(',pkg$debversion,')',sep='') - ,'...') + + notice('building Debian package',pkg$debname,paste('(',pkg$debversion,')',sep=''),'in',getwd(),'...') cmd = paste('pdebuild --configfile',shQuote(pbuilder_config)) if (version_revision(pkg$debversion) > 2) { cmd = paste(cmd,'--debbuildopts','-sd') notice('build should exclude 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.') } + return(ret); }