From 185380aaa9b4b13428dc6f61f49e13691a06a8c5 Mon Sep 17 00:00:00 2001 From: blundellc Date: Sat, 13 Sep 2008 13:12:57 +0000 Subject: [PATCH] cran2deb: use iconv(1) to convert debian/{control,changelog,copyright} to utf8 lintian(1) likes these files to be utf8. R does not specify a character set, so this code just hopes that iconv(1) will do the right thing. In the only case where it matters so far (lspls) this allows the package to build and pass lintian(1). git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@18 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- pkg/trunk/cran2deb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/trunk/cran2deb b/pkg/trunk/cran2deb index 0fd1d09..4273326 100755 --- a/pkg/trunk/cran2deb +++ b/pkg/trunk/cran2deb @@ -163,7 +163,7 @@ prepare.new.debian <- function(pkg) { cat(paste(paste(pkg$srcname,' (',pkg$debversion,') unstable; urgency=low',sep='') ,'' ,' * Initial release.','' ,paste(' --',maintainer,'',format(Sys.time(),'%a, %d %b %Y %H:%M:%S %z')) - ,'',sep='\n'),file=debfile('changelog')) + ,'',sep='\n'),file=debfile('changelog.in')) cat(paste('#!/usr/bin/make -f' ,'include /usr/share/R/debian/r-cran.mk' ,'',sep='\n') @@ -233,7 +233,7 @@ prepare.new.debian <- function(pkg) { ,pkg$debname ,'DESCRIPTION' ,sep='/') - ,sep='\n'), width=72), con=debfile('copyright')) + ,sep='\n'), width=72), con=debfile('copyright.in')) # heuristic: if /src/ exists in pkg$path, then this is an # architecture-dependent package. @@ -277,9 +277,16 @@ prepare.new.debian <- function(pkg) { ,pkg$description[1,'Description'] ,sep='') # Debian policy says 72 char width; indent minimally - write.dcf(control,file=debfile('control'),indent=1,width=72) + write.dcf(control,file=debfile('control.in'),indent=1,width=72) # TODO: debian/watch + # convert text to utf8 (who knows what the original character set is -- + # let's hope icon DTRT). + for (file in c('control','changelog','copyright')) { + system(paste('iconv -o ',shQuote(debfile(file)) + ,' -t utf8 ' + ,shQuote(debfile(paste(file,'in',sep='.'))))) + } return(pkg) } -- 2.39.5