diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-18 11:04:46 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-18 11:04:46 -0500 |
commit | 22861747b42a5863003c772a50ce3289ddb9d427 (patch) | |
tree | e431eb165572a2a1a9e7656db91426f46a5bad87 | |
parent | ff2ce71b7f860d9af4bccb8041ecf1f6c66eb535 (diff) | |
download | stasis-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.c | 19 |
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) { |