From: blundellc Date: Sat, 13 Sep 2008 13:28:57 +0000 (+0000) Subject: DESCRIPTION: if Maintainer and/or Author are not defined, use the other, or fail... X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7f35dcb1dc3a46e128c7bd6f1d4a829dd812b34e;p=cran2deb.git DESCRIPTION: if Maintainer and/or Author are not defined, use the other, or fail gracefully. git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@142 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- diff --git a/pkg/trunk/R/debianpkg.R b/pkg/trunk/R/debianpkg.R index 5664a3d..416a911 100644 --- a/pkg/trunk/R/debianpkg.R +++ b/pkg/trunk/R/debianpkg.R @@ -41,6 +41,24 @@ generate_rules <- function(pkg) { generate_copyright <- function(pkg) { # generate_copyright file; we trust DESCRIPTION + + # if maintainer is missing then try to use author + if (!('Maintainer' %in% colnames(pkg$description))) { + if ('Author' %in% colnames(pkg$description)) { + maintainer = pkg$description[1,'Author'] + } else { + fail('Maintainer and Author not defined in R DESCRIPTION') + } + } else { + maintainer = pkg$description[1,'Maintainer'] + } + # likewise if author is missing then try to use maintainer + if (!('Author' %in% colnames(pkg$description))) { + author = maintainer + } else { + author = pkg$description[1,'Author'] + } + writeLines(strwrap( paste('This Debian package of the GNU R package',pkg$name ,'was generated automatically using cran2deb by' @@ -49,11 +67,11 @@ generate_copyright <- function(pkg) { ,'The original GNU R package is Copyright (C) ' # TODO: copyright start date, true copyright date ,format(Sys.time(),'%Y') - ,pkg$description[1,'Author'] + ,author ,'and possibly others.' ,'' ,'The original GNU R package is maintained by' - ,pkg$description[1,'Maintainer'],'and was obtained from:' + ,maintainer,'and was obtained from:' ,'' ,pkg$repoURL ,''