From eef1a78b1b49c26190722263d8d8be9073ed5f5b Mon Sep 17 00:00:00 2001 From: blundellc Date: Sat, 13 Sep 2008 13:20:56 +0000 Subject: [PATCH] license: change syntax: accept licenses not packages. add view command for licenses. also includes some wild license rules from the current bulk build. git-svn-id: svn://svn.r-forge.r-project.org/svnroot/cran2deb@79 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- pkg/trunk/data/populate_licenses | 75 ++++++++++++++++++++++++++------ pkg/trunk/exec/license | 52 ++++++++++++++++------ 2 files changed, 100 insertions(+), 27 deletions(-) diff --git a/pkg/trunk/data/populate_licenses b/pkg/trunk/data/populate_licenses index 70e941c..8a941fc 100644 --- a/pkg/trunk/data/populate_licenses +++ b/pkg/trunk/data/populate_licenses @@ -1,19 +1,68 @@ -add GPL +accept AGPL +accept APACHE +accept ARTISTIC +accept BSD +accept CeCILL +accept CPL +accept GPL +accept GPLQA +accept GPL+QHULL +accept LGPL +accept MIT +accept MPL +accept TCLTK2 +accept UNLIMITED +accept X11 +reject distrib-noncomm +reject GPL+ACM +reject MCLUST +reject UNCLEAR +hash APACHE /usr/share/common-licenses/Apache-2.0 +hash ARTISTIC /usr/share/common-licenses/Artistic +hash BSD /usr/share/common-licenses/BSD hash GPL /usr/share/common-licenses/GPL-2 hash GPL /usr/share/common-licenses/GPL-3 -add LGPL hash LGPL /usr/share/common-licenses/LGPL-2 hash LGPL /usr/share/common-licenses/LGPL-2.1 hash LGPL /usr/share/common-licenses/LGPL-3 -add BSD -hash BSD /usr/share/common-licenses/BSD -add ARTISTIC -hash ARTISTIC /usr/share/common-licenses/Artistic -add APACHE -hash APACHE /usr/share/common-licenses/Apache-2.0 -add AGPL -add MIT -add X11 -add MPL -add UNLIMITED reject +pkg BSD minpack.lm +pkg CeCILL LLAhclust +pkg CPL lmom +pkg distrib-noncomm Bhat +pkg distrib-noncomm conf.design +pkg distrib-noncomm gpclib +pkg distrib-noncomm mlbench +pkg distrib-noncomm poplab +pkg distrib-noncomm PredictiveRegression +pkg distrib-noncomm PTAk +pkg distrib-noncomm siggenes +pkg GPL+ACM akima +pkg GPL+ACM tripack +pkg GPL ergm +pkg GPL gmodels +pkg GPL ICE +pkg GPL network +pkg GPL pastecs +pkg GPL pbatR +pkg GPL PKtools +pkg GPL+QHULL geometry +pkg GPL reldist +pkg GPL RXshrink +pkg GPL snpMatrix +pkg GPL splancs +pkg GPL uroot +pkg LGPL R.huge +pkg MCLUST mclust +pkg TCLTK2 tcltk2 +pkg UNCLEAR adapt +pkg UNCLEAR cat +pkg UNCLEAR cosmo +pkg UNCLEAR mix +pkg UNCLEAR mlmm +pkg UNCLEAR norm +pkg UNCLEAR pan +pkg UNCLEAR titecrm +pkg UNCLEAR tlnise +pkg UNLIMITED boolean +pkg GPLQA regtest ls diff --git a/pkg/trunk/exec/license b/pkg/trunk/exec/license index 5263879..e67ad3d 100755 --- a/pkg/trunk/exec/license +++ b/pkg/trunk/exec/license @@ -5,10 +5,11 @@ suppressPackageStartupMessages(library(digest)) exec_cmd <- function(argc, argv) { usage <- function() - message(paste('usage: add [reject]' + message(paste('usage: accept ' + ,' reject ' ,' hash (|)' - ,' accept ' - ,' reject ' + ,' pkg ' + ,' view ' ,' ls' ,' quit' ,sep='\n')) @@ -18,12 +19,12 @@ exec_cmd <- function(argc, argv) { } cmd = argv[1] - if (cmd == 'add') { - if (argc != 2 && (argc != 3 || argv[3] != 'reject')) { + if (cmd == 'accept' || cmd == 'reject') { + if (argc != 2) { usage() return() } - action = (argc != 3) + action = (cmd == 'accept') db_add_license_override(argv[2],action) } else if (cmd == 'hash') { if (argc != 3) { @@ -46,22 +47,23 @@ exec_cmd <- function(argc, argv) { return() } db_add_license_hash(license,license_sha1) - } else if (cmd == 'reject' || cmd == 'accept') { + } else if (cmd == 'pkg') { if (argc != 3) { usage() return() } - pkg_name <- argv[2] - license <- argv[3] + license <- argv[2] + pkg_name <- argv[3] current_action <- db_license_override_name(license) - action = (cmd == 'accept') if (is.na(current_action)) { - message(paste('N: license',license,'is not known; adding it')) - db_add_license_override(license,action) - } else if (action != current_action) { - message(paste('E: differing actions propose for license',license)) + message(paste('N: license',license,'is not known; add it')) return() } + action = 'accept' + if (!current_action) { + action = 'reject' + } + message(paste('in future, will',action,'the package',pkg_name,'under license',license)) tmp <- setup() success <- try((function() { pkg <- prepare_pkg(tmp,pkg_name) @@ -78,6 +80,28 @@ exec_cmd <- function(argc, argv) { if (inherits(success,'try-error')) { stop(call.=F) } + } else if (cmd == 'view') { + if (argc != 2) { + usage() + return() + } + pkg_name <- argv[2] + tmp <- setup() + success <- try((function() { + pkg <- prepare_pkg(tmp,pkg_name) + if (!('License' %in% names(pkg$description[1,]))) { + message(paste('E: package',pkg$name,'has no License: field in DESCRIPTION')) + return() + } + first_license = (strsplit(chomp(pkg$description[1,'License']) + ,'[[:space:]]*\\|[[:space:]]*')[[1]])[1] + first_license = get_license(pkg,first_license) + cat(strwrap(first_license),file='|less') + })()) + cleanup(tmp) + if (inherits(success,'try-error')) { + stop(call.=F) + } } else if (cmd == 'ls') { for (x in db_license_overrides()) print(x) } else if (cmd == 'help') { -- 2.39.2