From da29caa5f53048cc8ee769de291aae26aa67f16e Mon Sep 17 00:00:00 2001 From: blundellc Date: Sat, 13 Sep 2008 13:27:30 +0000 Subject: [PATCH] more verbose dependency messages. rewrite some scripts to use sh not rc (a few complicated ones remain). separate update into update and repopulate. add some documentation. cran2deb repopulate will bump the DB version, cran2deb update will not. git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@131 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- pkg/trunk/R/build.R | 2 +- pkg/trunk/R/debcontrol.R | 2 ++ pkg/trunk/exec/build_ctv | 16 ++++++++-------- pkg/trunk/exec/build_some | 9 +++++---- pkg/trunk/exec/cran2deb | 10 +++++----- pkg/trunk/exec/diagnose_ctv | 4 ++-- pkg/trunk/exec/help | 2 +- pkg/trunk/exec/root | 2 +- pkg/trunk/exec/update | 8 -------- pkg/trunk/exec/update_cache | 3 +++ pkg/trunk/inst/doc/DEPENDS | 33 +++++++++++++++++++++++++++++++++ pkg/trunk/inst/doc/PKG | 23 +++++++++++++++++++++++ 12 files changed, 84 insertions(+), 30 deletions(-) create mode 100644 pkg/trunk/inst/doc/DEPENDS create mode 100644 pkg/trunk/inst/doc/PKG diff --git a/pkg/trunk/R/build.R b/pkg/trunk/R/build.R index e6eeccd..9fcc8d7 100644 --- a/pkg/trunk/R/build.R +++ b/pkg/trunk/R/build.R @@ -42,7 +42,7 @@ build <- function(name,extra_deps,force=F) { } # pull in all the R dependencies - notice('dependencies:',paste(pkg$depends$r,collapse=', ')) + notice('R dependencies:',paste(pkg$depends$r,collapse=', ')) for (dep in pkg$depends$r) { if (pkgname_as_debian(dep) %in% debian_pkgs) { notice('using Debian package of',dep) diff --git a/pkg/trunk/R/debcontrol.R b/pkg/trunk/R/debcontrol.R index c610ce2..be7eb86 100644 --- a/pkg/trunk/R/debcontrol.R +++ b/pkg/trunk/R/debcontrol.R @@ -23,6 +23,8 @@ get_dependencies <- function(pkg,extra_deps) { forced <- forced_deps_as_debian(pkg$name) if (length(forced)) { + notice('forced build dependencies:',paste(forced$build, collapse=', ')) + notice('forced binary dependencies:',paste(forced$build, collapse=', ')) depends$bin = c(forced$bin,depends$bin) depends$build = c(forced$build,depends$build) } diff --git a/pkg/trunk/exec/build_ctv b/pkg/trunk/exec/build_ctv index 35d9a42..1e39e04 100755 --- a/pkg/trunk/exec/build_ctv +++ b/pkg/trunk/exec/build_ctv @@ -1,14 +1,14 @@ -#!/usr/bin/env rc +#!/bin/sh ## DOC: cran2deb build_ctv ## DOC: build all CRAN TaskViews. warning and error logs in ./ctv/ ## DOC: -for (ctv in `{cran2deb cran_pkgs query}) { +for ctv in $(cran2deb cran_pkgs query); do echo task view $ctv... - if (![ -e ctv/$ctv ]) { - cran2deb build_some $ctv - mkdir -p ctv/$ctv - mv warn fail ctv/$ctv - } -} + if [ ! -e "ctv/$ctv" ]; then + cran2deb build_some "$ctv" + mkdir -p "ctv/$ctv" + mv warn fail "ctv/$ctv" + fi +done diff --git a/pkg/trunk/exec/build_some b/pkg/trunk/exec/build_some index 679eed2..f02af9d 100755 --- a/pkg/trunk/exec/build_some +++ b/pkg/trunk/exec/build_some @@ -8,10 +8,11 @@ mkdir -p warn fail shift -if ([ ! -e all_pkgs ]) { +if [ ! -e all_pkgs ]; then cran2deb cran_pkgs $* >all_pkgs -} -for (pkg in `{cat all_pkgs}) { +fi + +for pkg in $(cat all_pkgs); do if (~ $pkg *..* */*) { echo bad name $pkg >>fail/ERROR } else if ([ -e warn/$pkg ]) { @@ -33,4 +34,4 @@ for (pkg in `{cat all_pkgs}) { echo FAILED } } -} +done diff --git a/pkg/trunk/exec/cran2deb b/pkg/trunk/exec/cran2deb index 7130044..7efedc7 100755 --- a/pkg/trunk/exec/cran2deb +++ b/pkg/trunk/exec/cran2deb @@ -1,10 +1,10 @@ -#!/usr/bin/rc +#!/bin/sh umask 002 -root=`{r -e 'suppressMessages(library(cran2deb));cat(system.file(package=''cran2deb''),file=stdout())'} +root=$(r -e 'suppressMessages(library(cran2deb));cat(system.file(package="cran2deb"),file=stdout())') cmd=$1 shift -if ([ ! -x $root/exec/$cmd ]) { +if [ ! -x "$root/exec/$cmd" ]; then echo unknown command $cmd exit 1 -} -$root/exec/$cmd $root $* +fi +"$root/exec/$cmd" "$root" $* diff --git a/pkg/trunk/exec/diagnose_ctv b/pkg/trunk/exec/diagnose_ctv index b1f995d..5e7ef03 100755 --- a/pkg/trunk/exec/diagnose_ctv +++ b/pkg/trunk/exec/diagnose_ctv @@ -1,2 +1,2 @@ -#!/usr/bin/env rc -{for (x in ctv/*) {echo;echo;echo $x: ; cd $x && cran2deb diagnose && cd ../..}} >ctv.results +#!/bin/sh +(for x in ctv/*; do echo;echo;echo "$x: "; cd "$x" && cran2deb diagnose && cd ../..; done) >ctv.results diff --git a/pkg/trunk/exec/help b/pkg/trunk/exec/help index e7397f8..3eeabab 100755 --- a/pkg/trunk/exec/help +++ b/pkg/trunk/exec/help @@ -1,4 +1,4 @@ -#!/usr/bin/rc +#!/bin/sh echo usage: cran2deb ' [args ...]' echo where '' is one of grep '## [D]OC:' $1/exec/* | sed -e 's/.*[D]OC://' diff --git a/pkg/trunk/exec/root b/pkg/trunk/exec/root index 7294588..3133778 100755 --- a/pkg/trunk/exec/root +++ b/pkg/trunk/exec/root @@ -1,2 +1,2 @@ -#!/usr/bin/rc +#!/bin/sh echo $1 diff --git a/pkg/trunk/exec/update b/pkg/trunk/exec/update index 0208723..bcd74a7 100755 --- a/pkg/trunk/exec/update +++ b/pkg/trunk/exec/update @@ -8,10 +8,6 @@ umask 022 root=$1 shift -for (x in `{find /etc/cran2deb -type f -name '*.in'}) { - y=`{echo $x | sed -e 's,.in$,,'} - sed -e 's:@ROOT@:'^$root^':g' <$x >$y -} mkdir -p /var/cache/cran2deb/results || exit 1 mini-dinstall --batch -c /etc/cran2deb/mini-dinstall.conf || exit 1 update_period=10800 @@ -30,8 +26,4 @@ if (![ -e /var/cache/cran2deb/cache.rda ] || [ $delta -gt $update_period ]) { sudo pbuilder $mode --override-config --configfile /etc/cran2deb/pbuilderrc $root/exec/update_cache $root } -if (![ -e /var/cache/cran2deb/cran2deb.db ] || [ $delta -gt $update_period ]) { - cat $root/data/^(populate_licenses quit) | $root/exec/license $root - cat $root/data/^(populate_depend_aliases populate_sysreq populate_forcedep quit) | $root/exec/depend $root -} diff --git a/pkg/trunk/exec/update_cache b/pkg/trunk/exec/update_cache index 5370210..6893846 100755 --- a/pkg/trunk/exec/update_cache +++ b/pkg/trunk/exec/update_cache @@ -28,3 +28,6 @@ message('updating list of existing Debian packages...') debian_pkgs <- readLines(pipe('apt-cache rdepends r-base-core | sed -e "/^ r-cran/{s/^[[:space:]]*r/r/;p}" -e d | sort -u')) save(debian_pkgs, base_pkgs, available, ctv.available, file=file.path(cache_root,'cache.rda'),eval.promises=T) + +message('synchronising database...') +db_update_package_versions() diff --git a/pkg/trunk/inst/doc/DEPENDS b/pkg/trunk/inst/doc/DEPENDS new file mode 100644 index 0000000..471f240 --- /dev/null +++ b/pkg/trunk/inst/doc/DEPENDS @@ -0,0 +1,33 @@ +A dependency alias (created in populated_depend_aliases) is some name (such as +java) and some associated run and build time dependencies, specified like this: + + alias_build java openjdk-6-jdk + alias_build java libgcj9-dev + alias_run java openjdk-6-jre + +So when cran2deb needs to use the 'java' build dependency, it will add +"openjdk-6-jdk, libgcj9-dev" to the Build-Depends:. alias_run deals with +Depends: only. +Since in Debian you cannot Build-Depend: upon build-essential, there is a +special 'ignore' dependency alias (this can be handy for dropping unnecessary +system requirements) + + alias_build ignore build-essential + +populate_forcedep contains like: + + force java rJava + +which forces the R package rJava to use the dependency alias 'java'. This is +for cases where there is no SystemRequirement. + +Finally, populate_sysreq has lines like: + + sysreq quantlib quantlib% + +This says, whenever a part of a SystemRequirement matches the SQL LIKE pattern +'quantlib%', use the dependency alias. SystemRequirements are converted to +lower case and messed around with; details are in R/debcontrol.R in the +sysreqs_as_debian function. R/debcontrol.R contains pretty much all of the code +for dependencies (the database interface code is in R/db.R). + diff --git a/pkg/trunk/inst/doc/PKG b/pkg/trunk/inst/doc/PKG new file mode 100644 index 0000000..de0a4b2 --- /dev/null +++ b/pkg/trunk/inst/doc/PKG @@ -0,0 +1,23 @@ +One of the key data structures using by cran2deb is commonly called 'pkg'. +It is constructed in R/getrpkg.R by prepare_pkg. prepare_pkg obtains +an R package and converts the source package into something suitable for use +with Debian. + +If a particular upstream version has already been used to create a Debian +package, then the source tarball of that upstream version is expected to be +available locally, and is used for building. In this case no conversion is +performed, so the archive does not change. In future it may be desirable to +obtain the source tarball from some central archive but this is not done at the +moment. + +download_pkg in R/getrpkg.R obtains the tarball (archive) of the R package, either +from the previous Debian build, or from the R archive. The field pkg$need_repack +indicates if the obtained archive must be repacked into a form acceptable +as a Debian source archive. This repacking, if necessary, is performed by +repack_pkg in R/getrpkg.R + + +Most of the creation of pkg is done by R/getrpkg.R. However some more build +specific operations (such as determining the new build version pkg$debversion) +are performed by R/debianpkg.R. + -- 2.39.5