Including port groups multiple times (was: Re: passing variants to dependencies; pre-activate check)

Clemens Lang cal at macports.org
Thu Oct 15 13:17:30 PDT 2015


Hi David,

----- On 15 Oct, 2015, at 21:21, David Strubbe dstrubbe at macports.org wrote:

> Do you have a suggestion of how to accomplish that? That could potentially be a
> simpler approach than adding include guards.

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."
 }

-- 
Clemens Lang


More information about the macports-dev mailing list