commit: f60d48f824936a052167225bc41f01a8078bce5e
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 26 14:05:06 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Sep 26 14:05:06 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f60d48f8
libq/atom: refine atom_compar_cb behaviour
- also consider CATEGORY while sorting (humans expect this)
- sort PN caseINsensitive (for Python and Perl pkgs which aren't
consistent)
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
libq/atom.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libq/atom.c b/libq/atom.c
index f80bb7d..6e12c0a 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -855,7 +855,14 @@ atom_compar_cb(const void *l, const void *r)
case EQUAL: return 0;
case NEWER: return -1;
case OLDER: return 1;
- default: return strcmp(al->PN, ar->PN);
+ default:
+ {
+ int ret;
+ ret = strcmp(al->CATEGORY, ar->CATEGORY);
+ if (ret == 0)
+ ret = strcasecmp(al->PN, ar->PN);
+ return ret;
+ }
}
/* unreachable */