Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 887567 Details for
Bug 912209
Switch to gnulib-style versioning (git-describe) for emerge --info output from git
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
0001-lib-use-more-pure-git-describe-output-for-version.patch
0001-lib-use-more-pure-git-describe-output-for-version.patch (text/plain), 3.56 KB, created by
Sam James
on 2024-03-14 04:57:44 UTC
(
hide
)
Description:
0001-lib-use-more-pure-git-describe-output-for-version.patch
Filename:
MIME Type:
Creator:
Sam James
Created:
2024-03-14 04:57:44 UTC
Size:
3.56 KB
patch
obsolete
>From 5f34d6e6f69b86efe0a8e8cc1a8673a0e79c2fc7 Mon Sep 17 00:00:00 2001 >From: Sam James <sam@gentoo.org> >Date: Tue, 29 Aug 2023 08:26:36 +0100 >Subject: [PATCH] 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 >--- > lib/portage/__init__.py | 35 ++++------------------------------- > 1 file changed, 4 insertions(+), 31 deletions(-) > >diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py >index 635eea31e..b947f3092 100644 >--- a/lib/portage/__init__.py >+++ b/lib/portage/__init__.py >@@ -729,10 +729,7 @@ if installation.TYPE == installation.TYPES.SOURCE: > BASH_BINARY, > "-c", > ( >- f"cd {_shell_quote(PORTAGE_BASE_PATH)} ; git describe --match 'portage-*' || exit $? ; " >- 'if [ -n "`git diff-index --name-only --diff-filter=M HEAD`" ] ; ' >- "then echo modified ; git rev-list --format=%%ct -n 1 HEAD ; fi ; " >- "exit 0" >+ f"cd {_shell_quote(PORTAGE_BASE_PATH)} ; git describe --dirty --match 'portage-*' || exit $? ; " > ), > ] > cmd = [ >@@ -744,33 +741,9 @@ 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: >- output_lines = output.splitlines() >- if output_lines: >- version_split = output_lines[0].split("-") >- if len(version_split) > 1: >- VERSION = version_split[1] >- patchlevel = False >- if len(version_split) > 2: >- patchlevel = True >- VERSION = f"{VERSION}_p{version_split[2]}" >- if len(output_lines) > 1 and output_lines[1] == "modified": >- head_timestamp = None >- if len(output_lines) > 3: >- try: >- head_timestamp = int(output_lines[3]) >- except ValueError: >- pass >- timestamp = int(time.time()) >- if ( >- head_timestamp is not None >- and timestamp > head_timestamp >- ): >- timestamp = timestamp - head_timestamp >- if not patchlevel: >- VERSION = f"{VERSION}_p0" >- VERSION = f"{VERSION}_p{timestamp}" >- return VERSION >- VERSION = "HEAD" >+ VERSION = output.lstrip('portage-').strip() >+ else: >+ VERSION = "HEAD" > return VERSION > > VERSION = _LazyVersion() >-- >2.44.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 912209
: 887567