cran2deb: correct cran2deb dependencies. make cran2deb a meta-executable.
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:16:58 +0000 (13:16 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:16:58 +0000 (13:16 +0000)
'cran2deb' is a script that determines the root of the cran2deb R
package installation and then invokes some other executable with this
root as the first argument. e.g.,
$ cran2deb update
$ cran2deb build zoo

The README file now includes details of what must be done to use
cran2deb.

git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@48 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

13 files changed:
pkg/trunk/DESCRIPTION
pkg/trunk/R/debcontrol.R
pkg/trunk/R/zzz.R
pkg/trunk/README
pkg/trunk/exec/build [new file with mode: 0755]
pkg/trunk/exec/cran2deb
pkg/trunk/exec/help [new file with mode: 0755]
pkg/trunk/exec/root [new file with mode: 0755]
pkg/trunk/exec/setup [deleted file]
pkg/trunk/exec/update [new file with mode: 0755]
pkg/trunk/exec/update_available [deleted file]
pkg/trunk/exec/update_cache [new file with mode: 0755]
pkg/trunk/inst/etc/pbuilderrc.in

index 1bfa413ba0d44294110e9a4de3ee4c49f98a4777..ecd30f795718adf62e2eaa98c9695ec268265c03 100644 (file)
@@ -5,6 +5,7 @@ Title: Convert CRAN packages into Debian packages
 Author: Charles Blundell <blundellc@gmail.com>, with assistance from Dirk Eddelbuettel <>
 Maintainer: Charles Blundell <blundellc@gmail.com>
 Depends: ctv, utils
+SystemRequirements: rc
 Description: Convert CRAN packages into Debian packages, mostly unassisted, easily
  subverting the R package system.
 License: GPL-3
index ea25962ba528f47a01e906a513d837cdfff5fc34..1639369c84b6a0f009763f75fc038fe5161158cc 100644 (file)
@@ -25,7 +25,7 @@ get.dependencies <- function(pkg,extra_deps) {
         depends$bin   = c(depends$bin,  pkgname.as.debian('R',version='>= 2.7.0',binary=T))
     }
     # also include stuff to allow tcltk to build (suggested by Dirk)
-    depends$build = c(depends$build,'xvfb','xauth','xfont-base')
+    depends$build = c(depends$build,'xvfb','xauth','xfonts-base')
 
     # remove duplicates
     depends <- lapply(depends,unique)
index a57cc3a8c37a584012b158b96e117edea77e493d..6361ea75b31e617082549cb7b9791590945b86bd 100644 (file)
@@ -6,7 +6,7 @@ changesfile <- function(srcname,version='*') {
 }
 
 maintainer <- 'cran2deb buildbot <cran2deb@example.org>'
-root <- system.file('')
+root <- system.file(package='cran2deb')
 pbuilder_results <- file.path(root,'var/results')
 pbuilder_config  <- file.path(root,'etc/pbuilderrc')
 dput_config      <- file.path(root,'etc/dput.cf')
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9b1c581fd8c9371c836f69e7fc25ab18830dc518 100644 (file)
@@ -0,0 +1,24 @@
+To install:
+
+$ cd ..
+$ R CMD INSTALL cran2deb
+
+copy cran2deb/exec/cran2deb into somewhere in your executable path (e.g.,
+/usr/local/bin, $home/bin)
+
+
+
+To configure:
+
+1. You need a web server serving from say, /var/www/cran2deb/
+
+Let ROOT be the value returned by running: cran2deb root
+
+2. ROOT/var/archive should be a symlink pointing to /var/www/cran2deb/
+    $ rm ROOT/var/archive
+    $ ln -s /var/www/cran2deb/ ROOT/var/archive
+3. modify OTHERMIRROR of ROOT/etc/pbuilderrc.in to point to your webserver
+4. run: cran2deb update
+5. Try building a simple package: cran2deb build zoo
+   (The result will be in ROOT/var/results)
+
diff --git a/pkg/trunk/exec/build b/pkg/trunk/exec/build
new file mode 100755 (executable)
index 0000000..5678f28
--- /dev/null
@@ -0,0 +1,95 @@
+#!/usr/bin/env r
+suppressMessages(library(cran2deb))
+go <- function(name,extra_deps) {
+    dir <- setup()
+    pkg <- try((function() {
+        pkg <- prepare.new.debian(prepare.pkg(dir,name),extra_deps)
+        if (file.exists(changesfile(pkg$srcname,pkg$debversion))) {
+            message(paste('N: already built',pkg$srcname,'version',pkg$debversion))
+            return(pkg)
+        }
+
+        # 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 = system(paste('umask 022;mini-dinstall --batch -c',dinstall_config))
+        if (ret != 0) {
+            stop('failed to create archive')
+        }
+
+        # pull in all the R dependencies
+        message(paste('N: dependencies:',paste(pkg$depends$r,collapse=', ')))
+        for (dep in pkg$depends$r) {
+            message(paste('N: uploading',dep))
+            ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
+                        ,changesfile(dep)))
+            if (ret != 0) {
+                stop('upload of dependency failed! maybe you did not build it first?')
+            }
+        }
+        build.debian(pkg)
+
+        # upload the package
+        ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
+                    ,changesfile(pkg$srcname,pkg$debversion)))
+        if (ret != 0) {
+            stop('upload failed!')
+        }
+
+        return(pkg)
+    })())
+    cleanup(dir)
+    if (inherits(pkg,'try-error')) {
+        stop(call.=F)
+    }
+    return(pkg)
+}
+
+if (exists('argv')) { # check for littler
+    argc <- length(argv)
+    extra_deps = list()
+    extra_deps$deb = c()
+    extra_deps$r = c()
+    opts = c('-D','-R')
+    # first argument is the root --- this is dealt with elsewhere.
+    for (i in 2:argc) {
+        if (!(argv[i] %in% opts)) {
+            if (argc >= i) {
+                argv <- argv[i:argc]
+            } else {
+                argv <- list()
+            }
+            argc = argc - i + 1
+            break
+        }
+        if (i == argc) {
+            message('E: missing argument')
+            q(save='no')
+        }
+        if (argv[i] == '-D') {
+            extra_deps$deb = c(extra_deps$deb,strsplit(chomp(argv[i+1]),',')[[1]])
+        }
+        if (argv[i] == '-R') {
+            extra_deps$r = c(extra_deps$r,strsplit(chomp(argv[i+1]),',')[[1]])
+            extra_deps$deb = c(extra_deps$deb,lapply(extra_deps$r,pkgname.as.debian))
+        }
+    }
+    if (argc == 0) {
+        message('E: usage: cran2deb [-D extra_dep1,extra_dep2,...] package package ...')
+        q(save='no')
+    }
+    build_order <- r.dependency.closure(c(extra_deps$r,argv))
+    message(paste('N: build order',paste(build_order,collapse=', ')))
+    for (pkg in build_order) {
+        go(pkg,extra_deps)
+    }
+}
index fc6c45cb78140bafaa475d81239b1bc989c91289..a28879c260e6b6c02be361f0f05407f82c5955ea 100755 (executable)
@@ -1,94 +1,9 @@
-#!/usr/bin/env r
-library(cran2deb)
-go <- function(name,extra_deps) {
-    dir <- setup()
-    pkg <- try((function() {
-        pkg <- prepare.new.debian(prepare.pkg(dir,name),extra_deps)
-        if (file.exists(changesfile(pkg$srcname,pkg$debversion))) {
-            message(paste('N: already built',pkg$srcname,'version',pkg$debversion))
-            return(pkg)
-        }
-
-        # 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 = system(paste('umask 022;mini-dinstall --batch -c',dinstall_config))
-        if (ret != 0) {
-            stop('failed to create archive')
-        }
-
-        # pull in all the R dependencies
-        message(paste('N: dependencies:',paste(pkg$depends$r,collapse=', ')))
-        for (dep in pkg$depends$r) {
-            message(paste('N: uploading',dep))
-            ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
-                        ,changesfile(dep)))
-            if (ret != 0) {
-                stop('upload of dependency failed! maybe you did not build it first?')
-            }
-        }
-        build.debian(pkg)
-
-        # upload the package
-        ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local'
-                    ,changesfile(pkg$srcname,pkg$debversion)))
-        if (ret != 0) {
-            stop('upload failed!')
-        }
-
-        return(pkg)
-    })())
-    cleanup(dir)
-    if (inherits(pkg,'try-error')) {
-        stop(call.=F)
-    }
-    return(pkg)
-}
-
-if (exists('argv')) { # check for littler
-    argc <- length(argv)
-    extra_deps = list()
-    extra_deps$deb = c()
-    extra_deps$r = c()
-    opts = c('-D','-R')
-    for (i in 1:argc) {
-        if (!(argv[i] %in% opts)) {
-            if (argc >= i) {
-                argv <- argv[i:argc]
-            } else {
-                argv <- list()
-            }
-            argc = argc - i + 1
-            break
-        }
-        if (i == argc) {
-            message('E: missing argument')
-            q(save='no')
-        }
-        if (argv[i] == '-D') {
-            extra_deps$deb = c(extra_deps$deb,strsplit(chomp(argv[i+1]),',')[[1]])
-        }
-        if (argv[i] == '-R') {
-            extra_deps$r = c(extra_deps$r,strsplit(chomp(argv[i+1]),',')[[1]])
-            extra_deps$deb = c(extra_deps$deb,lapply(extra_deps$r,pkgname.as.debian))
-        }
-    }
-    if (argc == 0) {
-        message('E: usage: cran2deb [-D extra_dep1,extra_dep2,...] package package ...')
-        q(save='no')
-    }
-    build_order <- r.dependency.closure(c(extra_deps$r,argv))
-    message(paste('N: build order',paste(build_order,collapse=', ')))
-    for (pkg in build_order) {
-        go(pkg,extra_deps)
-    }
+#!/usr/bin/rc
+root=`{r -e 'suppressMessages(library(cran2deb));cat(system.file(package=''cran2deb''),file=stdout())'}
+cmd=$1
+shift
+if ([ ! -x $root/exec/$cmd ]) {
+    echo unknown command $cmd
+    exit 1
 }
+$root/exec/$cmd $root $*
diff --git a/pkg/trunk/exec/help b/pkg/trunk/exec/help
new file mode 100755 (executable)
index 0000000..6be441e
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/rc
+echo usage: cran2deb '<cmd> [args ...]'
+echo where '<cmd>' is one of
+ls $1/exec
+echo
+echo installation root is: $1
diff --git a/pkg/trunk/exec/root b/pkg/trunk/exec/root
new file mode 100755 (executable)
index 0000000..7294588
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/rc
+echo $1
diff --git a/pkg/trunk/exec/setup b/pkg/trunk/exec/setup
deleted file mode 100755 (executable)
index 011bd12..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/rc
-umask 022
-root=`{r -e 'library(cran2deb);cat(system.file('''',package=''cran2deb''),file=stdout())'}
-for (x in `{find etc -type f -name '*.in'}) {
-    y=`{echo $x | sed -e 's,.in$,,'}
-    sed -e 's:@ROOT@:'^$root^':g' <$x >$y
-}
-mkdir -p var/results
-if ([ ! -e var/archive ]) {
-    # I symbolically link this into /var/www/
-    mkdir var/archive
-}
-mini-dinstall --batch -c $root/etc/mini-dinstall.conf || exit 1
-mode=create
-if ([ -e /var/cache/pbuilder/base.tgz ]) {
-    mode=update
-}
-sudo pbuilder $mode --override-config --configfile $root/etc/pbuilderrc
-./update_available
diff --git a/pkg/trunk/exec/update b/pkg/trunk/exec/update
new file mode 100755 (executable)
index 0000000..5e80c2a
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/rc
+umask 022
+root=$1
+shift
+for (x in `{find $root/etc -type f -name '*.in'}) {
+    y=`{echo $x | sed -e 's,.in$,,'}
+    sed -e 's:@ROOT@:'^$root^':g' <$x >$y
+}
+mkdir -p $root/var/results
+if ([ ! -e $root/var/archive ]) {
+    # I symbolically link this into /var/www/
+    mkdir $root/var/archive
+}
+mini-dinstall --batch -c $root/etc/mini-dinstall.conf || exit 1
+mode=create
+if ([ -e /var/cache/pbuilder/base.tgz ]) {
+    mode=update
+}
+sudo pbuilder $mode --override-config --configfile $root/etc/pbuilderrc
+$root/exec/update_cache $root
diff --git a/pkg/trunk/exec/update_available b/pkg/trunk/exec/update_available
deleted file mode 100755 (executable)
index 11df8b0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env r
-#mirror <- 'http://cran.uk.r-project.org/'
-mirror <- 'http://cran.r-project.org/'
-message('updating list of available R packages...')
-available <- available.packages(contrib.url(mirror))
-available <- rbind(available,available.packages(contrib.url('http://www.bioconductor.org/')))
-message('updating list of available R task views...')
-library(ctv)
-ctv.available <- available.views(repo=mirror)
-library(cran2deb)
-save(available, ctv.available, file=system.file('R/sysdata.rda',package='cran2deb'),eval.promises=T)
diff --git a/pkg/trunk/exec/update_cache b/pkg/trunk/exec/update_cache
new file mode 100755 (executable)
index 0000000..d80b072
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env r
+library(cran2deb)
+library(ctv)
+#mirror <- 'http://cran.uk.r-project.org/'
+mirror <- 'http://cran.r-project.org/'
+message('updating list of available R packages...')
+available <- available.packages(contrib.url(mirror))
+available <- rbind(available,available.packages(contrib.url('http://www.bioconductor.org/')))
+message('updating list of available R task views...')
+ctv.available <- available.views(repo=mirror)
+save(available, ctv.available, file=file.path(argv[1],'R/sysdata.rda'),eval.promises=T)
index 1f99b775f885cf437914757046d82a21a4138fe3..ec9a9c483a075b8f5d257f720a2d1697c50eba38 100644 (file)
@@ -1,6 +1,6 @@
 HOOKDIR=@ROOT@/etc/hook
 BUILDRESULT=@ROOT@/var/results
-EXTRAPACKAGES='debhelper r-base-dev cdbs r-base-core lintian xauth xfont-base xvfb'
+EXTRAPACKAGES='debhelper r-base-dev cdbs r-base-core lintian xauth xfonts-base xvfb'
 DISTRIBUTION=lenny
 OTHERMIRROR='deb http://localhost/users/cb/cran2deb/ unstable/$(ARCH)/ | deb http://localhost/users/cb/cran2deb/ unstable/all/'
 MIRRORSITE='http://ftp.debian.org/debian/'