From 861a54f50aad5e13c364f231c9443869c0efb0be Mon Sep 17 00:00:00 2001 From: blundellc Date: Sat, 13 Sep 2008 13:14:00 +0000 Subject: [PATCH] cran2deb: tame dput+mini-dinstall+pbuilder. Constructs an archive that pbuilder can apt-get dependencies from when necessary. This requires an http server to serve var/archive (can be a symlink). Let pbuilder/dput run lintian. git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@26 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- pkg/trunk/cran2deb | 64 ++++++++++++++--------------- pkg/trunk/cranpkgs | 3 +- pkg/trunk/etc/dput.cf.in | 11 ++--- pkg/trunk/etc/mini-dinstall.conf.in | 11 ++++- pkg/trunk/etc/pbuilderrc.in | 5 ++- pkg/trunk/setup | 13 ++++-- 6 files changed, 62 insertions(+), 45 deletions(-) diff --git a/pkg/trunk/cran2deb b/pkg/trunk/cran2deb index 2e3db55..2e380fe 100755 --- a/pkg/trunk/cran2deb +++ b/pkg/trunk/cran2deb @@ -1,7 +1,8 @@ #!/usr/bin/env r -pbuilder_results <- '/var/cache/pbuilder/result' -pbuilder_config <- '/home/cb/work/gsoc/cran2deb/pbuilderrc' +pbuilder_results <- '/home/cb/work/gsoc/cran2deb/var/results' +pbuilder_config <- '/home/cb/work/gsoc/cran2deb/etc/pbuilderrc' +dput_config <- '/home/cb/work/gsoc/cran2deb/etc/dput.cf' version.new <- function(rver,debian_revision=1, debian_epoch=0) { # generate a string representation of the Debian version of an @@ -332,26 +333,28 @@ prepare.new.debian <- function(pkg) { # determine dependencies bin.depends = list() src.depends = list() - for (dep in strsplit(chomp(pkg$description[1,'Depends']) - ,'[[:space:]]*,[[:space:]]*')[[1]]) { - # remove other comments - dep = gsub('(\\(\\)|\\([[:space:]]*[^<=>!].*\\))','',dep) - # squish spaces - dep = chomp(gsub('[[:space:]]+',' ',dep)) - # parse version - pat = '^([^ ()]+) ?(\\( ?([<=>!]+ ?[0-9.]+) ?\\))?$' - if (!length(grep(pat,dep))) { - stop(paste('R dependency',dep,'does not appear to be well-formed')) + if ('Depends' %in% names(pkg$description[1,])) { + for (dep in strsplit(chomp(pkg$description[1,'Depends']) + ,'[[:space:]]*,[[:space:]]*')[[1]]) { + # remove other comments + dep = gsub('(\\(\\)|\\([[:space:]]*[^<=>!].*\\))','',dep) + # squish spaces + dep = chomp(gsub('[[:space:]]+',' ',dep)) + # parse version + pat = '^([^ ()]+) ?(\\( ?([<=>!]+ ?[0-9.]+) ?\\))?$' + if (!length(grep(pat,dep))) { + stop(paste('R dependency',dep,'does not appear to be well-formed')) + } + version = sub(pat,'\\3',dep) + dep = sub(pat,'\\1',dep) + src.deb = pkgname.as.debian(dep,pkg$repo,version=version,binary=F) + bin.deb = pkgname.as.debian(dep,pkg$repo,version=version,binary=T) + bin.depends = c(bin.depends,bin.deb) + src.depends = c(src.depends,src.deb) } - version = sub(pat,'\\3',dep) - dep = sub(pat,'\\1',dep) - src.deb = pkgname.as.debian(dep,pkg$repo,version=version,binary=F) - bin.deb = pkgname.as.debian(dep,pkg$repo,version=version,binary=T) - bin.depends = c(bin.depends,bin.deb) - src.depends = c(src.depends,src.deb) + src.depends=unique(src.depends) + bin.depends=unique(bin.depends) } - src.depends=unique(src.depends) - bin.depends=unique(bin.depends) if (!length(grep('^r-base',src.depends))) { src.depends = c(src.depends,pkgname.as.debian('R',version='>= 2.7.0',binary=F)) bin.depends = c(bin.depends,pkgname.as.debian('R',version='>= 2.7.0',binary=T)) @@ -423,22 +426,15 @@ go <- function(name) { pkg <- try((function() { pkg <- prepare.new.debian(prepare.pkg(dir,name)) build.debian(pkg) - message('N: running lintian') - upfiles=c( - paste(pkg$srcname,'_',pkg$debversion,'.dsc',sep='') - ,paste(pkg$srcname,'_',pkg$debversion,'_',host.arch(),'.changes',sep='') - ,paste(pkg$debname,'_',pkg$debversion,'_',pkg$arch,'.deb',sep='')) - rp = pbuilder_results - for (file in upfiles) { - ret = system(paste('lintian -v ',rp,'/',file,sep='')) - if (ret != 0) { - break - } - } - message('N: lintian done') + ret = system(paste('umask 022;dput','-c',shQuote(dput_config),'local' + ,paste('/', pbuilder_results, '/' + ,paste(pkg$srcname,'_',pkg$debversion,'_' + ,host.arch(),'.changes',sep=''), sep=''))) if (ret != 0) { - stop('lintian failed!') + stop('upload failed!') } +# paste(pkg$srcname,'_',pkg$debversion,'.dsc',sep='') +# paste(pkg$debname,'_',pkg$debversion,'_',pkg$arch,'.deb',sep='') return(pkg) })()) cleanup(dir) diff --git a/pkg/trunk/cranpkgs b/pkg/trunk/cranpkgs index 05e5f5f..ee2462f 100755 --- a/pkg/trunk/cranpkgs +++ b/pkg/trunk/cranpkgs @@ -1,2 +1,3 @@ #!/usr/bin/env r -writeLines(sample(dimnames(available.packages(contriburl=contrib.url('http://cran.uk.r-project.org/')))[[1]],300)) +#writeLines(sample(dimnames(available.packages(contriburl=contrib.url('http://cran.uk.r-project.org/')))[[1]],300)) +writeLines(dimnames(available.packages(contriburl=contrib.url('http://cran.uk.r-project.org/')))[[1]]) diff --git a/pkg/trunk/etc/dput.cf.in b/pkg/trunk/etc/dput.cf.in index 9779aaf..7d6b8d2 100644 --- a/pkg/trunk/etc/dput.cf.in +++ b/pkg/trunk/etc/dput.cf.in @@ -1,7 +1,8 @@ -[local] -method = local -incoming = @ROOT@/var/incoming -allow_non-us_software = 1 -run_dinstall = 0 +[local] +method = local +incoming = @ROOT@/var/archive/mini-dinstall/incoming +allow_non-us_software = 1 +run_dinstall = 0 +run_lintian = 1 post_upload_command = /usr/bin/mini-dinstall --batch -c @ROOT@/etc/mini-dinstall.conf allow_unsigned_uploads = 1 diff --git a/pkg/trunk/etc/mini-dinstall.conf.in b/pkg/trunk/etc/mini-dinstall.conf.in index 72b7448..b75f1d7 100644 --- a/pkg/trunk/etc/mini-dinstall.conf.in +++ b/pkg/trunk/etc/mini-dinstall.conf.in @@ -1,3 +1,12 @@ -archive_dir = @ROOT@/var/archive +[DEFAULT] +architectures = all, i386 +use_dnotify = 0 +verify_sigs = 0 +mail_on_success = 0 +archive_style = simple-subdir +mail_log_level = NONE +archivedir = @ROOT@/var/archive logfile = @ROOT@/var/mini-dinstall.log +[unstable] + diff --git a/pkg/trunk/etc/pbuilderrc.in b/pkg/trunk/etc/pbuilderrc.in index f0424d8..5d785b4 100644 --- a/pkg/trunk/etc/pbuilderrc.in +++ b/pkg/trunk/etc/pbuilderrc.in @@ -1,4 +1,7 @@ HOOKDIR=@ROOT@/etc/hook -BUILDRESULT=@ROOT@/var/incoming +BUILDRESULT=@ROOT@/var/results EXTRAPACKAGES='debhelper r-base-dev cdbs r-base-core lintian' DISTRIBUTION=lenny +OTHERMIRROR='deb http://localhost/users/cb/cran2deb/ unstable/$(ARCH)/' +MIRRORSITE='http://ftp.debian.org/debian/' +APTCACHE='' diff --git a/pkg/trunk/setup b/pkg/trunk/setup index 0bc447f..e8537f2 100755 --- a/pkg/trunk/setup +++ b/pkg/trunk/setup @@ -1,11 +1,18 @@ #!/usr/bin/rc +umask 022 +root=`pwd for (x in `{find etc -type f -name '*.in'}) { y=`{echo $x | sed -e 's,.in$,,'} - sed -e 's:@ROOT@:'^`pwd^':g' <$x >$y + sed -e 's:@ROOT@:'^$root^':g' <$x >$y } -mkdir -p var/incoming var/archive +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 --configfile `pwd^/etc/pbuilderrc +sudo pbuilder $mode --override-config --configfile $root/etc/pbuilderrc -- 2.39.5