Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 912209 - Switch to gnulib-style versioning (git-describe) for emerge --info output from git
Summary: Switch to gnulib-style versioning (git-describe) for emerge --info output fro...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, PATCH
Depends on: 925481
Blocks:
  Show dependency tree
 
Reported: 2023-08-13 07:05 UTC by Sam James
Modified: 2024-06-10 23:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-lib-use-more-pure-git-describe-output-for-version.patch (0001-lib-use-more-pure-git-describe-output-for-version.patch,3.56 KB, patch)
2024-03-14 04:57 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-13 07:05:49 UTC
Chewi improved the format a fair bit when fixing bug 895908, but I have a suggestion to go a bit further.

I'm a fan of gnulib's git-version-gen which is based on git-describe. In particular, https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/git-version-gen#n165.

This would take us from e.g. portage-3.0.50_p3 to portage-3.0.50-3-xxxx where xxxx is the short form of the latest commit, and 3 is the number of commits since the last tag.
Comment 1 Mike Gilbert gentoo-dev 2023-08-13 17:42:09 UTC
Seems reasonable.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-29 07:37:45 UTC
I was curious about some of the history here, so for my own benefit:

commit 1540d5eb4d8ab7f6a4813462acf9774f1e7ecc0e
Author: Brian Dolbec <dolsen@gentoo.org>
Date:   Mon Dec 5 11:56:02 2016 -0800

    portage/__init__.py: Fix live versioning to look for portage tags only

commit 36a7f18dcbea9072cd6e2d7d923a9c7b4638aab9
Author: Mike Gilbert <floppym@gentoo.org>
Date:   Tue Jun 28 19:56:44 2016 -0400

    portage.VERSION: compensate for new git tag format

commit 7f089f0d6b25d539d1ff16abc6bcc930a613e22a
Author: Zac Medico <zmedico@gentoo.org>
Date:   Mon Sep 20 00:36:12 2010 -0700

    Use git rev-list --format option to simplify _LazyVersion committer
    timestamp code.

commit 213dce575a3302ea3b24a81382a587533fd665e1
Author: Zac Medico <zmedico@gentoo.org>
Date:   Sun Sep 19 16:33:03 2010 -0700

    Bug #338002 - Make _LazyVersion format portage.VERSION so that it is
    a valid version.

commit 4f8e75b71f149b1aa0411051fe06a836f6f07cd3
Author: Zac Medico <zmedico@gentoo.org>
Date:   Sat Mar 27 14:35:11 2010 -0700

    If portage.VERSION == HEAD then use a proxy to lazily call git describe --tags
    if it's accessed.

commit f1b05b7098ba448a0987bc61224d6616dad3ecde
Author: Zac Medico <zmedico@gentoo.org>
Date:   Wed Mar 24 00:03:51 2010 -0700

    Don't use $Id or $Rev for version strings since that doesn't work with git.

commit 722127498c5a14be27fb2dee5d4abd4589b855ce
Author: Jason Stubbs <jstubbs@gentoo.org>
Date:   Sat Oct 15 06:09:42 2005 +0000

    Adding svn revision property to portage.py's VERSION

    svn path=/main/branches/2.0/; revision=2133
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-14 04:57:44 UTC
Created attachment 887567 [details, diff]
0001-lib-use-more-pure-git-describe-output-for-version.patch
Comment 4 Larry the Git Cow gentoo-dev 2024-04-26 22:06:04 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=381fad5e3554ec94ec5626e8c17874f32b30b752

commit 381fad5e3554ec94ec5626e8c17874f32b30b752
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-08-29 07:26:36 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-04-26 22:05:48 +0000

    lib: use more pure git-describe output for --version
    
    Use `git describe --dirty` output rather than mangling git-describe and reinventing
    --dirty by manually checking for changes post-commit.
    
    We no longer mangle the 7th commit post-tag into _p7, but instead do: ${tag}-7-${last_commit}.
    
    This is similar to gnulib's git-version-gen (which we may still want to import,
    not sure, this seems enough for now) and is familiar output for developers.
    
    Example:
    * Old: 3.0.51_p7
    * New: 3.0.51-7-g098b30548
    
    Bug: https://bugs.gentoo.org/912209
    Signed-off-by: Sam James <sam@gentoo.org>

 lib/portage/__init__.py | 35 ++++-------------------------------
 1 file changed, 4 insertions(+), 31 deletions(-)