]> git.donarmstrong.com Git - cran2deb.git/commitdiff
DESCRIPTION: if Maintainer and/or Author are not defined, use the other, or fail...
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:28:57 +0000 (13:28 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:28:57 +0000 (13:28 +0000)
git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@142 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/trunk/R/debianpkg.R

index 5664a3d3a24415e0db5fdc659d5864d91234f508..416a9117978dffeddf91553c54bb3c581209bba3 100644 (file)
@@ -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
              ,''