]> git.donarmstrong.com Git - cran2deb.git/commitdiff
license: try looking in inst/ for LICENSE; fail nicely if it is missing.
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:29:06 +0000 (13:29 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:29:06 +0000 (13:29 +0000)
git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@143 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/trunk/R/license.R

index c392e11fa7fb0f1ae969208d7880abc1d430f1b4..846cf566c70c5fc8a1b2c9ea328328fe5b69e16b 100644 (file)
@@ -22,7 +22,6 @@ is_acceptable_license <- function(license) {
         warn('Accepting/rejecting wild license as',license,'. FIX THE PACKAGE!')
         return(action)
     }
-    # TODO: file {LICENSE,LICENCE} (+ maybe COPYING?)
     error('Wild license',license,'did not match classic rules; rejecting')
     return(F)
 }
@@ -85,9 +84,18 @@ get_license <- function(pkg,license) {
     license <- chomp(gsub('[[:space:]]+',' ',license))
     if (length(grep('^file ',license))) {
         if (length(grep('^file LICEN[CS]E$',license))) {
-            path = gsub('file ','',license)
-            path = file.path(pkg$path, path)
-            license <- license_text_reduce(readChar(path,file.info(path)$size))
+            file = gsub('file ','',license)
+            path = file.path(pkg$path, file)
+            if (file.exists(path)) {
+                license <- license_text_reduce(readChar(path,file.info(path)$size))
+            } else {
+                path = file.path(pkg$path, 'inst', file)
+                if (file.exists(path)) {
+                    license <- license_text_reduce(readChar(path,file.info(path)$size))
+                } else {
+                    error('said to look at a license file but license file is missing')
+                }
+            }
         } else {
             error('invalid license file specification',license)
             return(NA)