]> git.donarmstrong.com Git - cran2deb.git/commitdiff
db: record which system a particular build was for.
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 17:07:05 +0000 (17:07 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 17:07:05 +0000 (17:07 +0000)
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
branch/multisys/R/debianpkg.R
branch/multisys/R/zzz.R
branch/multisys/data/pull [new file with mode: 0755]
branch/multisys/exec/update
branch/multisys/exec/which_sys [deleted file]
branch/multisys/exec/which_system [new file with mode: 0755]
branch/multisys/inst/doc/INSTALL_NOTES
branch/multisys/inst/doc/README

index 5c9836d87844f361dd3fe7512ba3ed32730e8a66..82fa1d45a1dcb227d121dc8419ed0480d2128f9c 100644 (file)
@@ -53,16 +53,17 @@ db_start <- function() {
     if (!dbExistsTable(con,'builds')) {
         dbGetQuery(con,paste('CREATE TABLE builds ('
                   ,' id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL'
     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'
                   ,',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'
                   ,',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)
                   ,')'))
     }
     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'
 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)
                         ,'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))
                         ,',',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'
     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) {
                        ,'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'
     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)))
                        ,              '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'
                # 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'
                ,                    'GROUP BY package) AS last'
                ,      'WHERE id = max_id) AS build'
                ,'ON build.package = packages.package'
index f2aa1153497a3674d33410d4f7dc7f82ca8de4b4..cd4cd0313b988d33d9a57e0118b89364b8551eb4 100644 (file)
@@ -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
                            ,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
                            )
                            ,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='')
     # 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)
                        ,' with DB version ',as.integer(build$db_version),'.',sep='')
              ,'',paste(' --',maintainer,'',build$date_stamp)
              ,'','','',sep='\n'),file=changelog, append=TRUE)
index 54f1b214782088e969681a36feb4feb93dabd030..9bf3047c14457d46c6ba4d01d2da86f7b64ff0cb 100644 (file)
@@ -1,18 +1,18 @@
 .First.lib <- function(libname, pkgname) {
     global <- function(name,value) assign(name,value,envir=.GlobalEnv)
 .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')
     }
         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 <cran2deb@example.org>')
     global("root", system.file(package='cran2deb'))
     global("cache_root", '/var/cache/cran2deb')
     global("maintainer", 'cran2deb autobuild <cran2deb@example.org>')
     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='*') {
     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)
     }
     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 (executable)
index 0000000..f2b7bdc
--- /dev/null
@@ -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!
index 5b0d1d1bec237054f33c5554e8deacff1fb943fb..7d466b91fd49290b05f40d29ca296b447ae1186b 100755 (executable)
@@ -8,7 +8,7 @@
 umask 002
 root=$1
 shift
 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
 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_sys
deleted file mode 100755 (executable)
index 2426b9a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env r
-## DOC: cran2deb which_sys
-## DOC:     show which system cran2deb will build for next
-## DOC:
-suppressMessages(library(cran2deb))
-
-cat(which_sys)
diff --git a/branch/multisys/exec/which_system b/branch/multisys/exec/which_system
new file mode 100755 (executable)
index 0000000..76800de
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env r
+## DOC: cran2deb which_sys
+## DOC:     show which system cran2deb will build for next
+## DOC:
+suppressMessages(library(cran2deb))
+
+cat(which_system)
index 4d47890900fa047990e26153de285fecf0dc8964..47d22984e09ca25ab9a0ed00fde8ea68d9cbefa7 100644 (file)
@@ -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
 git clone git://github.com/blundellc/cran2deb.git
 
 apt-get system requirements from DESCRIPTION
index b521da06717445f7db29cfbda2c6f64757850efa..927ad38917ec1f444d9956da78c34303e3dd3654 100644 (file)
@@ -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
 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
 
 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
    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
 
 
    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
     /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
 
 
 $ cran2deb help