Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 788346 - sys-apps/portage: improve numeric sorting of USE flags
Summary: sys-apps/portage: improve numeric sorting of USE flags
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
Depends on:
Reported: 2021-05-05 13:27 UTC by Michał Górny
Modified: 2021-08-16 02:47 UTC (History)
2 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
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):

commit 7a4bf042dcc322ead982b151e2a459b3455c6f29
Author:     Michał Górny <>
AuthorDate: 2021-08-07 15:58:02 +0000
Commit:     Michał Górny <>
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
    Signed-off-by: Michał Górny <>

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