Including port groups multiple times

Rainer Müller raimue at macports.org
Thu Oct 15 15:13:07 PDT 2015


On 10/15/2015 10:17 PM, Clemens Lang wrote:
> PortGroup is a function defined in base/src/port1.0/portutil.tcl, line 2563. It
> could use a list that tracks which portgroup files have been included and avoid
> including them twice.
> 
> Something like:
> 
>  global _portgroups_included
>  if {![info exists _portgroups_included]} {
>     set _portgroups_included [list]
>  }
> 
> and then instead of
> 
>  uplevel "source $groupFile"
> 
> use something like
> 
>  if {$groupFile ni $_portgroups_included} {
>    lappend _portgroups_included $groupFile
>    uplevel "source $groupFile"
>  } else {
>    ui_warn "PortGroup ${group} ${version} already included, skipping repeated include."
>  }

This check could even turn into an error if different versions of the same port
group are requested.

Rainer


More information about the macports-dev mailing list