aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2022-10-08 12:21:19 +0000
committerTobias Kortkamp <tobik@FreeBSD.org>2022-10-08 12:21:19 +0000
commit18052912af5ddbea5d2008e750c568dda0d97b43 (patch)
tree0e84613d3b60ce3e87ea90a802b5be201ebca50d
parent9cf374f5ed89e394b8550abdb520c7c822f64edf (diff)
downloadports-18052912af5ddbea5d2008e750c568dda0d97b43.tar.gz
ports-18052912af5ddbea5d2008e750c568dda0d97b43.zip
Uses/cargo: Fix invalid WRKSRC for crates fetched from GitLab with tag
When using tags the archive fetched from GitLab has the corresponding commit hash appended to the directory root too. snui@git+https://gitlab.com/snakedye/snui.git?tag=v0.1.4\#83873f1e148a9c84471c10f166c9a945a44d3e64 would result in WRKSRC_crate_snui= ${WRKDIR}/snui-v0.1.4 but it must be WRKSRC_crate_snui= ${WRKDIR}/snui-v0.1.4-83873f1e148a9c84471c10f166c9a945a44d3e64 PR: 266724 Reported by: jbeich
-rw-r--r--Mk/Scripts/cargo-crates-git-common.awk11
1 files changed, 9 insertions, 2 deletions
diff --git a/Mk/Scripts/cargo-crates-git-common.awk b/Mk/Scripts/cargo-crates-git-common.awk
index c1c5dcc7ce6e..f4023bb4f880 100644
--- a/Mk/Scripts/cargo-crates-git-common.awk
+++ b/Mk/Scripts/cargo-crates-git-common.awk
@@ -38,7 +38,7 @@ function commit_from_git_url(url) {
}
}
-function split_git_url(info, git_url, url, path, account, project, commit, i, dir_ver, host) {
+function split_git_url(info, git_url, url, path, account, project, commit, i, dir_ver, host, tag, fragment) {
delete info
split_url(url, git_url)
url["scheme"] = tolower(url["scheme"])
@@ -80,6 +80,8 @@ function split_git_url(info, git_url, url, path, account, project, commit, i, d
project = path[i]
sub(/\.[gG][iI][tT]$/, "", project)
commit = commit_from_git_url(url)
+ fragment = url["fragment"]
+ tag = url["query", "tag"]
host = url["host"]
delete url
@@ -93,7 +95,12 @@ function split_git_url(info, git_url, url, path, account, project, commit, i, d
gsub(/\//, "-", account)
info["filename"] = sprintf("%s-%s-%s_GL0.tar.gz", account, project, commit)
- info["dir"] = sprintf("%s-%s", project, commit)
+ # c.f. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266724
+ if (tag) {
+ info["dir"] = sprintf("%s-%s-%s", project, tag, fragment)
+ } else {
+ info["dir"] = sprintf("%s-%s", project, commit)
+ }
return 1
}