From 498762e48d0f10a759c6994c4fafa27dd0963f05 Mon Sep 17 00:00:00 2001 From: blundellc Date: Sat, 13 Sep 2008 17:07:05 +0000 Subject: [PATCH] db: record which system a particular build was for. the biggest side-effect of this change is the database schema must change in a way that sqlite will not let happen without rebuilding the database. (Hence take this opportunity to rename git_revision to scm_revision.) cran2deb essentially behaves as if it cannot see any builds for any system other than the currently configured one. Also: note some changes in the documentation. One bit just has a fat warning as I am feeling lazy. Sorry. git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@158 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- branch/multisys/R/db.R | 11 ++++++++--- branch/multisys/R/debianpkg.R | 4 ++-- branch/multisys/R/zzz.R | 18 +++++++++--------- branch/multisys/data/pull | 5 +++++ branch/multisys/exec/update | 2 +- .../multisys/exec/{which_sys => which_system} | 2 +- branch/multisys/inst/doc/INSTALL_NOTES | 6 ++++++ branch/multisys/inst/doc/README | 6 ++++-- 8 files changed, 36 insertions(+), 18 deletions(-) create mode 100755 branch/multisys/data/pull rename branch/multisys/exec/{which_sys => which_system} (89%) diff --git a/branch/multisys/R/db.R b/branch/multisys/R/db.R index 5c9836d..82fa1d4 100644 --- a/branch/multisys/R/db.R +++ b/branch/multisys/R/db.R @@ -53,16 +53,17 @@ db_start <- function() { if (!dbExistsTable(con,'builds')) { dbGetQuery(con,paste('CREATE TABLE builds (' ,' id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL' + ,',system TEXT NOT NULL' ,',package TEXT NOT NULL' ,',r_version TEXT NOT NULL' ,',deb_epoch INTEGER NOT NULL' ,',deb_revision INTEGER NOT NULL' ,',db_version INTEGER NOT NULL' ,',date_stamp TEXT NOT NULL' - ,',git_revision TEXT NOT NULL' # legacy: really scm_revision + ,',scm_revision TEXT NOT NULL' ,',success INTEGER NOT NULL' ,',log TEXT' - ,',UNIQUE(package,r_version,deb_epoch,deb_revision,db_version)' + ,',UNIQUE(package,system,r_version,deb_epoch,deb_revision,db_version)' ,')')) } return(con) @@ -286,9 +287,10 @@ db_update_package_versions <- function() { db_record_build <- function(package, deb_version, log, success=F) { con <- db_start() dbGetQuery(con,paste('INSERT OR REPLACE INTO builds' - ,'(package,r_version,deb_epoch,deb_revision,db_version,success,date_stamp,git_revision,log)' + ,'(package,system,r_version,deb_epoch,deb_revision,db_version,success,date_stamp,scm_revision,log)' ,'VALUES' ,'(',db_quote(package) + ,',',db_quote(which_system) ,',',db_quote(version_upstream(deb_version)) ,',',db_quote(version_epoch(deb_version)) ,',',db_quote(version_revision(deb_version)) @@ -306,6 +308,7 @@ db_builds <- function(pkgname) { con <- db_start() build <- dbGetQuery(con, paste('SELECT * FROM builds' ,'WHERE success = 1' + ,'AND system =',db_quote(which_system) ,'AND package =',db_quote(pkgname))) db_stop(con) if (length(build) == 0) { @@ -319,6 +322,7 @@ db_latest_build <- function(pkgname) { con <- db_start() build <- dbGetQuery(con, paste('SELECT * FROM builds' ,'NATURAL JOIN (SELECT package,max(id) AS max_id FROM builds' + , 'WHERE system =',db_quote(which_system) , 'GROUP BY package) AS last' ,'WHERE id = max_id' ,'AND builds.package =',db_quote(pkgname))) @@ -353,6 +357,7 @@ db_outdated_packages <- function() { # extract the latest attempt at building each package , 'SELECT * FROM builds' , 'NATURAL JOIN (SELECT package,max(id) AS max_id FROM builds' + , 'WHERE system =',db_quote(which_system) , 'GROUP BY package) AS last' , 'WHERE id = max_id) AS build' ,'ON build.package = packages.package' diff --git a/branch/multisys/R/debianpkg.R b/branch/multisys/R/debianpkg.R index f2aa115..cd4cd03 100644 --- a/branch/multisys/R/debianpkg.R +++ b/branch/multisys/R/debianpkg.R @@ -6,7 +6,7 @@ append_build_from_pkg <- function(pkg, builds) { ,deb_revision = version_revision(pkg$debversion) ,db_version = db_get_version() ,date_stamp = pkg$date_stamp - ,git_revision = scm_revision + ,scm_revision = scm_revision ,success = 1 # never used ,log = '' # never used ) @@ -24,7 +24,7 @@ generate_changelog_entry <- function(build, changelog) { # TODO: should say 'New upstream release' when necessary debversion <- version_new(build$r_version, build$deb_revision, build$deb_epoch) cat(paste(paste(build$srcname,' (',debversion,') unstable; urgency=low',sep='') - ,'' ,paste(' * cran2deb ',build$git_revision + ,'' ,paste(' * cran2deb ',build$scm_revision ,' with DB version ',as.integer(build$db_version),'.',sep='') ,'',paste(' --',maintainer,'',build$date_stamp) ,'','','',sep='\n'),file=changelog, append=TRUE) diff --git a/branch/multisys/R/zzz.R b/branch/multisys/R/zzz.R index 54f1b21..9bf3047 100644 --- a/branch/multisys/R/zzz.R +++ b/branch/multisys/R/zzz.R @@ -1,18 +1,18 @@ .First.lib <- function(libname, pkgname) { global <- function(name,value) assign(name,value,envir=.GlobalEnv) - global("which_sys", Sys.getenv('CRAN2DEB_SYS','debian-amd64')) - if (!length(grep('^[a-z]+-[a-z0-9]+$',which_sys))) { + global("which_system", Sys.getenv('CRAN2DEB_SYS','debian-amd64')) + if (!length(grep('^[a-z]+-[a-z0-9]+$',which_system))) { stop('Invalid system specification: must be of the form name-arch') } - global("host_arch", gsub('^[a-z]+-','',which_sys)) + global("host_arch", gsub('^[a-z]+-','',which_system)) global("maintainer", 'cran2deb autobuild ') global("root", system.file(package='cran2deb')) global("cache_root", '/var/cache/cran2deb') - global("pbuilder_results", file.path('/var/cache/cran2deb/results',which_sys)) - global("pbuilder_config", file.path('/etc/cran2deb/sys',which_sys,'pbuilderrc')) - global("dput_config", file.path('/etc/cran2deb/sys',which_sys,'dput.cf')) - global("dinstall_config", file.path('/etc/cran2deb/sys',which_sys,'mini-dinstall.conf')) - global("dinstall_archive", file.path('/etc/cran2deb/archive',which_sys)) + global("pbuilder_results", file.path('/var/cache/cran2deb/results',which_system)) + global("pbuilder_config", file.path('/etc/cran2deb/sys',which_system,'pbuilderrc')) + global("dput_config", file.path('/etc/cran2deb/sys',which_system,'dput.cf')) + global("dinstall_config", file.path('/etc/cran2deb/sys',which_system,'mini-dinstall.conf')) + global("dinstall_archive", file.path('/etc/cran2deb/archive',which_system)) global("r_depend_fields", c('Depends','Imports')) # Suggests, Enhances global("scm_revision", 'svn:$Id$') global("changesfile", function(srcname,version='*') { @@ -25,5 +25,5 @@ if (file.exists(cache)) { load(cache,envir=.GlobalEnv) } - message(paste('I: cran2deb',scm_revision,'building for',which_sys)) + message(paste('I: cran2deb',scm_revision,'building for',which_system)) } diff --git a/branch/multisys/data/pull b/branch/multisys/data/pull new file mode 100755 index 0000000..f2b7bdc --- /dev/null +++ b/branch/multisys/data/pull @@ -0,0 +1,5 @@ +#!/bin/sh +cran2deb depend ls aliases >populate_depend_aliases +cran2deb depend ls force >populate_forcedep +cran2deb depend ls sysreq >populate_sysreq +echo NOTE: you need to update populate_licenses manually! diff --git a/branch/multisys/exec/update b/branch/multisys/exec/update index 5b0d1d1..7d466b9 100755 --- a/branch/multisys/exec/update +++ b/branch/multisys/exec/update @@ -8,7 +8,7 @@ umask 002 root=$1 shift -sys=`{cran2deb which_sys} +sys=`{cran2deb which_system} mkdir -p /var/cache/cran2deb/results/$sys || exit 1 mini-dinstall --batch -c /etc/cran2deb/sys/$sys/mini-dinstall.conf || exit 1 update_period=10800 diff --git a/branch/multisys/exec/which_sys b/branch/multisys/exec/which_system similarity index 89% rename from branch/multisys/exec/which_sys rename to branch/multisys/exec/which_system index 2426b9a..76800de 100755 --- a/branch/multisys/exec/which_sys +++ b/branch/multisys/exec/which_system @@ -4,4 +4,4 @@ ## DOC: suppressMessages(library(cran2deb)) -cat(which_sys) +cat(which_system) diff --git a/branch/multisys/inst/doc/INSTALL_NOTES b/branch/multisys/inst/doc/INSTALL_NOTES index 4d47890..47d2298 100644 --- a/branch/multisys/inst/doc/INSTALL_NOTES +++ b/branch/multisys/inst/doc/INSTALL_NOTES @@ -1,3 +1,9 @@ +*WARNING* This is not up to date! The major difference is that now we have +*WARNING* system-specific configurations, archives and results, so that several +*WARNING* of the paths have either a 'sys/FOO' part or a 'FOO' part where FOO +*WARNING* is something like debian-amd64, debian-i386.. + + git clone git://github.com/blundellc/cran2deb.git apt-get system requirements from DESCRIPTION diff --git a/branch/multisys/inst/doc/README b/branch/multisys/inst/doc/README index b521da0..927ad38 100644 --- a/branch/multisys/inst/doc/README +++ b/branch/multisys/inst/doc/README @@ -13,12 +13,14 @@ To configure: 1. You need a web server serving from say, /var/www/cran2deb/ Let ROOT be the value returned by running: cran2deb root +Let SYS be the system you wish to build for (e.g., debian-amd64) 2. create /etc/cran2deb - a. copy ROOT/etc/* into /etc/cran2deb + a. copy ROOT/etc/* into /etc/cran2deb/sys/SYS/ b. /etc/cran2deb/archive should be a symlink pointing to /var/www/cran2deb/ $ ln -s /var/www/cran2deb/ /etc/cran2deb/archive + $ mkdir /var/www/cran2deb/SYS c. modify OTHERMIRROR of /etc/cran2deb/pbuilderrc.in to point to your webserver @@ -26,7 +28,7 @@ Let ROOT be the value returned by running: cran2deb root /var/cache/cran2deb, writable by whichever user(s) will run cran2deb. 4. run: cran2deb update 5. Try building a simple package: cran2deb build zoo - (The result will be in /var/cache/cran2deb/results) + (The result will be in /var/cache/cran2deb/results/SYS) $ cran2deb help -- 2.39.5