<pre style='margin:0'>
Arjun Salyan (arjunsalyan) pushed a commit to branch master
in repository macports-contrib.
</pre>
<p><a href="https://github.com/macports/macports-contrib/commit/3c89a8e0260c1ef3da52950cb6b4845d8a726ac9">https://github.com/macports/macports-contrib/commit/3c89a8e0260c1ef3da52950cb6b4845d8a726ac9</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 3c89a8e portindex2json: Add support for parsing vinfo
</span>3c89a8e is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 3c89a8e0260c1ef3da52950cb6b4845d8a726ac9
</span>Author: arjunsalyan <iarjunsalyan@gmail.com>
AuthorDate: Mon Jul 27 14:36:22 2020 +0530
<span style='display:block; white-space:pre;color:#404040;'> portindex2json: Add support for parsing vinfo
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> https://github.com/macports/macports-base/pull/200
</span>---
portindex2json/portindex2json.tcl | 43 +++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/portindex2json/portindex2json.tcl b/portindex2json/portindex2json.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 0fd39c7..b748381 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/portindex2json/portindex2json.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/portindex2json/portindex2json.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -68,6 +68,45 @@ proc parse_maintainers {maintainers} {
</span> return $maintainers_list
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc parse_vinfo {vinfo variants} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set vinfo_subobjects {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set vinfo_array $vinfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach v $variants {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists vinfo_array($v)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array unset variant
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set variant $vinfo_array($v)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array unset variant_subobject
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variant_subobject(variant) [::json::write string $v]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists variant(description)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variant_subobject(description) [::json::write string $variant(description)]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists variant(requires)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variant_subobject(requires) [::json::write string $variant(requires)]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists variant(conflicts)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variant_subobject(conflicts) [::json::write string $variant(conflicts)]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists variant(is_default)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variant_subobject(is_default) true
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[array exists variant_subobject]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend vinfo_subobjects [::json::write object {*}[array get variant_subobject]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set vinfo_list [::json::write array {*}$vinfo_subobjects]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $vinfo_list
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> proc is_closedmaintainer {maintainers} {
foreach maintainer $maintainers {
if {$maintainer eq "openmaintainer" || $maintainer eq "nomaintainer"} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -154,6 +193,10 @@ while {[gets $fd line] >= 0} {
</span> set json_portinfo(closedmaintainer) [is_closedmaintainer $portinfo($key)]
} elseif {$key eq "description" || $key eq "long_description"} {
set json_portinfo($key) [::json::write string [join $portinfo($key)]]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ } elseif {$key eq "vinfo" && [info exists portinfo(variants)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array unset vinfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set vinfo $portinfo($key)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set json_portinfo($key) [parse_vinfo [array get vinfo] $portinfo(variants)]
</span> } else {
set json_portinfo($key) [::json::write string $portinfo($key)]
}
</pre><pre style='margin:0'>
</pre>