aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2025-02-18 11:04:46 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2025-02-18 11:04:46 -0500
commit22861747b42a5863003c772a50ce3289ddb9d427 (patch)
treee431eb165572a2a1a9e7656db91426f46a5bad87
parentff2ce71b7f860d9af4bccb8041ecf1f6c66eb535 (diff)
downloadstasis-22861747b42a5863003c772a50ce3289ddb9d427.tar.gz
sort_by_latest_rc now sorts against the rc, platform, and python version (descending)
-rw-r--r--src/cli/stasis_indexer/helpers.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/cli/stasis_indexer/helpers.c b/src/cli/stasis_indexer/helpers.c
index e337787..76d50f9 100644
--- a/src/cli/stasis_indexer/helpers.c
+++ b/src/cli/stasis_indexer/helpers.c
@@ -192,11 +192,26 @@ int sort_by_latest_rc(const void *a, const void *b) {
const struct Delivery *bb = b;
if (aa->meta.rc > bb->meta.rc) {
return -1;
+ } else if (aa->meta.rc < bb->meta.rc) {
+ return 1;
}
- if (aa->meta.rc < bb->meta.rc) {
+
+ if (strcmp(aa->system.platform[DELIVERY_PLATFORM_RELEASE], bb->system.platform[DELIVERY_PLATFORM_RELEASE]) > 0) {
return 1;
+ } else if (strcmp(aa->system.platform[DELIVERY_PLATFORM_RELEASE], bb->system.platform[DELIVERY_PLATFORM_RELEASE]) < 0) {
+ return -1;
+ }
+
+ char *err = NULL;
+ unsigned pyc_a = strtoul(aa->meta.python_compact, &err, 10);
+ unsigned pyc_b = strtoul(bb->meta.python_compact, &err, 10);
+ if (pyc_a > pyc_b) {
+ return -1;
+ } else if (pyc_b < pyc_a) {
+ return 1;
+ } else {
+ return 0;
}
- return 0;
}
struct Delivery *get_latest_deliveries(struct Delivery ctx[], size_t nelem) {