-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
port_binary_distributable: more verbose description of failures #14
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,7 @@ proc remove_version {license} { | |
|
||
proc check_licenses {portName variantInfo} { | ||
array set portSeen {} | ||
set failures {} | ||
set top_info [infoForPort $portName $variantInfo] | ||
if {$top_info eq {}} { | ||
return 1 | ||
|
@@ -219,26 +220,34 @@ proc check_licenses {portName variantInfo} { | |
set sub_names {} | ||
foreach full_lic $sublist { | ||
# chop off any trailing version number | ||
set lic [remove_version [string tolower $full_lic]] | ||
set lic [remove_version $full_lic] | ||
# add name to the list for later | ||
lappend sub_names $lic | ||
if {[info exists ::license_good($lic)]} { | ||
if {[info exists ::license_good([string tolower $lic])]} { | ||
set any_good 1 | ||
} | ||
} | ||
lappend top_license_names $sub_names | ||
if {!$any_good} { | ||
return [list 1 "\"$portName\" is not distributable because its license \"$lic\" is not known to be distributable"] | ||
lappend failures "\"$portName\" is not distributable because its license \"$lic\" is not known to be distributable" | ||
} | ||
} | ||
|
||
# start with deps of top-level port | ||
set portPaths [dict create [lindex $top_info 0] [list]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this really need a dict rather than just an array? And what's the purpose of adding an entry for the whole list of dependencies? |
||
set portList [lindex $top_info 0] | ||
foreach aPort $portList { | ||
dict set portPaths $aPort [list] | ||
} | ||
|
||
while {[llength $portList] > 0} { | ||
set aPort [lindex $portList 0] | ||
set portList [lreplace $portList 0 0] | ||
if {[info exists portSeen($aPort)] && $portSeen($aPort) eq 1} { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
continue | ||
} | ||
# mark as seen and remove from the list | ||
set portSeen($aPort) 1 | ||
set portList [lreplace $portList 0 0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving this makes the comment above incorrect. |
||
if {[info exists noconflict_ports($aPort)]} { | ||
continue | ||
} | ||
|
@@ -252,6 +261,7 @@ proc check_licenses {portName variantInfo} { | |
if {!$installs_libs} { | ||
continue | ||
} | ||
set parentPath [list {*}[dict get $portPaths $aPort] $aPort] | ||
foreach sublist $aPortLicense { | ||
set any_good 0 | ||
set any_compatible 0 | ||
|
@@ -289,10 +299,9 @@ proc check_licenses {portName variantInfo} { | |
} | ||
|
||
if {!$any_good} { | ||
return [list 1 "\"$portName\" is not distributable because its dependency \"$aPort\" has license \"$lic\" which is not known to be distributable"] | ||
} | ||
if {!$any_compatible} { | ||
return [list 1 "\"$portName\" is not distributable because its license \"$top_lic\" conflicts with license \"$full_lic\" of dependency \"$aPort\""] | ||
lappend failures "\"$portName\" is not distributable because its dependency \"$aPort\" has license \"$full_lic\" which is not known to be distributable: [join $parentPath " -> "]" | ||
} elseif {!$any_compatible} { | ||
lappend failures "\"$portName\" is not distributable because its license \"$top_lic\" conflicts with license \"$full_lic\": [join $parentPath " -> "]" | ||
} | ||
} | ||
|
||
|
@@ -305,11 +314,16 @@ proc check_licenses {portName variantInfo} { | |
foreach possiblyNewPort [lindex $aPortInfo 0] { | ||
if {![info exists portSeen($possiblyNewPort)] && ![info exists aPort_noconflict_ports($possiblyNewPort)]} { | ||
lappend portList $possiblyNewPort | ||
dict set portPaths $possiblyNewPort $parentPath | ||
} | ||
} | ||
} | ||
|
||
return [list 0 "\"$portName\" is distributable"] | ||
if {[llength $failures] ne 0} { | ||
return [list 1 $failures] | ||
} else { | ||
return [list 0 [list "\"$portName\" is distributable"]] | ||
} | ||
} | ||
|
||
# given a variant string, return an array of variations | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
[list]
so the variable is a pure list.