<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/b2655a7ea2107a30cf614a304c7658f980c57f66">https://github.com/macports/macports-infrastructure/commit/b2655a7ea2107a30cf614a304c7658f980c57f66</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit b2655a7ea2107a30cf614a304c7658f980c57f66
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Fri Nov 12 00:38:10 2021 +1100

<span style='display:block; white-space:pre;color:#404040;'>    distributable_lib: handle exceptions better
</span><span style='display:block; white-space:pre;color:#404040;'>    
</span><span style='display:block; white-space:pre;color:#404040;'>    Handle license exceptions as a way of removing a conflict with certain
</span><span style='display:block; white-space:pre;color:#404040;'>    ports, rather than as a weird license that conflicts with everything
</span><span style='display:block; white-space:pre;color:#404040;'>    except certain licenses. This also means that the exception itself is
</span><span style='display:block; white-space:pre;color:#404040;'>    not reported as the reason for a conflict.
</span>---
 jobs/distributable_lib.tcl | 41 ++++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/jobs/distributable_lib.tcl b/jobs/distributable_lib.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 71c9e3f..3e32e56 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/jobs/distributable_lib.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;'>@@ -29,14 +29,6 @@ foreach lic $good_licenses {
</span>     set license_good($lic) 1
 }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-proc all_licenses_except { args } {
</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 $remaining
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # keep these values sorted
 array set license_conflicts \
     [list \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -74,7 +66,6 @@ array set license_conflicts \
</span>     mpl [list agpl cecill gpl] \
     noncommercial [list agpl cecill gpl] \
     openssl [list agpl cecill gpl] \
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    opensslexception [all_licenses_except openssl ssleay] \
</span>     php [list agpl cecill gpl] \
     qpl [list agpl cecill gpl] \
     restrictive/distributable [list agpl cecill gpl] \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -83,6 +74,9 @@ array set license_conflicts \
</span>     zpl-1 [list agpl cecill gpl] \
     ]
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# map license name indicating exception to regex matching port names it applies to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set license_exceptions(opensslexception) {^openssl[0-9]*$}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # license database format:
 # each line consists of "portname mtime {array}"
 # where array is one or more {variant_string {dependencies license installs_libs [license_noconflict]}}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -276,12 +270,26 @@ proc check_licenses {portName variantInfo} {
</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;'>+                        #puts stderr "checking $top_lic with $full_lic in $aPort"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        set top_lic_low [string tolower $top_lic]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        if {[info exists ::license_exceptions($top_lic_low)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            #puts stderr "exception exists for $top_lic"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            if {[regexp $::license_exceptions($top_lic_low) $aPort]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                #puts stderr "exception $top_lic_low exists for $::license_exceptions($top_lic_low) which matches $aPort"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                set any_sub_compatible 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                break
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                #puts stderr "exception $top_lic_low does not apply to $aPort"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                continue
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        } elseif {![info exists ::license_conflicts($top_lic_low)]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            || ([lsearch -sorted $::license_conflicts($top_lic_low) $lic] == -1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            && [lsearch -sorted $::license_conflicts($top_lic_low) [string tolower $full_lic]] == -1)} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            #puts stderr "no exception and no conflict exists for $top_lic with $full_lic in $aPort"
</span>                             set any_sub_compatible 1
                             break
                         }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+                        set conflicting_top_lic $top_lic
</span>                     }
                     if {!$any_sub_compatible} {
                         set any_conflict 1
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -298,7 +306,14 @@ proc check_licenses {portName variantInfo} {
</span>                 return [list 1 "\"$portName\" is not distributable because its dependency \"$aPort\" has license \"$lic\" which is not known to be distributable"]
             }
             if {!$any_compatible} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                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:#e0ffe0;'>+                if {[info exists conflicting_top_lic]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    set display_lic " \"$conflicting_top_lic\" "
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    # Only has an exception and not an actual license listed.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    # This is a mistake, but let's handle it gracefully anyway.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    set display_lic ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                return [list 1 "\"$portName\" is not distributable because its license${display_lic}conflicts with license \"$full_lic\" of dependency \"$aPort\""]
</span>             }
         }
 
</pre><pre style='margin:0'>

</pre>