commit:     36235596e061bf8cf4729b3915f9aaa6ec80baa3
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Sat Apr  6 08:28:43 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 26 22:05:48 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=36235596

lib: adhere to python package version conventions

* Commit metadata isn't valid version that python tooling is expected to
  parse. Follow python ecosystem conventions and make it a local
  version.

https://packaging.python.org/en/latest/specifications/version-specifiers/#local-version-segments

Example:
* Old: 3.0.63-g08a2bc380
* New: 3.0.63+g08a2bc380

Bug: https://bugs.gentoo.org/926966
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/1314
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py
index a468eeaff3..21bf993170 100644
--- a/lib/portage/__init__.py
+++ b/lib/portage/__init__.py
@@ -732,7 +732,7 @@ if installation.TYPE == installation.TYPES.SOURCE:
                 output = _unicode_decode(proc.communicate()[0], 
encoding=encoding)
                 status = proc.wait()
                 if os.WIFEXITED(status) and os.WEXITSTATUS(status) == os.EX_OK:
-                    VERSION = output.lstrip('portage-').strip()
+                    VERSION = output.lstrip("portage-").strip().replace("-g", 
"+g")
             else:
                 VERSION = "HEAD"
             return VERSION

Reply via email to