1 |
commit: f60d48f824936a052167225bc41f01a8078bce5e |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 26 14:05:06 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 26 14:05:06 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f60d48f8 |
7 |
|
8 |
libq/atom: refine atom_compar_cb behaviour |
9 |
|
10 |
- also consider CATEGORY while sorting (humans expect this) |
11 |
- sort PN caseINsensitive (for Python and Perl pkgs which aren't |
12 |
consistent) |
13 |
|
14 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
15 |
|
16 |
libq/atom.c | 9 ++++++++- |
17 |
1 file changed, 8 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/libq/atom.c b/libq/atom.c |
20 |
index f80bb7d..6e12c0a 100644 |
21 |
--- a/libq/atom.c |
22 |
+++ b/libq/atom.c |
23 |
@@ -855,7 +855,14 @@ atom_compar_cb(const void *l, const void *r) |
24 |
case EQUAL: return 0; |
25 |
case NEWER: return -1; |
26 |
case OLDER: return 1; |
27 |
- default: return strcmp(al->PN, ar->PN); |
28 |
+ default: |
29 |
+ { |
30 |
+ int ret; |
31 |
+ ret = strcmp(al->CATEGORY, ar->CATEGORY); |
32 |
+ if (ret == 0) |
33 |
+ ret = strcasecmp(al->PN, ar->PN); |
34 |
+ return ret; |
35 |
+ } |
36 |
} |
37 |
|
38 |
/* unreachable */ |