]> git.donarmstrong.com Git - cran2deb.git/commitdiff
cran2deb: use iconv(1) to convert debian/{control,changelog,copyright} to utf8
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:12:57 +0000 (13:12 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:12:57 +0000 (13:12 +0000)
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

index 0fd1d09fa848f80bd86b5ba35ef503f1ff3cd082..42733260423e435c49946a3c9858308b8d090138 100755 (executable)
@@ -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)
 }