<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-infrastructure.
</pre>
<p><a href="https://github.com/macports/macports-infrastructure/commit/ea15b86f6a9706853012ca04efbdaacfa2401175">https://github.com/macports/macports-infrastructure/commit/ea15b86f6a9706853012ca04efbdaacfa2401175</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit ea15b86f6a9706853012ca04efbdaacfa2401175
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Sat Nov 9 23:50:32 2019 +1100
<span style='display:block; white-space:pre;color:#404040;'> port_binary_distributable: split out backend code
</span>---
...ary_distributable.tcl => distributable_lib.tcl} | 219 +++++------------
jobs/port_binary_distributable.tcl | 270 +--------------------
2 files changed, 71 insertions(+), 418 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/jobs/port_binary_distributable.tcl b/jobs/distributable_lib.tcl
</span>old mode 100755
new mode 100644
similarity index 55%
copy from jobs/port_binary_distributable.tcl
copy to jobs/distributable_lib.tcl
<span style='display:block; white-space:pre;color:#808080;'>index 95aad37..a902373
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/jobs/port_binary_distributable.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/jobs/distributable_lib.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1,21 +1,7 @@
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#!/usr/bin/env port-tclsh
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Check that binaries of a port are distributable by looking at its license
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# and the licenses of its dependencies.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Expected format: A {B C} means the license is A plus either B or C.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Exit status:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 0: distributable
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 1: non-distributable
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 2: error
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set MY_VERSION 0.1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set check_deptypes {depends_build depends_lib}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Library code for checking if ports are binary distributable.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Used by the port_binary_distributable tool.
</span>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+set check_deptypes [list depends_build depends_lib]
</span>
# Notes:
# 'Restrictive/Distributable' means a non-free license that nonetheless allows
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -30,84 +16,73 @@ set check_deptypes {depends_build depends_lib}
</span> # variants like CeCILL and the AGPL) and is not in the list of licenses known
# to do so below.
# 'Noncommercial' means a license that prohibits commercial use.
<span style='display:block; white-space:pre;background:#ffe0e0;'>-set good_licenses {afl agpl apache apsl artistic autoconf beopen bitstreamvera \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set good_licenses [list afl agpl apache apsl artistic autoconf beopen bitstreamvera \
</span> boost bsd bsd-old cc-by cc-by-sa cddl cecill cecill-b cecill-c cnri copyleft \
cpl curl epl fpll fontconfig freetype gd gfdl gpl \
gplconflict ibmpl ijg isc jasper lgpl libtool lppl mit \
mpl ncsa noncommercial openldap openssl permissive php \
psf public-domain qpl restrictive/distributable ruby \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- sleepycat ssleay tcl/tk vim w3c wtfpl wxwidgets x11 zlib zpl}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sleepycat ssleay tcl/tk vim w3c wtfpl wxwidgets x11 zlib zpl]
</span> foreach lic $good_licenses {
set license_good($lic) 1
}
proc all_licenses_except { args } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global good_licenses
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set remaining $good_licenses
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set remaining $::good_licenses
</span> foreach arg $args {
set remaining [lsearch -inline -all -not -exact $remaining $arg]
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return [list $remaining]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $remaining
</span> }
# keep these values sorted
array set license_conflicts \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- "afl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- agpl {afl apache-1 apache-1.1 apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cecill cnri cpl epl gd gpl-1 gpl-2 gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- agpl-1 {apache freetype gpl-3 gpl-3+ lgpl-3 lgpl-3+}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apache {agpl-1 cecill gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apache-1 {agpl gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apache-1.1 {agpl gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apsl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- beopen {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- bsd-old {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-1 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-2 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-2.5 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-3 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-sa {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cddl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cecill {afl agpl apache apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cnri cpl epl gd gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cnri {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- epl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- freetype {agpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gd {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl {afl apache-1 apache-1.1 apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cnri cpl epl gd gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-1 {agpl apache gpl-3 gpl-3+ lgpl-3 lgpl-3+}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-2 {agpl apache freetype gpl-3 gpl-3+ lgpl-3 lgpl-3+}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-3 {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-3+ {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gplconflict {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ibmpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lgpl-3 {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lgpl-3+ {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lppl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- mpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- noncommercial {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- openssl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- opensslexception [all_licenses_except openssl ssleay]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- php {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- qpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- restrictive/distributable {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ruby {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ssleay {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- zpl-1 {agpl cecill gpl}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc printUsage {} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "Usage: $::argv0 \[-hvV\] port-name \[variants...\]"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts " -h This help"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts " -v verbose output"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts " -V show version and MacPorts version being used"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "port-name is the name of a port to check"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "variants is the list of variants to enable/disable: +one -two..."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ [list \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ afl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ agpl [list afl apache-1 apache-1.1 apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cecill cnri cpl epl gd gpl-1 gpl-2 gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ agpl-1 [list apache freetype gpl-3 gpl-3+ lgpl-3 lgpl-3+] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ apache [list agpl-1 cecill gpl-1 gpl-2] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ apache-1 [list agpl gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ apache-1.1 [list agpl gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ apsl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ beopen [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bsd-old [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cc-by-1 [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cc-by-2 [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cc-by-2.5 [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cc-by-3 [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cc-by-sa [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cddl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cecill [list afl agpl apache apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cnri cpl epl gd gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cnri [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cpl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ epl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ freetype [list agpl-1 gpl-2] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gd [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gpl [list afl apache-1 apache-1.1 apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cnri cpl epl gd gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gpl-1 [list agpl apache gpl-3 gpl-3+ lgpl-3 lgpl-3+] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gpl-2 [list agpl apache freetype gpl-3 gpl-3+ lgpl-3 lgpl-3+] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gpl-3 [list agpl-1 gpl-1 gpl-2] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gpl-3+ [list agpl-1 gpl-1 gpl-2] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gplconflict [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ibmpl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lgpl-3 [list agpl-1 gpl-1 gpl-2] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lgpl-3+ [list agpl-1 gpl-1 gpl-2] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lppl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mpl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ noncommercial [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openssl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ opensslexception [all_licenses_except openssl ssleay] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ php [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ qpl [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ restrictive/distributable [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ruby [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ssleay [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ zpl-1 [list agpl cecill gpl] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ]
</span>
# return deps and license for given port
proc infoForPort {portName variantInfo} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global check_deptypes
</span> set dependencyList {}
set portSearchResult [mportlookup $portName]
if {[llength $portSearchResult] < 1} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -121,7 +96,7 @@ proc infoForPort {portName variantInfo} {
</span> # Closing the mport is actually fairly expensive and not really necessary
#mportclose $mport
<span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach dependencyType $check_deptypes {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dependencyType $::check_deptypes {
</span> if {[info exists portInfo($dependencyType)] && $portInfo($dependencyType) ne ""} {
foreach dependency $portInfo($dependencyType) {
lappend dependencyList [string range $dependency [string last ":" $dependency]+1 end]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -143,17 +118,17 @@ proc infoForPort {portName variantInfo} {
</span> }
# return license with any trailing dash followed by a number and/or plus sign removed
<span style='display:block; white-space:pre;background:#e0ffe0;'>+set remove_version_re {[0-9.+]+}
</span> proc remove_version {license} {
set dash [string last - $license]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$dash != -1 && [regexp {[0-9.+]+} [string range $license $dash+1 end]]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$dash != -1 && [regexp $::remove_version_re [string range $license $dash+1 end]]} {
</span> return [string range $license 0 $dash-1]
} else {
return $license
}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-proc check_licenses {portName variantInfo verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- global license_good license_conflicts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc check_licenses {portName variantInfo} {
</span> array set portSeen {}
set top_info [infoForPort $portName $variantInfo]
if {$top_info eq {}} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -174,16 +149,13 @@ proc check_licenses {portName variantInfo verbose} {
</span> set lic [remove_version [string tolower $full_lic]]
# add name to the list for later
lappend sub_names $lic
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists license_good($lic)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists ::license_good($lic)]} {
</span> set any_good 1
}
}
lappend top_license_names $sub_names
if {!$any_good} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is not distributable because its license \"$lic\" is not known to be distributable"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [list 1 "\"$portName\" is not distributable because its license \"$lic\" is not known to be distributable"]
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -213,7 +185,7 @@ proc check_licenses {portName variantInfo verbose} {
</span> # check that this dependency's license(s) are good
foreach full_lic $sublist {
set lic [remove_version [string tolower $full_lic]]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists license_good($lic)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists ::license_good($lic)]} {
</span> set any_good 1
} else {
# no good being compatible with other licenses if it's not distributable itself
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -225,9 +197,9 @@ proc check_licenses {portName variantInfo verbose} {
</span> foreach top_sublist [concat $top_license $top_license_names] {
set any_sub_compatible 0
foreach top_lic $top_sublist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists license_conflicts([string tolower $top_lic])]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- || ([lsearch -sorted $license_conflicts([string tolower $top_lic]) $lic] == -1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- && [lsearch -sorted $license_conflicts([string tolower $top_lic]) [string tolower $full_lic]] == -1)} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists ::license_conflicts([string tolower $top_lic])]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ || ([lsearch -sorted $::license_conflicts([string tolower $top_lic]) $lic] == -1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && [lsearch -sorted $::license_conflicts([string tolower $top_lic]) [string tolower $full_lic]] == -1)} {
</span> set any_sub_compatible 1
break
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -244,16 +216,10 @@ proc check_licenses {portName variantInfo verbose} {
</span> }
if {!$any_good} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is not distributable because its dependency \"$aPort\" has license \"$lic\" which is not known to be distributable"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [list 1 "\"$portName\" is not distributable because its dependency \"$aPort\" has license \"$lic\" which is not known to be distributable"]
</span> }
if {!$any_compatible} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is not distributable because its license \"$top_lic\" conflicts with license \"$full_lic\" of dependency \"$aPort\""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [list 1 "\"$portName\" is not distributable because its license \"$top_lic\" conflicts with license \"$full_lic\" of dependency \"$aPort\""]
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -270,70 +236,15 @@ proc check_licenses {portName variantInfo verbose} {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is distributable"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [list 0 "\"$portName\" is distributable"]
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+set split_variants_re {([-+])([[:alpha:]_]+[\w\.]*)}
</span> proc split_variants {variants} {
set result {}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set l [regexp -all -inline -- {([-+])([[:alpha:]_]+[\w\.]*)} $variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set l [regexp -all -inline -- $::split_variants_re $variants]
</span> foreach { match sign variant } $l {
lappend result $variant $sign
}
return $result
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Begin
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set verbose 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set showVersion 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-while {[string index [lindex $::argv 0] 0] eq "-"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- switch [string range [lindex $::argv 0] 1 end] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- h {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- printUsage
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exit 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- v {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set verbose 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- V {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set showVersion 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- default {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr "Unknown option [lindex $::argv 0]"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- printUsage
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exit 2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set ::argv [lrange $::argv 1 end]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-package require macports
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-mportinit
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-if {$showVersion} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "Version $MY_VERSION"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "MacPorts version [macports::version]"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exit 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-if {[llength $::argv] == 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr "Error: missing port-name"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- printUsage
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exit 2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set portName [lindex $::argv 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set ::argv [lrange $::argv 1 end]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-array set variantInfo {}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-foreach variantSetting $::argv {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set variant [split_variants $variantSetting]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach {variantName flag} $variant {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set variantInfo($variantName) $flag
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-exit [check_licenses $portName [array get variantInfo] $verbose]
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/jobs/port_binary_distributable.tcl b/jobs/port_binary_distributable.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 95aad37..90cde11 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/jobs/port_binary_distributable.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/jobs/port_binary_distributable.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -11,88 +11,9 @@
</span> # 1: non-distributable
# 2: error
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> set MY_VERSION 0.1
<span style='display:block; white-space:pre;background:#ffe0e0;'>-set check_deptypes {depends_build depends_lib}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Notes:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 'Restrictive/Distributable' means a non-free license that nonetheless allows
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# distributing binaries.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 'Restrictive' means a non-free license that does not allow distributing
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# binaries, and is thus not in the list.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 'Permissive' is a catchall for other licenses that allow
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# modification and distribution of source and binaries.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 'Copyleft' means a license that requires source code to be made available,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# and derivative works to be licensed the same as the original.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 'GPLConflict' should be added if the license conflicts with the GPL (and its
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# variants like CeCILL and the AGPL) and is not in the list of licenses known
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# to do so below.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# 'Noncommercial' means a license that prohibits commercial use.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-set good_licenses {afl agpl apache apsl artistic autoconf beopen bitstreamvera \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- boost bsd bsd-old cc-by cc-by-sa cddl cecill cecill-b cecill-c cnri copyleft \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cpl curl epl fpll fontconfig freetype gd gfdl gpl \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gplconflict ibmpl ijg isc jasper lgpl libtool lppl mit \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- mpl ncsa noncommercial openldap openssl permissive php \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- psf public-domain qpl restrictive/distributable ruby \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sleepycat ssleay tcl/tk vim w3c wtfpl wxwidgets x11 zlib zpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-foreach lic $good_licenses {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set license_good($lic) 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc all_licenses_except { args } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- global good_licenses
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set remaining $good_licenses
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach arg $args {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set remaining [lsearch -inline -all -not -exact $remaining $arg]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return [list $remaining]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# keep these values sorted
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-array set license_conflicts \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- "afl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- agpl {afl apache-1 apache-1.1 apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cecill cnri cpl epl gd gpl-1 gpl-2 gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- agpl-1 {apache freetype gpl-3 gpl-3+ lgpl-3 lgpl-3+}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apache {agpl-1 cecill gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apache-1 {agpl gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apache-1.1 {agpl gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- apsl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- beopen {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- bsd-old {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-1 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-2 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-2.5 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-3 {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cc-by-sa {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cddl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cecill {afl agpl apache apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cnri cpl epl gd gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cnri {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- cpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- epl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- freetype {agpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gd {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl {afl apache-1 apache-1.1 apsl beopen bsd-old cc-by-1 cc-by-2 cc-by-2.5 cc-by-3 cc-by-sa cddl cnri cpl epl gd gplconflict ibmpl lppl mpl noncommercial openssl php qpl restrictive/distributable ruby ssleay zpl-1}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-1 {agpl apache gpl-3 gpl-3+ lgpl-3 lgpl-3+}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-2 {agpl apache freetype gpl-3 gpl-3+ lgpl-3 lgpl-3+}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-3 {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gpl-3+ {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- gplconflict {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ibmpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lgpl-3 {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lgpl-3+ {agpl-1 gpl-1 gpl-2}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lppl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- mpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- noncommercial {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- openssl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- opensslexception [all_licenses_except openssl ssleay]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- php {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- qpl {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- restrictive/distributable {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ruby {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ssleay {agpl cecill gpl}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- zpl-1 {agpl cecill gpl}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+source [file join [file dirname [info script]] distributable_lib.tcl]
</span>
proc printUsage {} {
puts "Usage: $::argv0 \[-hvV\] port-name \[variants...\]"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -104,189 +25,6 @@ proc printUsage {} {
</span> puts "variants is the list of variants to enable/disable: +one -two..."
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# return deps and license for given port
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc infoForPort {portName variantInfo} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- global check_deptypes
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set dependencyList {}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portSearchResult [mportlookup $portName]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[llength $portSearchResult] < 1} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr "Warning: port \"$portName\" not found"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return {}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- array set portInfo [lindex $portSearchResult 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set mport [mportopen $portInfo(porturl) [list subport $portInfo(name)] $variantInfo]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- array unset portInfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- array set portInfo [mportinfo $mport]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Closing the mport is actually fairly expensive and not really necessary
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #mportclose $mport
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach dependencyType $check_deptypes {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists portInfo($dependencyType)] && $portInfo($dependencyType) ne ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach dependency $portInfo($dependencyType) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend dependencyList [string range $dependency [string last ":" $dependency]+1 end]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set ret [list $dependencyList $portInfo(license)]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists portInfo(installs_libs)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend ret $portInfo(installs_libs)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # when in doubt, assume code from the dep is incorporated
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend ret yes
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists portInfo(license_noconflict)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend ret $portInfo(license_noconflict)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return $ret
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# return license with any trailing dash followed by a number and/or plus sign removed
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc remove_version {license} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set dash [string last - $license]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$dash != -1 && [regexp {[0-9.+]+} [string range $license $dash+1 end]]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return [string range $license 0 $dash-1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return $license
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc check_licenses {portName variantInfo verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- global license_good license_conflicts
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- array set portSeen {}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set top_info [infoForPort $portName $variantInfo]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$top_info eq {}} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set top_license [lindex $top_info 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach noconflict_port [lindex $top_info 3] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set noconflict_ports($noconflict_port) 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set top_license_names {}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # check that top-level port's license(s) are good
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach sublist $top_license {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # each element may be a list of alternatives (i.e. only one need apply)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_good 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set sub_names {}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach full_lic $sublist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # chop off any trailing version number
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set lic [remove_version [string tolower $full_lic]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # add name to the list for later
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend sub_names $lic
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists license_good($lic)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_good 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend top_license_names $sub_names
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$any_good} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is not distributable because its license \"$lic\" is not known to be distributable"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # start with deps of top-level port
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portList [lindex $top_info 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- while {[llength $portList] > 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set aPort [lindex $portList 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # mark as seen and remove from the list
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portSeen($aPort) 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portList [lreplace $portList 0 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists noconflict_ports($aPort)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- continue
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set aPortInfo [infoForPort $aPort $variantInfo]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$aPortInfo eq {}} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- continue
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set aPortLicense [lindex $aPortInfo 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set installs_libs [lindex $aPortInfo 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$installs_libs} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- continue
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach sublist $aPortLicense {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_good 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_compatible 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # check that this dependency's license(s) are good
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach full_lic $sublist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set lic [remove_version [string tolower $full_lic]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists license_good($lic)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_good 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # no good being compatible with other licenses if it's not distributable itself
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- continue
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # ... and that they don't conflict with the top-level port's
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_conflict 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach top_sublist [concat $top_license $top_license_names] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_sub_compatible 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach top_lic $top_sublist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists license_conflicts([string tolower $top_lic])]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- || ([lsearch -sorted $license_conflicts([string tolower $top_lic]) $lic] == -1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- && [lsearch -sorted $license_conflicts([string tolower $top_lic]) [string tolower $full_lic]] == -1)} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_sub_compatible 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- break
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$any_sub_compatible} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_conflict 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- break
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$any_conflict} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set any_compatible 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- break
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$any_good} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is not distributable because its dependency \"$aPort\" has license \"$lic\" which is not known to be distributable"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {!$any_compatible} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is not distributable because its license \"$top_lic\" conflicts with license \"$full_lic\" of dependency \"$aPort\""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # skip deps that are explicitly stated to not conflict
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- array unset aPort_noconflict_ports
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach noconflict_port [lindex $aPortInfo 3] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set aPort_noconflict_ports($noconflict_port) 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # add its deps to the list
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach possiblyNewPort [lindex $aPortInfo 0] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists portSeen($possiblyNewPort)] && ![info exists aPort_noconflict_ports($possiblyNewPort)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend portList $possiblyNewPort
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$verbose} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "\"$portName\" is distributable"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-proc split_variants {variants} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set result {}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set l [regexp -all -inline -- {([-+])([[:alpha:]_]+[\w\.]*)} $variants]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach { match sign variant } $l {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend result $variant $sign
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return $result
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Begin
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> set verbose 0
set showVersion 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -336,4 +74,8 @@ foreach variantSetting $::argv {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-exit [check_licenses $portName [array get variantInfo] $verbose]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set results [check_licenses $portName [array get variantInfo]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {$verbose} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts [lindex $results 1]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+exit [lindex $results 0]
</span></pre><pre style='margin:0'>
</pre>