On Sep 30, 2014, at 4:02 PM, Craig Treleaven <[email protected]> wrote:

> you've given me a complete solution!

I just realized that you're probably using "N" to signify that a variant is not 
selected, so "Y" should be used if a variant *is* selected.


# Save port to hold space.
/ has the variants/ {
    s/ has .*$//
    h
    d
}

# Remove noise.
/conflicts with/d
/^[^:]*mariadb[^:]*:/b db_variant
/^[^:]*mysql[^:]*:/b db_variant
/^[^:]*percona[^:]*:/b db_variant
d

:db_variant

# Append desired suffix to variant name.
/^\[+\]/s/.*]\(.*\):.*$/\1      Default/
/^[[:blank:]]*+/s/[[:blank:]]*+\(.*\):.*$/\1    Y/
/^[[:blank:]]*[^+]/s/[[:blank:]]*\(.*\):.*$/\1  N/

# Extract port name from hold space and append variant name and suffix.
x
s/[[:blank:]].*$//
G
s/\n/   /

# Print pattern space and save to hold space for subsequent lines.
p
h


vq
_______________________________________________
macports-dev mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to