From 1702fad14bc2582e18a3f0dc9819ee2e2e0b943f Mon Sep 17 00:00:00 2001 From: Tommi Rantala Date: Oct 15 2021 07:23:34 +0000 Subject: srpm/go.lua: fix handling of version numbers with multiple digits Fix handling of double digit version numbers, regression introduced in commit 65a2d82b029 ("srpm/go.lua: avoid remove char 'v' from project name"). Example: $ grep goipath golang-github-playground-validator-10.spec %global goipath github.com/go-playground/validator/v10 Before this patch: $ rpmspec --srpm -q --qf '%{name}\n' golang-github-playground-validator-10.spec golang-github-playground-validator-v10 After this patch: $ rpmspec --srpm -q --qf '%{name}\n' golang-github-playground-validator-10.spec golang-github-playground-validator-10 --- diff --git a/rpm/lua/srpm/go.lua b/rpm/lua/srpm/go.lua index 9708262..00ffcde 100644 --- a/rpm/lua/srpm/go.lua +++ b/rpm/lua/srpm/go.lua @@ -67,8 +67,8 @@ local function rpmname(goipath, compatid) result = string.gsub(result, ":", ".") -- some projects have a name that end up in a number, and *also* add release -- numbers on top of it, keep a - prefix before version strings - result = string.gsub(result, "%-v([%.%d])$", "-%1") - result = string.gsub(result, "%-v([%.%d]%-)", "-%1") + result = string.gsub(result, "%-v([%.%d]+)$", "-%1") + result = string.gsub(result, "%-v([%.%d]+%-)", "-%1") return(result) end