Ticket #28640: portlint2.diff

File portlint2.diff, 2.5 KB (added by kurthindenburg (Kurt Hindenburg), 9 years ago)
  • portlint.tcl

     
    154154    array set portgroups {}
    155155
    156156    set local_variants [list]
     157    set local_dependstypes [list]
    157158
    158159    set f [open $portfile RDONLY]
    159160    # read binary (to check UTF-8)
     
    331332
    332333        ### TODO: more checks to Portfile syntax
    333334
     335        # If portfile uses PortGroup, check current portfile for any depends_* without
     336        # -append.  If so, save them for later.
     337        if ($seen_portgroup) {
     338            if {[regexp {^(?:\s*)depends_([a-z]+)(.)(?:.*)} $line -> dependtype haveappend]} {
     339                if {$haveappend ne "-"} {
     340                    lappend local_dependstypes $dependtype
     341                }
     342            }
     343        }
     344
    334345        incr lineno
    335346    }
    336347
     
    357368    if ($seen_portgroup) {
    358369        # Using a PortGroup is optional
    359370        foreach {portgroup portgroupversion} [array get portgroups] {
    360             if {![file exists [getportresourcepath $porturl "port1.0/group/${portgroup}-${portgroupversion}.tcl"]]} {
     371            set portfile [getportresourcepath $porturl "port1.0/group/${portgroup}-${portgroupversion}.tcl"]
     372            if {![file exists $portfile]} {
    361373                ui_error "Unknown PortGroup: $portgroup-$portgroupversion"
    362374                incr errors
    363375            } else {
    364376                ui_info "OK: Found PortGroup $portgroup-$portgroupversion"
     377
     378                # Determine if PortGroup has any depends_* matching local Portfile's
     379                set f [open $portfile RDONLY]
     380                while {1} {
     381                    set line [gets $f]
     382                    # Does depends_*-append in PortGroups make a difference to whether a port should use -append?
     383                    if {[regexp {^(?:\s*)depends_([a-z]+)(.)(?:.*)} $line -> dependtype haveappend]} {
     384                        if {[lsearch -exact $local_dependstypes $dependtype] >= 0} {
     385                            ui_error "PortGroup $portgroup uses depends_$dependtype, so use depends_$dependtype-append"
     386                            # Remove this dependtype to avoid duplicate messages
     387                            set local_dependstypes [lsearch -all -inline -not -exact $local_dependstypes $dependtype]
     388                            incr errors
     389                        }
     390                    }
     391                    if {[eof $f]} {
     392                        close $f
     393                        break
     394                    }
     395                }
    365396            }
    366397        }
    367398    }