Hi Rainer,

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

If we do go with include guards, anyone want to comment on my particular
implementation?

Index: dports/_resources/port1.0/group/active_variants-1.1.tcl
===================================================================
--- dports/_resources/port1.0/group/active_variants-1.1.tcl     (revision
141271)
+++ dports/_resources/port1.0/group/active_variants-1.1.tcl     (working
copy)
@@ -87,6 +87,12 @@
 #     dependencies, e.g., require_active_variants path:foo/bar:standardport
 #     variant

+default active_variants_included {}
+
+# only include this PortGroup once
+if {${active_variants_included} == ""} {
+    set active_variants_included "yes"
+
 proc active_variants {depspec required {forbidden {}}} {
        # get the port which will provide $depspec; this allows us to
support e.g.,
        # path-style dependencies. This comes from port1.0/portutil.tcl and
should
@@ -278,3 +284,5 @@
 pre-activate {
         _check_require_active_variants activate
 }
+
+}

David

On Wed, Oct 14, 2015 at 9:19 AM, Rainer Müller <[email protected]> wrote:

> On 2015-10-14 05:49, Ryan Schmidt wrote:
> > You're right, it's probably important for portgroup to guard against
> multiple inclusion.
> >
> > https://en.wikipedia.org/wiki/Include_guard
> >
> > "port lint" will warn you if you include a portgroup more than once, but
> that won't check portgroup inclusion in files other than the portfile
> itself, can give false positives for portgroups that are included in
> conditionals (including subports), and even ignores lines with leading
> whitespace.
> >
> > We should develop a standard include guard for portgroups (possibly the
> one you suggested) and use it in every portgroup.
>
> If we decide that there is no use case for including a port group
> multiple times, we could prevent this in base when evaluating PortGroup
> statements.
>
> Rainer
> _______________________________________________
> macports-dev mailing list
> [email protected]
> https://lists.macosforge.org/mailman/listinfo/macports-dev
>
_______________________________________________
macports-dev mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to