-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
exec_cmd <- function(argc, argv) {
usage <- function()
- message(paste('usage: add <license> [reject]'
+ message(paste('usage: accept <license>'
+ ,' reject <license>'
,' hash <license> (<path>|<hash>)'
- ,' accept <pkg> <license name>'
- ,' reject <pkg> <license name>'
+ ,' pkg <license> <pkg>'
+ ,' view <pkg>'
,' ls'
,' quit'
,sep='\n'))
}
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) {
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)
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') {