New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 79148


Ignore:
Timestamp:
06/03/11 02:47:24 (4 years ago)
Author:
jmr@…
Message:

interpret sublists in the license field as offering a choice of license

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/portmgr/jobs/port_binary_distributable.tcl

    r78924 r79148  
    66# Check that binaries of a port are distributable by looking at its license 
    77# and the licenses of its dependencies. 
     8# 
     9# Expected format: A {B C} means the license is A plus either B or C. 
    810# 
    911# Exit status: 
     
    2022 
    2123set good_licenses {agpl apache apsl artistic boost bsd cecill cpl curl \ 
    22                    fontconfig freebsd gfdl gpl ibmpl ijg jasper lgpl libpng \ 
    23                    mit mpl openssl php psf qpl public-domain ruby sleepycat \ 
    24                    ssleay x11 zlib zpl} 
     24                   fontconfig freebsd freetype gfdl gpl ibmpl ijg jasper \ 
     25                   lgpl libpng mit mpl openssl php psf qpl public-domain \ 
     26                   ruby sleepycat ssleay x11 zlib zpl} 
    2527foreach lic $good_licenses { 
    2628    set license_good($lic) 1 
     
    108110    set top_license_names {} 
    109111    # check that top-level port's license(s) are good 
    110     foreach full_lic $top_license { 
    111         # chop off any trailing version number 
    112         set lic [remove_version [string tolower $full_lic]] 
    113         # add name to the list for later 
    114         lappend top_license_names $lic 
    115         if {![info exists license_good($lic)]} { 
     112    foreach sublist $top_license { 
     113        # each element may be a list of alternatives (i.e. only one need apply) 
     114        set any_good 0 
     115        set sub_names {} 
     116        foreach full_lic $sublist { 
     117            # chop off any trailing version number 
     118            set lic [remove_version [string tolower $full_lic]] 
     119            # add name to the list for later 
     120            lappend sub_names $lic 
     121            if {[info exists license_good($lic)]} { 
     122                set any_good 1 
     123            } 
     124        } 
     125        lappend top_license_names $sub_names 
     126        if {!$any_good} { 
    116127            if {$verbose} { 
    117128                puts "'$portName' has license '$lic' which is not known to be distributable" 
     
    120131        } 
    121132    } 
     133 
    122134    # start with deps of top-level port 
    123135    set portList [lindex $top_info 0] 
     
    134146            continue 
    135147        } 
    136         foreach full_lic $aPortLicense { 
     148        foreach sublist $aPortLicense { 
     149            set any_good 0 
     150            set any_compatible 0 
    137151            # check that this dependency's license(s) are good 
    138             set lic [remove_version [string tolower $full_lic]] 
    139             if {![info exists license_good($lic)]} { 
     152            foreach full_lic $sublist { 
     153                set lic [remove_version [string tolower $full_lic]] 
     154                if {[info exists license_good($lic)]} { 
     155                    set any_good 1 
     156                } else { 
     157                    # no good being compatible with other licenses if it's not distributable itself 
     158                    continue 
     159                } 
     160 
     161                # ... and that they don't conflict with the top-level port's 
     162                set any_conflict 0 
     163                foreach top_sublist [concat $top_license $top_license_names] { 
     164                    set any_sub_compatible 0 
     165                    foreach top_lic $top_sublist { 
     166                        if {![info exists license_conflicts([string tolower $top_lic])] 
     167                            || ([lsearch -sorted $license_conflicts([string tolower $top_lic]) $lic] == -1 
     168                            && [lsearch -sorted $license_conflicts([string tolower $top_lic]) [string tolower $full_lic]] == -1)} { 
     169                            set any_sub_compatible 1 
     170                            break 
     171                        } 
     172                    } 
     173                    if {!$any_sub_compatible} { 
     174                        set any_conflict 1 
     175                        break 
     176                    } 
     177                } 
     178                if {!$any_conflict} { 
     179                    set any_compatible 1 
     180                    break 
     181                } 
     182            } 
     183 
     184            if {!$any_good} { 
    140185                if {$verbose} { 
    141186                    puts "dependency '$aPort' has license '$lic' which is not known to be distributable" 
     
    143188                return 1 
    144189            } 
    145             # ... and that they don't conflict with the top-level port's 
    146             foreach top_lic [concat $top_license $top_license_names] { 
    147                 if {[info exists license_conflicts([string tolower $top_lic])] 
    148                     && ([lsearch -sorted $license_conflicts([string tolower $top_lic]) $lic] != -1 
    149                     || [lsearch -sorted $license_conflicts([string tolower $top_lic]) [string tolower $full_lic]] != -1)} { 
    150                     if {$verbose} { 
    151                         puts "dependency '$aPort' has license '$full_lic' which conflicts with license '$top_lic' from '$portName'" 
    152                     } 
    153                     return 1 
    154                 } 
     190            if {!$any_compatible} { 
     191                if {$verbose} { 
     192                    puts "dependency '$aPort' has license '$full_lic' which conflicts with license '$top_lic' from '$portName'" 
     193                } 
     194                return 1 
    155195            } 
    156196        } 
Note: See TracChangeset for help on using the changeset viewer.