]> git.donarmstrong.com Git - cran2deb.git/commitdiff
license+db: return NA when no decision is found. reject when a decision is found.
authorblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:18:27 +0000 (13:18 +0000)
committerblundellc <blundellc@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Sat, 13 Sep 2008 13:18:27 +0000 (13:18 +0000)
also renamed deny to reject. feels nicer.

git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@59 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

pkg/trunk/R/db.R
pkg/trunk/R/license.R
pkg/trunk/data/populate_licenses
pkg/trunk/exec/license

index 8238a3db152c37e81584d4831b5b73f61be49073..3795a5f0661eab09f77a60da1f4ab77bdce443e9 100644 (file)
@@ -39,6 +39,9 @@ db.sysreq.override <- function(sysreq_text) {
                     'SELECT debian_name FROM sysreq_override WHERE'
                             ,db.quote(sysreq_text),'GLOB r_pattern'))
     db.stop(con)
+    if (length(results) == 0) {
+        return(NA)
+    }
     return(results$debian_name)
 }
 
@@ -71,7 +74,7 @@ db.license.override.name <- function(name) {
                             ,db.quote(name),'= name'))
     db.stop(con)
     if (length(results) == 0) {
-        return(FALSE)
+        return(NA)
     }
     return(as.logical(results$accept))
 }
@@ -102,7 +105,7 @@ db.license.override.file <- function(file_sha1) {
                     ,db.quote(file_sha1),'= license_files.file_sha1'))
     db.stop(con)
     # TODO: change accept from 0,1 into FALSE,TRUE
-    # TODO: NULL -> FALSE
+    # TODO: NULL -> NA
     return(results)
 }
 
index 619147b00c7f321dbb04b9bf07e5378d86602e0b..928ffd51be8c1f5367bc791f15af63ecf55789c2 100644 (file)
@@ -8,8 +8,9 @@ is_acceptable_license <- function(license) {
     # don't care about versions of licenses
     license = chomp(sub('\\( ?[<=>!]+ ?[0-9.-]+ ?\\)',''
                     ,sub('-[0-9.-]+','',license)))
-    if (db.license.override.name(license)) {
-        return(T)
+    action = db.license.override.name(license)
+    if (!is.na(action)) {
+        return(action)
     }
     # uninteresting urls
     license = gsub('http://www.gnu.org/[[:alnum:]/._-]*','',license)
@@ -28,21 +29,23 @@ is_acceptable_license <- function(license) {
     license = gsub('(mozilla )?(mpl|mozilla public)','mpl',license)
     # remove any extra space introduced
     license = chomp(gsub('[[:space:]]+',' ',license))
-    if (db.license.override.name(license)) {
-        message(paste('W: Accepted wild license as',license,'. FIX THE PACKAGE!'))
-        return(T)
+    action = db.license.override.name(license)
+    if (!is.na(action)) {
+        message(paste('W: Accepting/rejecting wild license as',license,'. FIX THE PACKAGE!'))
+        return(action)
     }
     # remove everything that looks like a version specification
     license = gsub('(ver?sion|v)? *[0-9.-]+ *(or *(higher|later|newer|greater|above))?',''
                    ,license)
     # remove any extra space introduced
     license = chomp(gsub('[[:space:]]+',' ',license))
-    if (db.license.override.name(license)) {
-        message(paste('W: Accepted wild license as',license,'. FIX THE PACKAGE!'))
-        return(T)
+    action = db.license.override.name(license)
+    if (!is.na(action)) {
+        message(paste('W: Accepting/rejecting wild license as',license,'. FIX THE PACKAGE!'))
+        return(action)
     }
     # TODO: file {LICENSE,LICENCE} (+ maybe COPYING?)
-    message(paste('E: Wild license',license,'did not match'))
+    message(paste('E: Wild license',license,'did not match; rejecting'))
     return(F)
 }
 
index 169981ed0a5fa4d350aae7e309f2817bf0e696c4..2c46922496df48aa310be38be71542893cef5908 100644 (file)
@@ -15,5 +15,5 @@ add AGPL
 add MIT
 add X11
 add MPL
-add UNLIMITED deny
+add UNLIMITED reject
 ls
index fd4c53b6fbea9e9ee8f4270c35190e870e773168..89d9b2b229106eea6490c8a65f25fcadb7fd095e 100755 (executable)
@@ -5,7 +5,7 @@ suppressPackageStartupMessages(library(digest))
 
 exec_cmd <- function(argc, argv) {
     usage <- function()
-        message('usage: add <license> [deny]|file <license> <path>|ls|quit|help')
+        message('usage: add <license> [reject]|file <license> <path>|ls|quit|help')
 
     if (argc < 1) {
         exit()
@@ -13,7 +13,7 @@ exec_cmd <- function(argc, argv) {
     cmd = argv[1]
 
     if (cmd == 'add') {
-        if (argc != 2 && (argc != 3 || argv[3] != 'deny')) {
+        if (argc != 2 && (argc != 3 || argv[3] != 'reject')) {
             usage()
             return()
         }