From: blundellc Date: Sat, 13 Sep 2008 13:12:49 +0000 (+0000) Subject: cran2deb: pbuilder refinement: use lintian. adapt build script to check for warnings. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=01fe5751a711e4fe9971242e1dcbf87657393772;p=cran2deb.git cran2deb: pbuilder refinement: use lintian. adapt build script to check for warnings. git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@17 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- diff --git a/pkg/trunk/build_some b/pkg/trunk/build_some index b72d466..86f114c 100755 --- a/pkg/trunk/build_some +++ b/pkg/trunk/build_some @@ -1,16 +1,20 @@ #!/usr/bin/rc -mkdir -p log +mkdir -p warn fail ./cranpkgs >all_pkgs for (pkg in `{cat all_pkgs}) { - if (~ $pkg *.* */*) { - echo bad name $pkg >log/ERROR + if (~ $pkg *..* */*) { + echo bad name $pkg >>fail/ERROR } else { echo $pkg... fail=0 - ./cran2deb $pkg >log/$pkg >[2=1] || fail=1 + ./cran2deb $pkg >fail/$pkg >[2=1] || fail=1 if (~ $fail 0) { - rm -f log/$pkg + grep '^[WE]:' fail/$pkg >warn/$pkg + if (~ `{stat -c '%s' warn/$pkg} 0) { + rm -f warn/$pkg + } + rm -f fail/$pkg } } } diff --git a/pkg/trunk/cran2deb b/pkg/trunk/cran2deb index 108078d..0fd1d09 100755 --- a/pkg/trunk/cran2deb +++ b/pkg/trunk/cran2deb @@ -1,6 +1,7 @@ #!/usr/bin/env r use_pbuilder <- 1 +pbuilder_results <- '/var/cache/pbuilder/result' version.new <- function(rver,debian_revision=1, debian_epoch=0) { # generate a string representation of the Debian version of an @@ -129,6 +130,10 @@ chomp <- function(x) { return(sub('^[[:space:]]+','',sub('[[:space:]]+$','',x))) } +host.arch <- function() { + system('dpkg-architecture -qDEB_HOST_ARCH',intern=T) +} + prepare.new.debian <- function(pkg) { maintainer = 'cran2deb buildbot ' @@ -236,9 +241,13 @@ prepare.new.debian <- function(pkg) { # says: ``The sources and headers for the compiled code are in src, plus # optionally file Makevars or Makefile.'' It seems unlikely that # architecture independent code would end up here. - archdep = file.exists(paste(pkg$path,'src',sep='/')) + pkg$archdep = file.exists(paste(pkg$path,'src',sep='/')) + pkg$arch <- 'all' + if (pkg$archdep) { + pkg$arch <- host.arch() + } shlibdep = '' - if (archdep) { + if (pkg$archdep) { shlibdep = '${shlibs:Depends}' } control = data.frame() @@ -254,7 +263,7 @@ prepare.new.debian <- function(pkg) { control[2,'Package'] = pkg$debname control[2,'Architecture'] = 'all' - if (archdep) { + if (pkg$archdep) { control[2,'Architecture'] = 'any' } control[2,'Depends'] = paste('r-base-core', shlibdep, sep=', ') @@ -282,11 +291,16 @@ build.debian <- function(pkg) { ,paste('(',pkg$debversion,')',sep='') ,'...')) if (use_pbuilder) { - system('pdebuild -b') + # resulting files are in + # /var/cache/pbuilder/ + ret = system('pdebuild') } else { - system('debuild -us -uc -b') + ret = system('debuild -us -uc -b') } setwd(wd) + if (ret != 0) { + stop('Failed to build package.') + } } @@ -295,18 +309,28 @@ 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='')) + if (use_pbuilder) { + rp = pbuilder_results + } else { + rp = paste(pkg$path,'/..',sep='') + } + for (file in upfiles) { + ret = system(paste('lintian -v ',rp,'/',file,sep='')) + if (ret != 0) { + break + } + } + message('N: lintian done') + if (ret != 0) { + stop('lintian failed!') + } return(pkg) })()) - if (!inherits(pkg,'try-error')) { - # TODO: copy away the results from pkg$path/../ - # _.orig.tar.gz - # _.diff.gz - # _.dsc - # __.build - # __source.changes - # __source.changes - # __.deb - } cleanup(dir) if (inherits(pkg,'try-error')) { stop(call.=F) diff --git a/pkg/trunk/cranpkgs b/pkg/trunk/cranpkgs index ed93303..4ccbf99 100755 --- a/pkg/trunk/cranpkgs +++ b/pkg/trunk/cranpkgs @@ -1,2 +1,2 @@ #!/usr/bin/env r -writeLines(sample(dimnames(available.packages(contriburl=contrib.url('http://cran.uk.r-project.org/')))[[1]],100)) +writeLines(sample(dimnames(available.packages(contriburl=contrib.url('http://cran.uk.r-project.org/')))[[1]],150))