<pre style='margin:0'>
Aaron Madlon-Kay (amake) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/216da844a89fa8d8764fcacbed83d4acc9f98d28">https://github.com/macports/macports-ports/commit/216da844a89fa8d8764fcacbed83d4acc9f98d28</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 216da844a89fa8d8764fcacbed83d4acc9f98d28
</span>Author: Aaron Madlon-Kay <amake@macports.org>
AuthorDate: Thu Sep 24 00:39:25 2020 +0900
<span style='display:block; white-space:pre;color:#404040;'> golang-1.0 portgroup: support `resolves_to` keyword in go.vendors
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> This helps support dependencies hosted under custom domains
</span>---
_resources/port1.0/group/golang-1.0.tcl | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/_resources/port1.0/group/golang-1.0.tcl b/_resources/port1.0/group/golang-1.0.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 7aed6fdb367..d5dbed57364 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/_resources/port1.0/group/golang-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/_resources/port1.0/group/golang-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -13,7 +13,8 @@
</span> # rmd160 fedcba654321... \
# sha256 bdface246135... \
# size 1234 \
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# example.com/dep2/bar \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# vanity_domain.com/dep2_bar \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# repo example.com/dep2/bar \
</span> # lock fedcba654321... \
# rmd160 abcdef123456... \
# sha256 fedcba654321... \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -35,6 +36,11 @@
</span> # The go.vendors option expects a list of package IDs, each followed by these
# labeled values:
#
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# - repo: Packages are sometimes hosted on domains that merely redirect to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# well-known hosts such as GitHub. In that case, specify the resolved package
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# name with the `repo` keyword. Example: coolbiz.io/coolpackage might resolve
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# to github.com/coolbiz/package. This must come before the `lock` keyword.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span> # - lock: the version of the package in git reference format. This must come
# before any checksums.
#
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -174,19 +180,29 @@ proc handle_set_go_vendors {vendors_str} {
</span> # Get the Go package ID
set vpackage [lindex ${vendors_str} ${ix}]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Split up the package ID
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lassign [go._translate_package_id ${vpackage}] vdomain vauthor vproject
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Package resolves to itself by default; only overridden in case of
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # redirects, etc.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set vresolved ${vpackage}
</span>
# Handle the remaining values for this package
incr ix
while {1} {
set token [lindex ${vendors_str} ${ix}]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {${token} eq "lock"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${token} eq "repo"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Handle the package's resolved name. See discussion of this in
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # header comments.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ incr ix
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set vresolved [lindex ${vendors_str} ${ix}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ incr ix
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } elseif {${token} eq "lock"} {
</span> # Handle the package version ("lock" as in "lockfile")
incr ix
set vversion [lindex ${vendors_str} ${ix}]
incr ix
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Split up the package ID
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lassign [go._translate_package_id ${vresolved}] vdomain vauthor vproject
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> if {[string match v* ${vversion}]} {
set sha1_short {}
} else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -196,7 +212,7 @@ proc handle_set_go_vendors {vendors_str} {
</span> # Bitbucket uses 12. We take 7 and use globbing.
set sha1_short [string range ${vversion} 0 6]
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend go.vendors_internal [list ${sha1_short} ${vpackage} ${vversion}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend go.vendors_internal [list ${sha1_short} ${vpackage} ${vresolved} ${vversion}]
</span>
switch ${vdomain} {
github.com {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -267,12 +283,13 @@ post-extract {
</span> }
foreach vlist ${go.vendors_internal} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lassign ${vlist} sha1_short vpackage
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lassign ${vlist} sha1_short vpackage vresolved
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> file mkdir ${gopath}/src/[file dirname ${vpackage}]
if {${sha1_short} ne ""} {
move [glob ${workpath}/*-${sha1_short}*] ${gopath}/src/${vpackage}
} else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lassign [go._translate_package_id ${vpackage}] _ vauthor vproject
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lassign [go._translate_package_id ${vresolved}] _ vauthor vproject
</span> move [glob ${workpath}/${vauthor}-${vproject}-*] ${gopath}/src/${vpackage}
}
}
</pre><pre style='margin:0'>
</pre>