#37 srpm/go.lua: fix handling of version numbers with multiple digits
Merged 2 years ago by eclipseo. Opened 2 years ago by tomranta.
https://github.com/rantala/go-rpm-macros.git digit-fix  into  master

srpm/go.lua: fix handling of version numbers with multiple digits
Tommi Rantala • 2 years ago  
rpm/lua/srpm/go.lua
file modified
+2 -2
@@ -67,8 +67,8 @@

    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

  

no initial comment

Fix handling of double digit version numbers, regression introduced in commit 65a2d82 ("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

I think this is wider issues that is caused by Go guidelines lagging behind the current state of Go, especially use of the modules and the release/version tags there. I guess the "v10" is actually correct if version/tag needs to be a part of the name of the packages. It will be compat package(there is need to carry more version of the same package in the distro) in a sense. IMHO general fix is to ignore the versioning part of the import path in the go rpm macros magic and let the version be defined by the rpm's version tag in spec. I'm aware that will most probably will be rather bigger undertaking, I guess including the update of the packaging guidelines.
@alexsaezm @ngompa @dbenoit What are your takes here?

Pull-Request has been merged by eclipseo

2 years ago
Metadata