Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 788346

Summary: sys-apps/portage: improve numeric sorting of USE flags
Product: Portage Development Reporter: Michał Górny <mgorny>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: gentoo, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-05-05 13:27:07 UTC
Please consider improving the visual sorting algorithm to detect numbers.  Right now python3_10 is being sorted before older versions:

[ebuild   R    ] dev-python/pyparsing-2.4.7-r1::gentoo  USE="-examples" PYTHON_TARGETS="pypy3 python3_10 python3_7 python3_8 python3_9" 0 KiB
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-06-06 06:00:34 UTC
Actually, radhermit came up with a better idea in pkgcore: to sort based on order in profiles/desc.
Comment 2 Larry the Git Cow gentoo-dev 2021-08-15 06:48:53 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=7a4bf042dcc322ead982b151e2a459b3455c6f29

commit 7a4bf042dcc322ead982b151e2a459b3455c6f29
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2021-08-07 15:58:02 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2021-08-07 17:17:16 +0000

    emerge: Sort USE flags in output using combined alnum sort
    
    Sort USE flags in output by a combined sort that treats sequences
    of digits as numbers and sorts them numerically rather than lexically.
    As a result, python3_10 now sorts after python3_9.
    
    Ideally, we'd just respect the order from profiles/desc but this should
    work as an intermediate solution until we figure out how to implement
    that.
    
    Bug: https://bugs.gentoo.org/show_bug.cgi?id=788346
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 lib/_emerge/resolver/output_helpers.py | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)