git: 6b1b15742593 - main - cargo.mk: Strip vV from GitHub tags only when followed by a digit

From: Tobias Kortkamp <tobik_at_FreeBSD.org>
Date: Mon, 02 Oct 2023 11:33:38 UTC
The branch main has been updated by tobik:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6b1b157425932c2977c10a53c090101215c8ad5e

commit 6b1b157425932c2977c10a53c090101215c8ad5e
Author:     Tobias Kortkamp <tobik@FreeBSD.org>
AuthorDate: 2023-09-30 08:38:19 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2023-10-02 11:33:25 +0000

    cargo.mk: Strip vV from GitHub tags only when followed by a digit
    
    Fixes the following in games/veloren-weekly when iced crates have a tag
    similar to veloren-winit-0.28
    
    $ cd games/veloren-weekly
    $ make cargo-crates-merge
    $ make
    [...]
    ===>  Configuring for veloren-weekly-s20230830
    ===>   Cargo config:
    find: /usr/ports/games/veloren-weekly/work/egui_winit_platform-eloren-winit-0.28: No such file or directory
    find: /usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28: No such file or directory
    find: /usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28: No such file or directory
    find: /usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28: No such file or directory
    find: /usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28: No such file or directory
    find: /usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28: No such file or directory
    find: /usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28: No such file or directory
    [...]
    [patch.'https://gitlab.com/Imbris/keyboard-keynames.git']
    keyboard-keynames = { path = '/usr/ports/games/veloren-weekly/work/keyboard-keynames-veloren-winit-0.28-fca4bbdfa51bf054b155a455935b3792975c989d' }
    [...]
    [patch.'https://github.com/Imberflur/egui_winit_platform.git']
    egui_winit_platform = { path = '/usr/ports/games/veloren-weekly/work/egui_winit_platform-eloren-winit-0.28' }
    [...]
    [patch.'https://github.com/Imberflur/iced']
    iced_core = { path = '/usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28' }
    iced_futures = { path = '/usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28' }
    iced_graphics = { path = '/usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28' }
    iced_native = { path = '/usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28' }
    iced_style = { path = '/usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28' }
    iced_winit = { path = '/usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28' }
    [...]
    ===>   Updating Cargo.lock
    error: failed to load source for dependency `iced_core`
    
    Caused by:
      Unable to update /usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28
    
    Caused by:
      failed to read `/usr/ports/games/veloren-weekly/work/iced-eloren-winit-0.28/Cargo.toml`
    
    Caused by:
      No such file or directory (os error 2)
    *** Error code 101
    
    Stop.
    make[1]: stopped in /usr/ports/games/veloren-weekly
    
    PR:             273468
    Reported by:    jbeich
---
 Mk/Scripts/cargo-crates-git-common.awk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Mk/Scripts/cargo-crates-git-common.awk b/Mk/Scripts/cargo-crates-git-common.awk
index f4023bb4f880..36eb0027d3d7 100644
--- a/Mk/Scripts/cargo-crates-git-common.awk
+++ b/Mk/Scripts/cargo-crates-git-common.awk
@@ -65,7 +65,9 @@ function split_git_url(info, git_url,		url, path, account, project, commit, i, d
 			# "GitHub silently converts tags starting with v to not have v in the filename
 			# and extraction directory.  It also replaces + with -."
 			dir_ver = commit
-			sub(/^[vV]/, "", dir_ver)
+			if (dir_ver ~ /^[vV][0-9]/) {
+				sub(/^[vV]/, "", dir_ver)
+			}
 			gsub(/\+/, "-", dir_ver)
 			gsub(/--/, "-", dir_ver)
 			info["dir"] = sprintf("%s-%s", project, dir_ver)