From: blundellc Date: Sat, 13 Sep 2008 13:12:13 +0000 (+0000) Subject: cran2deb: generate some of debian/copyright and debian/control like X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ad87f92e3dff2b576fb75526ff3ba5a29059d7db;p=cran2deb.git cran2deb: generate some of debian/copyright and debian/control like CRAN2DEB.pm, detect architecture dependent packages. git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@13 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- diff --git a/pkg/trunk/copy_find b/pkg/trunk/copy_find index d7727df..fe3d619 100755 --- a/pkg/trunk/copy_find +++ b/pkg/trunk/copy_find @@ -13,7 +13,7 @@ ifs=$nl { ifs=() { seen_files=`{{for (line in $lines) echo $line} | cut -d: -f1} } missing_copyright=() for (file in $files) { - if (echo -n $seen_files | grep -q $file) { + if (echo -n $seen_files | grep -q '^'^$file^'$') { } else { missing_copyright=($missing_copyright $file) } diff --git a/pkg/trunk/cran2deb b/pkg/trunk/cran2deb index e3fcb7c..54008a5 100755 --- a/pkg/trunk/cran2deb +++ b/pkg/trunk/cran2deb @@ -163,25 +163,72 @@ prepare.new.debian <- function(pkg) { } else { message(paste('Auto-accepted license',accept)) } - # TODO: wording of copyright! - cat(paste(paste("automatically created by cran2deb from",pkg$name - ,paste('(',pkg$version,')',sep=''),'on the basis of possible license',accept) - ,paste('in the R repository',pkg$repo,'which has the following DESCRIPTION:') - ,'',sep='\n'),file=debfile('copyright')) - write.dcf(pkg$description,file=debfile('copyright'),append=T,indent=0) + if (accept == 'Unlimited') { + # definition of Unlimited from ``Writing R extensions'' + accept=paste('Unlimited (no restrictions on distribution or' + ,'use other than those imposed by relevant laws)') + } + writeLines(strwrap( + paste('This Debian package of the GNU R package',pkg$name + ,'was generated using cran2deb by' + ,paste(maintainer,'.',sep='') + ,'The author(s) of the original GNU R package were:' + ,pkg$description[1,'Author'] + ,'' + ,'The original GNU R package is maintained by' + ,pkg$description[1,'Maintainer'],'and was obtained from:' + ,'' + ,paste(' ',contrib.url(getOption("repos"))) + ,'' + ,'' + ,'The GNU R package DESCRIPTION offers a' + ,'Copyright licenses under the terms of the',accept + ,'license. On a Debian GNU/Linux system, common' + ,'licenses are included in the directory' + ,'/usr/share/common-licenses/.' + ,'' + ,'The DESCRIPTION file for the original GNU R package ' + ,'can be found in ' + ,paste('/usr/lib/R/site-library' + ,pkg$debname + ,'DESCRIPTION' + ,sep='/') + ,sep='\n'), width=72), con=debfile('copyright')) + + # heuristic: if /src/ exists in pkg$path, then this is an + # architecture-dependent package. + # CRAN2DEB.pm is a bit fancier about this but ``Writing R extensions'' + # 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='/')) + shlibdep = '' + if (archdep) { + shlibdep = '${shlibs:Depends}' + } control = data.frame() control[1,'Source'] = pkg$name control[1,'Section'] = 'math' control[1,'Priority'] = 'optional' control[1,'Maintainer'] = maintainer - control[1,'Build-Depends-Indep'] = 'debhelper (>> 4.1.0), r-base-dev (>= 2.7.0), cdbs' + control[1,'Build-Depends'] = paste('debhelper (>> 4.1.0)' + ,'r-base-dev (>= 2.7.0)' + ,'cdbs' + ,sep=', ') control[1,'Standards-Version'] = '3.7.3.0' - control[2,'Package'] = paste('r',pkg$repo,pkg$name,sep='-') - control[2,'Architecture'] = 'all' - control[2,'Depends'] = '' + control[2,'Package'] = pkg$debname - control[2,'Description'] = paste(pkg$description[1,'Description']) - write.dcf(control,file=debfile('control'),indent=1) + control[2,'Architecture'] = 'all' + if (archdep) { + control[2,'Architecture'] = 'any' + } + control[2,'Depends'] = paste('r-base-core', shlibdep, sep=', ') + control[2,'Description'] = paste('GNU R package "' + ,pkg$description[1,'Title'],'"\n' + ,pkg$description[1,'Description'] + ,sep='') + # Debian policy says 72 char width; indent minimally + write.dcf(control,file=debfile('control'),indent=1,width=72) # TODO: debian/watch return(pkg)